完善其他任务的提交

This commit is contained in:
weipengfei 2023-09-16 17:47:48 +08:00
parent 2b1e28cda4
commit e0357759e7
2 changed files with 124 additions and 74 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@ -11,16 +11,24 @@
<u-line style="margin: 14rpx 0;"></u-line> <u-line style="margin: 14rpx 0;"></u-line>
<view class="text">{{task_info.content}}</view> <view class="text">{{task_info.content}}</view>
</view> </view>
<view class="card" v-if="approve_status==3">
<view class="title" style="color: #FF7C32;">驳回提示</view>
<u-line style="margin: 14rpx 0;"></u-line>
<view class="text" style="color: #FF7C32;">{{deny_notes}}</view>
<button v-if="other.is_commit==1" class="btn" @click="toUpdate">去修改</button>
</view>
<view class="card"> <view class="card">
<view class="title">详情描述</view> <view class="title">详情描述</view>
<u-line style="margin: 14rpx 0;"></u-line> <u-line style="margin: 14rpx 0;"></u-line>
<u--textarea :disabled="other.is_commit==1" v-model="other.note" placeholder="请输入内容" <u--textarea :disabled="other.is_commit==1" v-model="note" placeholder="请输入内容"
placeholderStyle="font-size: 22rpx;" style="font-size: 28rpx;background-color: #eee;min-height: 100px;" placeholderStyle="font-size: 22rpx;" style="font-size: 28rpx;background-color: #eee;min-height: 100px;"
autoHeight maxlength="-1"></u--textarea> autoHeight maxlength="-1"></u--textarea>
<view class="title" style="margin-top: 16rpx;">添加附件</view> <view class="title" style="margin-top: 16rpx;">添加附件</view>
<u-tabs :current="current" :list="list1" @click="clickTabs" lineColor='#0122c7' :itemStyle="{height: '80rpx'}" lineWidth='20' <u-tabs :current="current" :list="list1" @click="clickTabs" lineColor='#0122c7' :itemStyle="{height: '80rpx'}"
inactiveStyle='color:#666' activeStyle="color:#0122c7" style="margin-bottom: 16rpx;font-size: 28rpx;"></u-tabs> lineWidth='20' inactiveStyle='color:#666' activeStyle="color:#0122c7"
<view class="file" v-if="current==0"> style="margin-bottom: 16rpx;font-size: 28rpx;"></u-tabs>
<!-- 图片 -->
<view class="file" v-show="current==0">
<view class="file_item" v-for="(item, index) in fileList" :key="'file'+index"> <view class="file_item" v-for="(item, index) in fileList" :key="'file'+index">
<image class="image" :src="item" @click="priview(index)"></image> <image class="image" :src="item" @click="priview(index)"></image>
<image v-if="!other.is_commit" class="del" src="/static/icons/delete.png" @click.stop="deleteFile(index)"> <image v-if="!other.is_commit" class="del" src="/static/icons/delete.png" @click.stop="deleteFile(index)">
@ -31,10 +39,12 @@
</view> </view>
<view class="file_empty" v-for="k in placeholderLength" :key="'empty'+k"></view> <view class="file_empty" v-for="k in placeholderLength" :key="'empty'+k"></view>
</view> </view>
<view class="file" v-else> <!-- 视频 -->
<view class="file_item" v-for="(item, index) in videoList" :key="'file'+index"> <view class="file" v-show="current==1">
<image class="image" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/luzhou/static4/3/video_bg.png" @click="videoshow(item)"></image> <view class="file_item" v-for="(item, index) in videoList" :key="'file_v'+index">
<image v-if="!other.is_commit" class="del" src="/static/icons/delete.png" @click.stop="deleteFile(index, 'video')"> <image class="image" src="/static/img/task/video_bg.png" @click="videoshow(item)"></image>
<image v-if="!other.is_commit" class="del" src="/static/icons/delete.png"
@click.stop="deleteFile(index, 'video')">
</image> </image>
</view> </view>
<view v-if="!other.is_commit" class="file_btn" @click="chooseVideo"> <view v-if="!other.is_commit" class="file_btn" @click="chooseVideo">
@ -47,18 +57,12 @@
<mybtn v-if="!other.is_commit" 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" @click="showToast('任务已完成')"></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-if="task_info.status==5" text="已关闭" :my_btn_disabled="true" @click="showToast('任务已关闭!')"></mybtn>
<mybtn v-else-if="approve_status==3" text="已驳回,请重新提交" @click="toUpdate"></mybtn>
<mybtn v-else text="已提交,请等待审核" :my_btn_disabled="true" @click="showToast('请耐心等待审核结果')"></mybtn> <mybtn v-else text="已提交,请等待审核" :my_btn_disabled="true" @click="showToast('请耐心等待审核结果')"></mybtn>
<!--视频预览弹窗--> <!--视频预览弹窗-->
<view v-if="show_video" class="video-count"> <view v-if="show_video" class="video-count">
<video id="myVideo" class="videoLink" autoplay loop muted :src="video_src"></video> <video id="myVideo" class="videoLink" autoplay loop muted show-mute-btn enable-play-gesture
<!--#ifndef APP-PLUS--> vslide-gesture-in-fullscreen :src="video_src"></video>
<!-- <video id="myVideo" class="videoLink" autoplay loop muted :src="video_src"></video> -->
<!--#endif-->
<!--#ifdef APP-PLUS-->
<!-- <video id="myVideo" class="videoLink" autoplay loop
:src='video_src && (video_src.substring(0,4) == "http" || video_src.substring(0,5) == "https") ? video_src : "http:" + video_src'></video> -->
<!--#endif-->
</view> </view>
<view class='mask' catchtouchmove="true" :hidden='show_video==false' @tap="show_video=false"></view> <view class='mask' catchtouchmove="true" :hidden='show_video==false' @tap="show_video=false"></view>
</view> </view>
@ -78,22 +82,24 @@
data() { data() {
return { return {
task_id: -1, task_id: -1,
task_info: { task_info: {},
approve_status: 0, // 123
}, deny_notes: '', //
other: { other: {
annex: [], // annex: [], //
is_commit: 0, // is_commit: 0, //
note: "", // note: "", //
video_annex: [] //
}, },
list1: [{ list1: [{
name: '图片', name: '图片',
}, { }, {
name: '视频', name: '视频',
}], }],
current: 1, current: 0,
note: '',
fileList: [], fileList: [],
videoList: ['https://ceshi-worker-task.lihaink.cn/uploads/video/20230916/20230916144834ddf521318.mp4'], videoList: [],
video_src: '', video_src: '',
show_video: false show_video: false
}; };
@ -118,21 +124,53 @@
initDetail() { initDetail() {
taskOtherTaskDetail({ id: this.task_id }).then((res) => { taskOtherTaskDetail({ id: this.task_id }).then((res) => {
this.task_info = res.data; 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; 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() { async submit() {
if(!this.isReject())return; //
if (this.other.note.trim() == '') return Toast('详情描述不能为空'); if (this.other.note.trim() == '') return Toast('详情描述不能为空');
await taskOtherTaskCommit({ await taskOtherTaskCommit({
id: this.task_id, id: this.task_id,
note: this.other.note, note: this.note,
annex: this.fileList, annex: this.fileList,
vedio_annex: this.videoList video_annex: this.videoList
}); });
this.other.is_commit = 1; this.other.is_commit = 1;
Toast('提交成功') this.approve_status = 1;
Toast('提交成功');
}, },
clickTabs(item) { clickTabs(item) {
this.current = item.index; this.current = item.index;
@ -151,39 +189,47 @@
}); });
this.fileList.push(ul.data.uri); this.fileList.push(ul.data.uri);
} }
// this.fileList = [...this.fileList, res.tempFiles]
} }
}); });
}, },
chooseVideo(){ chooseVideo() {
console.log(VIDEO_URL);
uni.chooseVideo({ uni.chooseVideo({
sourceType: ['album', 'camera'], // sourceType: ['album', 'camera'], //
maxDuration: 60, // maxDuration: 60, //
success: (res) => { success: (res) => {
//
const video = res.tempFilePath; const video = res.tempFilePath;
// this.videoList.push(video) let timer;
// return ; let title = '上传中';
uni.uploadFile({ timer = setInterval(() => {
uni.showLoading({
title: title
})
}, 1000)
//
let uploadTask = uni.uploadFile({
url: VIDEO_URL, url: VIDEO_URL,
filePath: video, filePath: video,
name: 'file', name: 'file',
header:{ header: {
token: this.$store.state.app.token token: this.$store.state.app.token
}, },
success: (uploadFileRes) => { success: (uploadFileRes) => {
console.log(uploadFileRes); clearInterval(timer);
uni.hideLoading();
uploadFileRes.data = JSON.parse(uploadFileRes.data) uploadFileRes.data = JSON.parse(uploadFileRes.data)
if(uploadFileRes.data.code==1) { if (uploadFileRes.data.code == 1) {
this.videoList.push(uploadFileRes.data.uri) this.videoList.push(uploadFileRes.data.data.uri)
} } else Toast('网络错误')
else Toast('网络错误')
}, },
fail: (err) => { fail: (err) => {
clearInterval(timer);
uni.hideLoading();
Toast('网络错误') Toast('网络错误')
} }
}) })
uploadTask.onProgressUpdate((fileRes) => {
title = `上传中...${fileRes.progress}%`;
})
}, },
fail() { fail() {
Toast('用户取消上传') Toast('用户取消上传')
@ -205,7 +251,6 @@
}, },
/*查看视频*/ /*查看视频*/
videoshow(src) { videoshow(src) {
console.log('视频', src);
this.video_src = src; this.video_src = src;
this.show_video = true; this.show_video = true;
this.$nextTick(() => { this.$nextTick(() => {
@ -213,17 +258,10 @@
this.videoContext.play(); this.videoContext.play();
}) })
}, },
screenChange(e) { //
let fullScreen = e.detail.fullScreen; //truefalse退 deleteFile(index, type = 'image') {
// console.log(e, "qweeee========================================"); if (type == 'image') this.fileList.splice(index, 1);
if (!fullScreen) { else if (type == 'video') this.videoList.splice(index, 1);
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);
}, },
navTo(url) { navTo(url) {
if (url) { if (url) {
@ -244,9 +282,10 @@
</script> </script>
<style lang="scss"> <style lang="scss">
::v-deep .u-tabs__wrapper__nav__item__text{ ::v-deep .u-tabs__wrapper__nav__item__text {
font-size: 28rpx !important; font-size: 28rpx !important;
} }
.video-count { .video-count {
position: fixed; position: fixed;
width: 600rpx; width: 600rpx;
@ -265,6 +304,7 @@
height: 500rpx; height: 500rpx;
} }
} }
.card { .card {
margin: 0 auto; margin: 0 auto;
margin-bottom: 28rpx; margin-bottom: 28rpx;
@ -283,6 +323,15 @@
line-height: 50rpx; line-height: 50rpx;
} }
.btn {
background-color: $theme-oa-color;
color: #FFFFFF;
font-size: 28rpx;
height: 60rpx;
line-height: 60rpx;
margin-top: 16rpx;
}
.file { .file {
display: flex; display: flex;
justify-content: left; justify-content: left;
@ -341,5 +390,6 @@
border: 2px solid transparent; border: 2px solid transparent;
} }
} }
} }
</style> </style>