更新了其他任务上传视频
This commit is contained in:
parent
b4982abc6a
commit
73ec8dc947
@ -19,9 +19,7 @@ function toLogin() {
|
||||
function upLoad(url, data) {
|
||||
let Url = HTTP_REQUEST_URL_THREE,
|
||||
header = {}
|
||||
// if (store.state.app.token) header[TOKENNAME] = 'Bearer ' + store.state.app.token;
|
||||
if (store.state.app.token) header[TOKENNAME] = store.state.app.token;
|
||||
// header[TOKENNAME] = 'Bearer sdjflidshjgfkbdasgjmasbgvhauuiavhkesvndkaesbvkjsdbv';
|
||||
return new Promise((reslove, reject) => {
|
||||
uni.uploadFile({
|
||||
url: Url + '/api' + url,
|
||||
@ -41,4 +39,6 @@ function upLoad(url, data) {
|
||||
|
||||
export const upLoadImage = (data)=>{
|
||||
return upLoad('/upload/image', data)
|
||||
}
|
||||
}
|
||||
|
||||
export const VIDEO_URL = HTTP_REQUEST_URL_THREE + '/api/upload/video'
|
@ -24,7 +24,8 @@
|
||||
"Payment" : {},
|
||||
"Barcode" : {},
|
||||
"Camera" : {},
|
||||
"Maps" : {}
|
||||
"Maps" : {},
|
||||
"VideoPlayer" : {}
|
||||
},
|
||||
/* 应用发布信息 */
|
||||
"distribute" : {
|
||||
|
@ -14,37 +14,65 @@
|
||||
<view class="card">
|
||||
<view class="title">详情描述</view>
|
||||
<u-line style="margin: 14rpx 0;"></u-line>
|
||||
<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">
|
||||
<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-top: 16rpx;">添加附件</view>
|
||||
<u-tabs :current="current" :list="list1" @click="clickTabs" lineColor='#0122c7' :itemStyle="{height: '80rpx'}" lineWidth='20'
|
||||
inactiveStyle='color:#666' activeStyle="color:#0122c7" style="margin-bottom: 16rpx;font-size: 28rpx;"></u-tabs>
|
||||
<view class="file" v-if="current==0">
|
||||
<view class="file_item" v-for="(item, index) in fileList" :key="'file'+index">
|
||||
<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>
|
||||
<image v-if="!other.is_commit" class="del" src="/static/icons/delete.png" @click.stop="deleteFile(index)">
|
||||
</image>
|
||||
</view>
|
||||
<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 class="file" v-else>
|
||||
<view class="file_item" v-for="(item, index) in videoList" :key="'file'+index">
|
||||
<image class="image" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/luzhou/static4/3/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>
|
||||
</view>
|
||||
<view v-if="!other.is_commit" class="file_btn" @click="chooseVideo">
|
||||
<image src="/static/icons/plus.png"></image>
|
||||
</view>
|
||||
<view class="file_empty" v-for="k in placeholderLengthVideo" :key="'empty_v'+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" @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 v-if="show_video" class="video-count">
|
||||
<!--#ifndef APP-PLUS-->
|
||||
<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 class='mask' catchtouchmove="true" :hidden='show_video==false' @tap="show_video=false"></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
upLoadImage
|
||||
upLoadImage,
|
||||
VIDEO_URL
|
||||
} from "@/api/file.js"
|
||||
import {
|
||||
taskOtherTaskDetail,
|
||||
taskOtherTaskCommit
|
||||
} from "@/api/task.js"
|
||||
import { Toast } from "../../libs/uniApi";
|
||||
import { Toast } from "../../libs/uniApi";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@ -57,7 +85,16 @@ import { Toast } from "../../libs/uniApi";
|
||||
is_commit: 0, // 是否提交
|
||||
note: "", // 详情描述
|
||||
},
|
||||
fileList: []
|
||||
list1: [{
|
||||
name: '图片',
|
||||
}, {
|
||||
name: '视频',
|
||||
}],
|
||||
current: 0,
|
||||
fileList: [],
|
||||
videoList: [],
|
||||
video_src: '',
|
||||
show_video: false
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
@ -67,9 +104,13 @@ 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;
|
||||
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;
|
||||
}
|
||||
},
|
||||
placeholderLengthVideo() {
|
||||
if (this.other.is_commit == 1) return this.videoList.length % 3 == 0 ? 0 : 3 - this.videoList.length % 3;
|
||||
return (this.videoList.length + 1) % 3 == 0 ? 0 : 3 - (this.videoList.length + 1) % 3;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
// 初始化
|
||||
@ -78,19 +119,24 @@ import { Toast } from "../../libs/uniApi";
|
||||
this.task_info = res.data;
|
||||
this.other = res.data?.extend?.other;
|
||||
res.data?.extend?.other?.annex ? this.fileList = res.data?.extend?.other?.annex : null;
|
||||
this.other.is_commit = 0;
|
||||
})
|
||||
},
|
||||
async submit(){
|
||||
if(this.other.note.trim()=='')return Toast('详情描述不能为空');
|
||||
async submit() {
|
||||
if (this.other.note.trim() == '') return Toast('详情描述不能为空');
|
||||
await taskOtherTaskCommit({
|
||||
id: this.task_id,
|
||||
note: this.other.note,
|
||||
annex: this.fileList
|
||||
annex: this.fileList,
|
||||
vedio_annex: this.videoList
|
||||
});
|
||||
this.other.is_commit = 1;
|
||||
Toast('提交成功')
|
||||
},
|
||||
showToast(str){
|
||||
clickTabs(item) {
|
||||
this.current = item.index;
|
||||
},
|
||||
showToast(str) {
|
||||
Toast(str)
|
||||
},
|
||||
chooseFile() {
|
||||
@ -106,7 +152,40 @@ import { Toast } from "../../libs/uniApi";
|
||||
}
|
||||
// this.fileList = [...this.fileList, res.tempFiles]
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
chooseVideo(){
|
||||
console.log(VIDEO_URL);
|
||||
uni.chooseVideo({
|
||||
sourceType: ['album', 'camera'], // 视频选择的来源,可以是相册或摄像头
|
||||
maxDuration: 60, // 视频最大时长,单位秒
|
||||
success: (res) => {
|
||||
// 选择视频成功的回调函数
|
||||
const video = res.tempFilePath;
|
||||
uni.uploadFile({
|
||||
url: VIDEO_URL,
|
||||
filePath: video,
|
||||
name: 'file',
|
||||
header:{
|
||||
token: this.$store.state.app.token
|
||||
},
|
||||
success: (uploadFileRes) => {
|
||||
console.log(uploadFileRes);
|
||||
uploadFileRes.data = JSON.parse(uploadFileRes.data)
|
||||
if(uploadFileRes.data.code==1) {
|
||||
this.videoList.push()
|
||||
}
|
||||
else Toast('网络错误')
|
||||
},
|
||||
fail: (err) => {
|
||||
Toast('网络错误')
|
||||
}
|
||||
})
|
||||
},
|
||||
fail() {
|
||||
Toast('用户取消上传')
|
||||
}
|
||||
});
|
||||
},
|
||||
priview(index) {
|
||||
uni.previewImage({
|
||||
@ -121,8 +200,27 @@ import { Toast } from "../../libs/uniApi";
|
||||
},
|
||||
})
|
||||
},
|
||||
deleteFile(index) {
|
||||
this.fileList.splice(index, 1);
|
||||
/*查看视频*/
|
||||
videoshow(src) {
|
||||
console.log('视频', src);
|
||||
this.video_src = src;
|
||||
this.show_video = true;
|
||||
this.$nextTick(() => {
|
||||
this.videoContext = uni.createVideoContext('myVideo', this);
|
||||
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);
|
||||
},
|
||||
navTo(url) {
|
||||
if (url) {
|
||||
@ -143,6 +241,27 @@ import { Toast } from "../../libs/uniApi";
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
::v-deep .u-tabs__wrapper__nav__item__text{
|
||||
font-size: 28rpx !important;
|
||||
}
|
||||
.video-count {
|
||||
position: fixed;
|
||||
width: 600rpx;
|
||||
height: 500rpx;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
margin-left: -300rpx;
|
||||
margin-top: -250rpx;
|
||||
z-index: 100;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.videoLink {
|
||||
width: 600rpx;
|
||||
height: 500rpx;
|
||||
}
|
||||
}
|
||||
.card {
|
||||
margin: 0 auto;
|
||||
margin-bottom: 28rpx;
|
||||
|
Loading…
x
Reference in New Issue
Block a user