diff --git a/static/img/task/video_bg.png b/static/img/task/video_bg.png new file mode 100644 index 0000000..63755ae Binary files /dev/null and b/static/img/task/video_bg.png differ diff --git a/subpkg/otherTask/otherTask.vue b/subpkg/otherTask/otherTask.vue index d1817b1..0b980a5 100644 --- a/subpkg/otherTask/otherTask.vue +++ b/subpkg/otherTask/otherTask.vue @@ -11,16 +11,24 @@ {{task_info.content}} + + 驳回提示 + + {{deny_notes}} + + 详情描述 - 添加附件 - - + + + @@ -31,10 +39,12 @@ - - - - + + + + + @@ -47,18 +57,12 @@ + - - - - - - - - + @@ -78,22 +82,24 @@ data() { return { task_id: -1, - task_info: { - - }, + task_info: {}, + approve_status: 0, // 审核状态: 1待审核,2已通过,3已驳回 + deny_notes: '', // 驳回提示 other: { - annex: [], // 附件列表 + annex: [], // 图片列表 is_commit: 0, // 是否提交 note: "", // 详情描述 + video_annex: [] // 视频列表 }, list1: [{ name: '图片', }, { name: '视频', }], - current: 1, + current: 0, + note: '', fileList: [], - videoList: ['https://ceshi-worker-task.lihaink.cn/uploads/video/20230916/20230916144834ddf521318.mp4'], + videoList: [], video_src: '', show_video: false }; @@ -118,21 +124,53 @@ initDetail() { taskOtherTaskDetail({ id: this.task_id }).then((res) => { this.task_info = res.data; - this.other = res.data?.extend?.other; + this.other = JSON.parse(JSON.stringify(res.data?.extend?.other)); // 深拷贝 + this.approve_status = res.data?.approve_status; + this.deny_notes = res.data?.deny_notes; + res.data?.extend?.other?.note ? this.note = res.data?.extend?.other?.note : null; res.data?.extend?.other?.annex ? this.fileList = res.data?.extend?.other?.annex : null; - this.other.is_commit = 0; + res.data?.extend?.other?.video_annex ? this.videoList = res.data?.extend?.other?.video_annex : null; + // this.other.is_commit = 0; }) }, + // 被驳回时点击重新修改 + toUpdate() { + this.other.is_commit = 0; + }, + // 判断内容是否更改, 返回true代表更改 + isReject(){ + if (this.approve_status == 3) { // 被驳回,重新提交需要修改内容后方可提交 + let other = { + note: this.note, + annex: this.fileList, + video_annex: this.videoList + } + let flag = true; + if(JSON.stringify(other)==JSON.stringify({ + note: this.other.note, + annex: this.other.annex, + video_annex: this.other.video_annex + })) flag = false; + if (!flag) { + Toast('未检测到您的修改,请修改后提交') + } + return flag; + } + else return true; + }, + // 提交 async submit() { + if(!this.isReject())return; // 判断是否进行更改 if (this.other.note.trim() == '') return Toast('详情描述不能为空'); await taskOtherTaskCommit({ id: this.task_id, - note: this.other.note, + note: this.note, annex: this.fileList, - vedio_annex: this.videoList + video_annex: this.videoList }); this.other.is_commit = 1; - Toast('提交成功') + this.approve_status = 1; + Toast('提交成功'); }, clickTabs(item) { this.current = item.index; @@ -151,39 +189,47 @@ }); this.fileList.push(ul.data.uri); } - // this.fileList = [...this.fileList, res.tempFiles] } }); }, - chooseVideo(){ - console.log(VIDEO_URL); + chooseVideo() { uni.chooseVideo({ sourceType: ['album', 'camera'], // 视频选择的来源,可以是相册或摄像头 maxDuration: 60, // 视频最大时长,单位秒 success: (res) => { - // 选择视频成功的回调函数 const video = res.tempFilePath; - // this.videoList.push(video) - // return ; - uni.uploadFile({ + let timer; + let title = '上传中'; + timer = setInterval(() => { + uni.showLoading({ + title: title + }) + }, 1000) + // 上传视频文件 + let uploadTask = uni.uploadFile({ url: VIDEO_URL, filePath: video, name: 'file', - header:{ + header: { token: this.$store.state.app.token }, success: (uploadFileRes) => { - console.log(uploadFileRes); + clearInterval(timer); + uni.hideLoading(); uploadFileRes.data = JSON.parse(uploadFileRes.data) - if(uploadFileRes.data.code==1) { - this.videoList.push(uploadFileRes.data.uri) - } - else Toast('网络错误') + if (uploadFileRes.data.code == 1) { + this.videoList.push(uploadFileRes.data.data.uri) + } else Toast('网络错误') }, fail: (err) => { + clearInterval(timer); + uni.hideLoading(); Toast('网络错误') } }) + uploadTask.onProgressUpdate((fileRes) => { + title = `上传中...${fileRes.progress}%`; + }) }, fail() { Toast('用户取消上传') @@ -205,25 +251,17 @@ }, /*查看视频*/ videoshow(src) { - console.log('视频', src); this.video_src = src; - this.show_video = true; - this.$nextTick(() => { + this.show_video = true; + this.$nextTick(() => { this.videoContext = uni.createVideoContext('myVideo', this); - this.videoContext.play(); - }) + this.videoContext.play(); + }) }, - screenChange(e) { - let fullScreen = e.detail.fullScreen; //值true为进入全屏,false为退出全屏 - // console.log(e, "qweeee========================================"); - if (!fullScreen) { - this.videoplay = false - //退出全屏 this.videoplay = false; // 隐藏播放盒子 - } - }, - deleteFile(index, type='image') { - if(type=='image') this.fileList.splice(index, 1); - else if(type=='video') this.videoList.splice(index, 1); + // 删除已上传文件 + deleteFile(index, type = 'image') { + if (type == 'image') this.fileList.splice(index, 1); + else if (type == 'video') this.videoList.splice(index, 1); }, navTo(url) { if (url) { @@ -244,27 +282,29 @@ \ No newline at end of file