文档服务地址:http://47.92.0.57:3000/ 周报索引地址:http://47.92.0.57:3000/s/NruNXRYmV

Commit 52cc60cc by 李景熙

添加发布任务后端

parent a747bb10
...@@ -347,7 +347,7 @@ export default { ...@@ -347,7 +347,7 @@ export default {
fileName: new Array(), fileName: new Array(),
textarea:'', textarea:'',
}], }],
layerDoamins:[{ layerDomains:[{
fileName: new Array(), fileName: new Array(),
textarea:'', textarea:'',
}], }],
...@@ -402,7 +402,7 @@ export default { ...@@ -402,7 +402,7 @@ export default {
task: this.dynamicValidateForm, task: this.dynamicValidateForm,
} }
}).then(res=>{ }).then(res=>{
if(res.data.code == 1){ if(res.code == 1){
self.$router.push({path: '/releaseTask'}); self.$router.push({path: '/releaseTask'});
} }
else{ else{
......
import json import json
from flask import Blueprint from flask import Blueprint
from flask import request from flask import request
from Dao import Task from Dao import Task, Slice
task = Blueprint("task", __name__, url_prefix="/api/task") task = Blueprint("task", __name__, url_prefix="/api/task")
...@@ -37,5 +37,26 @@ def get_tasks(): ...@@ -37,5 +37,26 @@ def get_tasks():
@task.route("/createTask", methods=["Post"]) @task.route("/createTask", methods=["Post"])
def create_task(): def create_task():
data = request.get_json(silent=True) data = request.get_json(silent=True)
ret = Task.create_task(data['userId'], data['taskName'])
tid = ret.data
i = 0
print(data)
while i < len(data['task']['domains']):
# 创建分片具体内容还有问题,待修复
Slice.create_text_slice(tid, data['task']['domains'][i]['piecesOption'])
i += 1
i = 0
while i < len(data['task']['pictureDomains']):
Slice.create_pic_slice(tid, data['task']['pictureDomains'][i]['textarea'])
i += 1
i = 0
while i < len(data['task']['layerDomains']):
Slice.create_layer_slice(tid, data['task']['layerDomains'][i]['textarea'])
i += 1
res = {
'code': ret.code,
'message': ret.message,
'data': ret.data
}
return json.dumps(res)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment