diff --git a/api/task.js b/api/task.js index b982545..9488848 100644 --- a/api/task.js +++ b/api/task.js @@ -39,5 +39,5 @@ export const taskOtherTaskDetail = (data) => oahttp.get('/task/other_task_detail /** * 任务:提交其他任务 */ -export const taskOtherTaskUpload = (data) => oahttp.post('/task/commit', data) +export const taskOtherTaskCommit = (data) => oahttp.post('/task/cimmit_other_task', data) diff --git a/subpkg/otherTask/otherTask.vue b/subpkg/otherTask/otherTask.vue index e8dccef..153b0c4 100644 --- a/subpkg/otherTask/otherTask.vue +++ b/subpkg/otherTask/otherTask.vue @@ -14,24 +14,25 @@ 详情描述 - 添加附件 - + - + + - - - + + + @@ -41,7 +42,7 @@ } from "@/api/file.js" import { taskOtherTaskDetail, - taskOtherTaskUpload + taskOtherTaskCommit } from "@/api/task.js" import { Toast } from "../../libs/uniApi"; export default { @@ -66,41 +67,42 @@ import { Toast } from "../../libs/uniApi"; computed: { // 占位长度 placeholderLength() { + if(this.other.is_commit==1) return this.fileList.length % 3 == 0 ? 0 : 3 - this.fileList.length % 3; return (this.fileList.length + 1) % 3 == 0 ? 0 : 3 - (this.fileList.length + 1) % 3; } }, methods: { + // 初始化 initDetail() { taskOtherTaskDetail({ id: this.task_id }).then((res) => { this.task_info = res.data; this.other = res.data?.extend?.other; + res.data?.extend?.other?.annex ? this.fileList = res.data?.extend?.other?.annex : null; }) }, async submit(){ - console.log('提交'); if(this.other.note.trim()=='')return Toast('详情描述不能为空'); - await taskOtherTaskUpload({ + await taskOtherTaskCommit({ id: this.task_id, - extend: { - other: { - note: this.other.note, - annex: this.other.annex - } - } + note: this.other.note, + annex: this.fileList }); this.other.is_commit = 1; Toast('提交成功') }, + showToast(str){ + Toast(str) + }, chooseFile() { uni.chooseImage({ sizeType: ['compressed'], success: async (res) => { for (let item of res.tempFiles) { - let res = await upLoadImage({ + let ul = await upLoadImage({ filePath: item.path, name: 'file' }); - this.fileList.push(res.data.uri); + this.fileList.push(ul.data.uri); } // this.fileList = [...this.fileList, res.tempFiles] }