完成任务提交

This commit is contained in:
weipengfei 2023-09-14 15:11:56 +08:00
parent 036c737f1d
commit 25da8d06d4
2 changed files with 20 additions and 18 deletions

View File

@ -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)

View File

@ -14,24 +14,25 @@
<view class="card">
<view class="title">详情描述</view>
<u-line style="margin: 14rpx 0;"></u-line>
<u--textarea v-model="other.note" placeholder="请输入内容" placeholderStyle="font-size: 22rpx;"
<u--textarea :disabled="other.is_commit==1" v-model="other.note" placeholder="请输入内容" placeholderStyle="font-size: 22rpx;"
style="font-size: 28rpx;background-color: #eee;min-height: 100px;" autoHeight maxlength="-1"></u--textarea>
<view class="title" style="margin: 16rpx 0;">添加附件</view>
<view class="file">
<view class="file_item" v-for="(item, index) in fileList" :key="'file'+index">
<image class="image" :src="item" @click="priview(index)"></image>
<image class="del" src="/static/icons/delete.png" @click.stop="deleteFile(index)"></image>
<image v-if="!other.is_commit" class="del" src="/static/icons/delete.png" @click.stop="deleteFile(index)"></image>
</view>
<view class="file_btn" @click="chooseFile">
<view v-if="!other.is_commit" class="file_btn" @click="chooseFile">
<image src="/static/icons/plus.png"></image>
</view>
<view class="file_empty" v-for="k in placeholderLength" :key="'empty'+k"></view>
</view>
</view>
<!-- <mybtn text="确认提交" @click="$u.throttle(submit, 1500)"></mybtn> -->
<mybtn v-if="!other.is_commit" text="确认提交" @click="$u.throttle(submit, 1500)"></mybtn>
<mybtn v-else-if="task_info.status==3" text="已完成" :my_btn_disabled="true"></mybtn>
<mybtn v-else-if="task_info.status==5" text="已关闭" :my_btn_disabled="true"></mybtn>
<mybtn v-else text="已提交" :my_btn_disabled="true"></mybtn>
<mybtn v-else-if="task_info.status==3" text="已完成" :my_btn_disabled="true" @click="showToast('任务已完成')"></mybtn>
<mybtn v-else-if="task_info.status==5" text="已关闭" :my_btn_disabled="true" @click="showToast('任务已关闭!')"></mybtn>
<mybtn v-else text="已提交,请等待审核" :my_btn_disabled="true" @click="showToast('请耐心等待审核结果')"></mybtn>
</view>
</template>
@ -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]
}