diff --git a/APP/static/js/wsy.js b/APP/static/js/wsy.js index b71eed8..71df8bb 100644 --- a/APP/static/js/wsy.js +++ b/APP/static/js/wsy.js @@ -97,6 +97,8 @@ function submit(content, type, order) { data.append("content", content); data.append('type', type); data.append('collection_id', page.id); + console.log(data.get('content')); + sendRequest(url, data, function () { getContent('block'); }) @@ -131,6 +133,7 @@ function getContent(type) { for (i in page.textList) { page.textList[i]['order'] = i; if (type == 'block' && page.textList[i]['type'] == 'picture') { + console.log(page.textList[i]); page.textList[i]['content'] = get_url(page.textList[i]['content']); } @@ -177,9 +180,10 @@ async function checkLike(list) { } function get_url(f) { let reader = new FileReader(); + console.log(f); reader.readAsDataURL(f); reader.onload = function (e) { - return e.target.result; + return e.target.files[0] || e.dataTransfer.files[0]; }; } @@ -331,7 +335,7 @@ var recommend = new Vue({ jump_to: function (url, block_name) { cookie.setCookie('name',block_name); cookie.setCookie('id',null); - window.location.href = "%%url_for('"+url+"')%%"; + window.location.href = "/add"; }, like: function (order) { var obj = this.textList[order]; diff --git a/APP/templates/add.html b/APP/templates/add.html index 053ec1f..bae7744 100644 --- a/APP/templates/add.html +++ b/APP/templates/add.html @@ -470,7 +470,7 @@ aria-expanded="false" class="text-white btn btn-link" v-if="id!='null'"> -