Browse Source

修正交互ing

master
= 4 years ago
parent
commit
1cdd6608d7
10 changed files with 12 additions and 6 deletions
  1. +6
    -2
      APP/static/js/wsy.js
  2. +1
    -1
      APP/templates/add.html
  3. BIN
      APP/view/__pycache__/auth.cpython-37.pyc
  4. BIN
      APP/view/__pycache__/block.cpython-37.pyc
  5. BIN
      APP/view/__pycache__/collection.cpython-37.pyc
  6. BIN
      APP/view/__pycache__/database.cpython-37.pyc
  7. BIN
      APP/view/__pycache__/model.cpython-37.pyc
  8. BIN
      APP/view/__pycache__/start.cpython-37.pyc
  9. +4
    -2
      APP/view/block.py
  10. +1
    -1
      APP/view/model.py

+ 6
- 2
APP/static/js/wsy.js View File

@ -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];

+ 1
- 1
APP/templates/add.html View File

@ -470,7 +470,7 @@
aria-expanded="false" class="text-white btn btn-link" v-if="id!='null'">
<i class="fa fa-ellipsis-h"></i>
</button>
<div v-if="id==null"tabindex="-1" role="menu" aria-hidden="true"
<div v-if="id!=null"tabindex="-1" role="menu" aria-hidden="true"
class="dropdown-menu-lg dropdown-menu-right dropdown-menu">
<ul class="nav flex-column">
<li class="nav-item-header nav-item">操作</li>

BIN
APP/view/__pycache__/auth.cpython-37.pyc View File


BIN
APP/view/__pycache__/block.cpython-37.pyc View File


BIN
APP/view/__pycache__/collection.cpython-37.pyc View File


BIN
APP/view/__pycache__/database.cpython-37.pyc View File


BIN
APP/view/__pycache__/model.cpython-37.pyc View File


BIN
APP/view/__pycache__/start.cpython-37.pyc View File


+ 4
- 2
APP/view/block.py View File

@ -11,16 +11,18 @@ bp_block = Blueprint("block", __name__, url_prefix="/block")
@bp_block.route("/add", methods=["POST"])
def add_block():
type = request.form.get('type')
content = request.form.get("content")
collection_id = request.form.get("collection_id")
id = str(uuid.uuid4())
print(request.form)
try:
count = Block.query.count()
print(count)
if type == 'text' or type == 'url':
content = request.form.get("content")
b = Block(type=type, content_text=content, order=count, id=id)
else:
content = request.files.get("content")
b = Block(type=type, content_pic=content, order=count, id=id)
db_session.add(b)
cb = CollectionBlock(id=collection_id, block_id=id)

+ 1
- 1
APP/view/model.py View File

@ -53,7 +53,7 @@ class CollectionBlock(Base):
__tablename__ = 'collection_block'
id = Column(String(255), primary_key=True)
# password = Column(String(255))
block_id = Column(String(255))
block_id = Column(String(255), primary_key=True)
def __init__(self, id=None, block_id=None):
self.id = id

Loading…
Cancel
Save