|
@@ -48,6 +48,7 @@
|
|
|
<view class="cm-video-list">
|
|
|
<video
|
|
|
class="cm-video"
|
|
|
+ ref="myVideo"
|
|
|
:id="'myVideo' + index"
|
|
|
:src="item.fileUrl"
|
|
|
:style="videoStyle['myVideo' + index]"
|
|
@@ -55,6 +56,7 @@
|
|
|
show-fullscreen-btn
|
|
|
show-mute-btn
|
|
|
play-btn-position="center"
|
|
|
+ @timeupdate="onPlayVideo($event)"
|
|
|
@play="handlePlayer('myVideo' + index)"
|
|
|
v-if="item.fileUrl"
|
|
|
@loadedmetadata="loadedmetadata"
|
|
@@ -165,6 +167,11 @@ export default {
|
|
|
videoStyle: {},
|
|
|
timer: null,
|
|
|
tipStatus: true, // 状态
|
|
|
+ userInfo: {}, // 用户信息
|
|
|
+ videoPermission: { // 视频播放权限
|
|
|
+ allTime: 10, // 分
|
|
|
+ onplay: 3 * 100 * 60 // 分钟
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -192,13 +199,14 @@ export default {
|
|
|
clearTimeout(this.timer)
|
|
|
}, 10000)
|
|
|
}
|
|
|
- console.log(val)
|
|
|
this.$emit('tipStatus', this.TipStatus)
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
this.userId = uni.getStorageSync('userInfo').userId || -1
|
|
|
this.getDetail()
|
|
|
+ this.userInfo = uni.getStorageSync('userInfo')
|
|
|
+ console.log(uni.getStorageSync('userInfo'))
|
|
|
},
|
|
|
methods: {
|
|
|
// 获取商品资料详情
|
|
@@ -207,6 +215,7 @@ export default {
|
|
|
userId: this.userId,
|
|
|
archiveId: this.archiveId
|
|
|
}).then(res => {
|
|
|
+ console.log(res, '数据是')
|
|
|
this.imageArchiveList = res.data.imageArchiveList
|
|
|
this.videoArchiveList = res.data.videoArchiveList
|
|
|
this.fileArchiveList = res.data.fileArchiveList
|
|
@@ -257,10 +266,11 @@ export default {
|
|
|
},
|
|
|
// 视频播放
|
|
|
handlePlayer(id) {
|
|
|
- if (this.checkPermission()) {
|
|
|
- this.handleStop(id)
|
|
|
- return
|
|
|
- }
|
|
|
+ // if (this.checkPermission()) {
|
|
|
+ // this.handleStop(id)
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ console.log('视频播放id', id)
|
|
|
// 如果点击同一个播放器,就
|
|
|
if (this.prevVideoId === id) return
|
|
|
// this.handleFullScreen(id) // 点击播放时全屏
|
|
@@ -269,6 +279,21 @@ export default {
|
|
|
// 保存当前播放器id
|
|
|
this.prevVideoId = id
|
|
|
},
|
|
|
+ // 监听video时长
|
|
|
+ onPlayVideo(e) {
|
|
|
+ console.log(e)
|
|
|
+ const allTime = Math.floor(e.detail.duration) / 100 / 60 // 获取分钟
|
|
|
+ if (this.permission === 2 || this.permission === 4 || this.permission === 1) {
|
|
|
+ if(allTime >= this.videoPermission.allTime && this.videoPermission.onplay > e.detail.currentTime) {
|
|
|
+ this.handleStop(e.target.id)
|
|
|
+ this.checkPermission()
|
|
|
+ }
|
|
|
+ if (allTime < this.videoPermission.allTime) {
|
|
|
+ this.handleStop(e.target.id)
|
|
|
+ this.checkPermission()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
// 开始播放
|
|
|
handelPlay(id) {
|
|
|
if (!id) return
|
|
@@ -295,17 +320,75 @@ export default {
|
|
|
},
|
|
|
// 预览图片
|
|
|
previewImage(index, previewImageList) {
|
|
|
- if (this.checkPermission()) return
|
|
|
- const that = this
|
|
|
- uni.previewImage({
|
|
|
- current: index,
|
|
|
- indicator: 'number',
|
|
|
- urls: previewImageList,
|
|
|
- loop: true,
|
|
|
- success() {
|
|
|
- that.$emit('previewImage', true)
|
|
|
+ // if (this.permission === 1) {
|
|
|
+ // if(previewImageList.length >= 5) {
|
|
|
+ // if (index < 3) {
|
|
|
+ // uni.previewImage({
|
|
|
+ // current: index,
|
|
|
+ // indicator: 'number',
|
|
|
+ // urls: previewImageList,
|
|
|
+ // loop: true,
|
|
|
+ // success() {
|
|
|
+ // that.$emit('previewImage', true)
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // }else {
|
|
|
+ // this.checkPermission()
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+ // this.checkPermission()
|
|
|
+ // }
|
|
|
+ // }else if (this.permission === 2) {
|
|
|
+ if (this.permission === 2 || this.permission === 4 || this.permission === 1) {
|
|
|
+ if(previewImageList.length >= 5) {
|
|
|
+ if(index < 3) {
|
|
|
+ uni.previewImage({
|
|
|
+ current: index,
|
|
|
+ indicator: 'number',
|
|
|
+ urls: previewImageList,
|
|
|
+ loop: true,
|
|
|
+ success() {
|
|
|
+ that.$emit('previewImage', true)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ if (this.checkPermission()) return
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ if (this.checkPermission()) return
|
|
|
}
|
|
|
- })
|
|
|
+ }
|
|
|
+ // } else if (this.permission === 3) {
|
|
|
+ // if(previewImageList.length >= 5) {
|
|
|
+ // if (index < 3) {
|
|
|
+ // uni.previewImage({
|
|
|
+ // current: index,
|
|
|
+ // indicator: 'number',
|
|
|
+ // urls: previewImageList,
|
|
|
+ // loop: true,
|
|
|
+ // success() {
|
|
|
+ // that.$emit('previewImage', true)
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // } else {
|
|
|
+ // if (this.checkPermission()) return
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+ // if (this.checkPermission()) return
|
|
|
+ // }
|
|
|
+ else {
|
|
|
+ if (this.checkPermission()) return
|
|
|
+ const that = this
|
|
|
+ uni.previewImage({
|
|
|
+ current: index,
|
|
|
+ indicator: 'number',
|
|
|
+ urls: previewImageList,
|
|
|
+ loop: true,
|
|
|
+ success() {
|
|
|
+ that.$emit('previewImage', true)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
//用户权限校验拦截
|
|
|
checkPermission() {
|
|
@@ -377,7 +460,7 @@ export default {
|
|
|
},
|
|
|
// 文件预览
|
|
|
previewFile(file) {
|
|
|
- if (this.checkPermission()) return
|
|
|
+ // if (this.checkPermission()) return
|
|
|
// 获取文件后缀
|
|
|
// const index = file.fileName.lastIndexOf('.')
|
|
|
// const suffix = file.fileName.substring(index)
|
|
@@ -414,11 +497,13 @@ export default {
|
|
|
success(res) {
|
|
|
const filePath = res.tempFilePath
|
|
|
console.log(filePath)
|
|
|
+ console.log(file, res, '文件数据')
|
|
|
// 打开文件
|
|
|
uni.openDocument({
|
|
|
filePath: filePath,
|
|
|
fileType: suffix,
|
|
|
success(res) {
|
|
|
+ console.log(res)
|
|
|
uni.showToast({
|
|
|
icon:'success',
|
|
|
title:'打开成功',
|