|
@@ -16,7 +16,7 @@
|
|
|
<template v-if="item.imageList">
|
|
|
<image
|
|
|
:src="image.url"
|
|
|
- @click="previewImage(i, item.imageList)"
|
|
|
+ @click="previewImage(i, item.imageList, item)"
|
|
|
mode="aspectFill"
|
|
|
v-for="(image, i) in imageFormat(item.imageList, index)"
|
|
|
:key="i"
|
|
@@ -57,7 +57,7 @@
|
|
|
show-mute-btn
|
|
|
play-btn-position="center"
|
|
|
@timeupdate="onPlayVideo($event)"
|
|
|
- @play="handlePlayer('myVideo' + index)"
|
|
|
+ @play="handlePlayer('myVideo' + index, item)"
|
|
|
v-if="item.fileUrl"
|
|
|
@loadedmetadata="loadedmetadata"
|
|
|
></video>
|
|
@@ -119,7 +119,6 @@
|
|
|
|
|
|
<script>
|
|
|
import { mapState } from 'vuex'
|
|
|
-
|
|
|
export default {
|
|
|
props: {
|
|
|
product: {
|
|
@@ -168,7 +167,7 @@ export default {
|
|
|
timer: null,
|
|
|
tipStatus: true, // 状态
|
|
|
userInfo: {}, // 用户信息
|
|
|
- num: 0,
|
|
|
+ num: 0
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -190,8 +189,8 @@ export default {
|
|
|
},
|
|
|
watch: {
|
|
|
TipStatus(val) {
|
|
|
- if(this.TipStatus) {
|
|
|
- this.timer = setTimeout(()=>{
|
|
|
+ if (this.TipStatus) {
|
|
|
+ this.timer = setTimeout(() => {
|
|
|
this.tipStatus = false
|
|
|
clearTimeout(this.timer)
|
|
|
}, 10000)
|
|
@@ -273,12 +272,15 @@ export default {
|
|
|
this.$set(this.videoStyle, e.currentTarget.id, `width:${rw}rpx;height:${rh}rpx;`)
|
|
|
},
|
|
|
// 视频播放
|
|
|
- handlePlayer(id) {
|
|
|
+ handlePlayer(id, info) {
|
|
|
// if (this.checkPermission()) {
|
|
|
// this.handleStop(id)
|
|
|
// return
|
|
|
// }
|
|
|
console.log('视频播放id', id)
|
|
|
+ if (info) {
|
|
|
+ this.GetStatisticsAddPv(1, info.archiveContentId)
|
|
|
+ }
|
|
|
// 如果点击同一个播放器,就
|
|
|
if (this.prevVideoId === id) return
|
|
|
// this.handleFullScreen(id) // 点击播放时全屏
|
|
@@ -290,10 +292,10 @@ export default {
|
|
|
// 监听video时长
|
|
|
onPlayVideo(e) {
|
|
|
console.log(e)
|
|
|
- const allTime = parseInt(((e.detail.duration)% 3600) / 60) // 获取分钟
|
|
|
- const inPlay = parseInt(((e.detail.duration)% 3600) / 60)
|
|
|
+ const allTime = parseInt((e.detail.duration % 3600) / 60) // 获取分钟
|
|
|
+ const inPlay = parseInt((e.detail.duration % 3600) / 60)
|
|
|
if (this.permission === 2 || this.permission === 4 || this.permission === 1) {
|
|
|
- if(allTime >= 10 && (3 < inPlay)) {
|
|
|
+ if (allTime >= 10 && 3 < inPlay) {
|
|
|
this.handleStop(e.target.id)
|
|
|
this.checkPermission()
|
|
|
}
|
|
@@ -327,30 +329,23 @@ export default {
|
|
|
const vContext = uni.createVideoContext(id, this)
|
|
|
vContext.requestFullScreen()
|
|
|
},
|
|
|
+ // 浏览记录
|
|
|
+ async GetStatisticsAddPv(type, authorId) {
|
|
|
+ try {
|
|
|
+ await this.BeautyArchive.GetStatisticsAddPv({ type, authorId })
|
|
|
+ console.log('记录成功')
|
|
|
+ } catch (e) {
|
|
|
+ //TODO handle the exception
|
|
|
+ }
|
|
|
+ },
|
|
|
// 预览图片
|
|
|
- previewImage(index, previewImageList) {
|
|
|
- // 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) {
|
|
|
+ previewImage(index, previewImageList, info) {
|
|
|
+ if (info) {
|
|
|
+ this.GetStatisticsAddPv(1, info.archiveContentId)
|
|
|
+ }
|
|
|
if (this.permission === 2 || this.permission === 4 || this.permission === 1) {
|
|
|
- if(previewImageList.length >= 5) {
|
|
|
- if(index < 2) {
|
|
|
+ if (previewImageList.length >= 5) {
|
|
|
+ if (index < 2) {
|
|
|
uni.previewImage({
|
|
|
current: index,
|
|
|
indicator: 'number',
|
|
@@ -363,40 +358,21 @@ export default {
|
|
|
} else {
|
|
|
if (this.checkPermission()) return
|
|
|
}
|
|
|
- }else {
|
|
|
+ } 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)
|
|
|
- }
|
|
|
- })
|
|
|
+ } else {
|
|
|
+ if (this.checkPermission()) return
|
|
|
+ const that = this
|
|
|
+ uni.previewImage({
|
|
|
+ current: index,
|
|
|
+ indicator: 'number',
|
|
|
+ urls: previewImageList,
|
|
|
+ loop: true,
|
|
|
+ success() {
|
|
|
+ that.$emit('previewImage', true)
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
//用户权限校验拦截
|
|
@@ -470,9 +446,16 @@ export default {
|
|
|
// 文件预览
|
|
|
previewFile(file) {
|
|
|
// if (this.checkPermission()) return
|
|
|
- // 获取文件后缀
|
|
|
+ // // 获取文件后缀
|
|
|
// const index = file.fileName.lastIndexOf('.')
|
|
|
// const suffix = file.fileName.substring(index)
|
|
|
+ if (uni.getStorageSync('fileInfo')) {
|
|
|
+ uni.removeStorageSync('fileInfo')
|
|
|
+ }
|
|
|
+ if (file) {
|
|
|
+ this.GetStatisticsAddPv(1, file.archiveContentId)
|
|
|
+ }
|
|
|
+ uni.setStorageSync('fileInfo', file.content || '文章预览')
|
|
|
this.openDocument(file)
|
|
|
// if (suffix === '.doc' || suffix === '.ppt' || suffix === '.pptx' || suffix === '.docx') {
|
|
|
// //先将链接缓存
|
|
@@ -495,8 +478,16 @@ export default {
|
|
|
// 打开文档
|
|
|
openDocument(file) {
|
|
|
uni.showLoading({
|
|
|
- title:'加载中'
|
|
|
+ title: '加载中'
|
|
|
})
|
|
|
+ if (this.permission !== 0) {
|
|
|
+ this.$api.navigateTo(
|
|
|
+ `/pages/goods/goods-file-preview?userId=${this.userId}&archiveId=${this.archiveId}&permission=${
|
|
|
+ this.permission
|
|
|
+ }&fileName=${file.fileName}`
|
|
|
+ )
|
|
|
+ return
|
|
|
+ }
|
|
|
// 获取文件后缀
|
|
|
const index = file.fileName.lastIndexOf('.')
|
|
|
const suffix = file.fileName.substring(index + 1)
|
|
@@ -505,23 +496,24 @@ export default {
|
|
|
url: file.fileUrl,
|
|
|
success(res) {
|
|
|
const filePath = res.tempFilePath
|
|
|
- console.log(filePath)
|
|
|
+ console.log(filePath)
|
|
|
console.log(file, res, '文件数据')
|
|
|
// 打开文件
|
|
|
uni.openDocument({
|
|
|
filePath: filePath,
|
|
|
fileType: suffix,
|
|
|
+ showMenu: true,
|
|
|
success(res) {
|
|
|
console.log(res)
|
|
|
uni.showToast({
|
|
|
- icon:'success',
|
|
|
- title:'打开成功',
|
|
|
+ icon: 'success',
|
|
|
+ title: '打开成功',
|
|
|
duration: 1200
|
|
|
})
|
|
|
uni.hideLoading()
|
|
|
},
|
|
|
fail(err) {
|
|
|
- if(err.errMsg.indexOf('fail filetype not supported')){
|
|
|
+ if (err.errMsg.indexOf('fail filetype not supported')) {
|
|
|
uni.showModal({
|
|
|
content: '不支持的文件预览',
|
|
|
cancelColor: '#666',
|
|
@@ -532,14 +524,14 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- fail(err){
|
|
|
+ fail(err) {
|
|
|
uni.showToast({
|
|
|
title: JSON.stringify(err),
|
|
|
- icon:'none',
|
|
|
+ icon: 'none',
|
|
|
duration: 5000
|
|
|
})
|
|
|
uni.hideLoading()
|
|
|
- },
|
|
|
+ }
|
|
|
})
|
|
|
}
|
|
|
}
|
|
@@ -570,17 +562,17 @@ export default {
|
|
|
&.maxBottom {
|
|
|
bottom: -100rpx;
|
|
|
z-index: 999;
|
|
|
- animation: permiMove .3s ease-in-out;
|
|
|
+ animation: permiMove 0.3s ease-in-out;
|
|
|
animation-fill-mode: forwards;
|
|
|
}
|
|
|
text {
|
|
|
font-size: 26rpx;
|
|
|
- color: #FF5B00;
|
|
|
+ color: #ff5b00;
|
|
|
}
|
|
|
.cm-btn {
|
|
|
width: 136rpx;
|
|
|
height: 48rpx;
|
|
|
- background: #FF5B00;
|
|
|
+ background: #ff5b00;
|
|
|
border-radius: 28px;
|
|
|
font-size: 26rpx;
|
|
|
text-align: center;
|
|
@@ -652,7 +644,7 @@ export default {
|
|
|
.cm-preview {
|
|
|
font-size: 26rpx;
|
|
|
font-weight: 400;
|
|
|
- color: #FF5B00;
|
|
|
+ color: #ff5b00;
|
|
|
}
|
|
|
.cm-time {
|
|
|
padding: 0;
|