|
@@ -18,7 +18,7 @@
|
|
|
:src="image.url"
|
|
|
@click="previewImage(i, item.imageList)"
|
|
|
mode="aspectFill"
|
|
|
- v-for="(image, i) in imageFormat(item.imageList)"
|
|
|
+ v-for="(image, i) in imageFormat(item.imageList, index)"
|
|
|
:key="i"
|
|
|
:style="image.style"
|
|
|
></image>
|
|
@@ -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"
|
|
@@ -98,7 +100,7 @@
|
|
|
class="cm-login"
|
|
|
:class="{ maxBottom: !bottom && isIphoneX }"
|
|
|
:style="{ bottom: bottom }"
|
|
|
- v-if="TipStatus"
|
|
|
+ v-if="TipStatus && tipStatus"
|
|
|
>
|
|
|
<text>{{ TipStatus.text }}</text>
|
|
|
<view class="cm-btn" @click="nextAction(TipStatus.redirect)">{{ TipStatus.btn }}</view>
|
|
@@ -109,7 +111,7 @@
|
|
|
:content="TipStatus.text"
|
|
|
shape="circle"
|
|
|
:button="modalButton"
|
|
|
- fadeIn
|
|
|
+ :fadeIn="true"
|
|
|
@click="handleModalClick"
|
|
|
></tui-modal>
|
|
|
</view>
|
|
@@ -156,13 +158,17 @@ export default {
|
|
|
],
|
|
|
showModal: false,
|
|
|
//用户信息相关
|
|
|
- permission: 5, //用户权限 0可查看,1未登录,2需升级资质机构,3需升级医美资质机构,4需要抵扣采美豆,5无权限查看
|
|
|
+ permission: 5, //用户权限 0可查看,1未登录,2需升级会员机构,3需升级医美会员机构,4需要抵扣采美豆,5无权限查看
|
|
|
imageArchiveList: [], // 图片资料列表
|
|
|
videoArchiveList: [], // 视频资料列表
|
|
|
fileArchiveList: [], // 文件资料列表
|
|
|
defaultImage: 'https://static.caimei365.com/app/img/icon2/PC-default.png', // 默认图片
|
|
|
videoCover: 'https://static.caimei365.com/app/img/icon2/video-cover.png', //默认视频封面
|
|
|
- videoStyle: {}
|
|
|
+ videoStyle: {},
|
|
|
+ timer: null,
|
|
|
+ tipStatus: true, // 状态
|
|
|
+ userInfo: {}, // 用户信息
|
|
|
+ num: 0,
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -173,23 +179,31 @@ export default {
|
|
|
const statusText = [
|
|
|
false, // 正常访问
|
|
|
{ text: '请登录后查看!', btn: '去登录', redirect: '/pages/login/login' },
|
|
|
- { text: '请升级成为资质机构后方可查看!', btn: '去升级', redirect: '/pages/login/apply' },
|
|
|
- { text: '请升级成为医美资质机构后方可查看!', btn: '去升级', redirect: '/pages/login/apply' },
|
|
|
+ { text: '请升级成为会员机构后方可查看!', btn: '去升级', redirect: '/pages/login/apply' },
|
|
|
+ { text: '请升级成为医美会员机构后方可查看!', btn: '去升级', redirect: '/pages/login/apply' },
|
|
|
{ text: '需抵扣100采美豆方可查看!', btn: '去查看', redirect: 10 },
|
|
|
{ text: '无权限查看!', btn: '确认' }
|
|
|
]
|
|
|
- // 0可查看,1未登录,2需升级资质机构,3需升级医美资质机构,4需要抵扣采美豆,5无权限查看
|
|
|
+ // 0可查看,1未登录,2需升级会员机构,3需升级医美会员机构,4需要抵扣采美豆,5无权限查看
|
|
|
return statusText[this.permission]
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
TipStatus(val) {
|
|
|
+ if(this.TipStatus) {
|
|
|
+ this.timer = setTimeout(()=>{
|
|
|
+ this.tipStatus = false
|
|
|
+ clearTimeout(this.timer)
|
|
|
+ }, 10000)
|
|
|
+ }
|
|
|
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: {
|
|
|
// 获取商品资料详情
|
|
@@ -202,6 +216,18 @@ export default {
|
|
|
this.videoArchiveList = res.data.videoArchiveList
|
|
|
this.fileArchiveList = res.data.fileArchiveList
|
|
|
this.permission = res.data.permission
|
|
|
+ this.imageArchiveList.forEach((item, index) => {
|
|
|
+ if (item.imageNum !== item.imageList.length) {
|
|
|
+ this.num = item.imageNum - item.imageList.length
|
|
|
+ for (let i = 0; i < this.num; i++) {
|
|
|
+ item.imageList.push(this.defaultImage)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.videoArchiveList.forEach(item => {
|
|
|
+ item.fileUrl = decodeURIComponent(item.fileUrl)
|
|
|
+ })
|
|
|
+ // console.log(res.data.videoArchiveList)
|
|
|
})
|
|
|
},
|
|
|
//采美豆抵扣
|
|
@@ -248,10 +274,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) // 点击播放时全屏
|
|
@@ -260,6 +287,22 @@ export default {
|
|
|
// 保存当前播放器id
|
|
|
this.prevVideoId = id
|
|
|
},
|
|
|
+ // 监听video时长
|
|
|
+ onPlayVideo(e) {
|
|
|
+ console.log(e)
|
|
|
+ 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)) {
|
|
|
+ this.handleStop(e.target.id)
|
|
|
+ this.checkPermission()
|
|
|
+ }
|
|
|
+ if (allTime < 10) {
|
|
|
+ this.handleStop(e.target.id)
|
|
|
+ this.checkPermission()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
// 开始播放
|
|
|
handelPlay(id) {
|
|
|
if (!id) return
|
|
@@ -286,21 +329,79 @@ 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 < 2) {
|
|
|
+ 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() {
|
|
|
- //permission:查看权限:0可查看,1未登录,2需升级资质机构,3需升级医美资质机构,4需要抵扣采美豆,5无权限查看
|
|
|
+ //permission:查看权限:0可查看,1未登录,2需升级会员机构,3需升级医美会员机构,4需要抵扣采美豆,5无权限查看
|
|
|
const _self = this
|
|
|
// 如果 TipStatus 返回false 就放行
|
|
|
if (!_self.TipStatus) return 0
|
|
@@ -319,7 +420,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
//图片列表处理
|
|
|
- imageFormat(list) {
|
|
|
+ imageFormat(list, index) {
|
|
|
const imageList = []
|
|
|
if (list.length > 2) {
|
|
|
list.forEach((item, index) => {
|
|
@@ -368,7 +469,7 @@ export default {
|
|
|
},
|
|
|
// 文件预览
|
|
|
previewFile(file) {
|
|
|
- if (this.checkPermission()) return
|
|
|
+ // if (this.checkPermission()) return
|
|
|
// 获取文件后缀
|
|
|
// const index = file.fileName.lastIndexOf('.')
|
|
|
// const suffix = file.fileName.substring(index)
|
|
@@ -405,11 +506,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:'打开成功',
|
|
@@ -465,7 +568,10 @@ export default {
|
|
|
box-sizing: border-box;
|
|
|
z-index: 9;
|
|
|
&.maxBottom {
|
|
|
- bottom: 175rpx;
|
|
|
+ bottom: -100rpx;
|
|
|
+ z-index: 999;
|
|
|
+ animation: permiMove .3s ease-in-out;
|
|
|
+ animation-fill-mode: forwards;
|
|
|
}
|
|
|
text {
|
|
|
font-size: 26rpx;
|
|
@@ -626,4 +732,13 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+@keyframes permiMove {
|
|
|
+ 0% {
|
|
|
+ bottom: -100rpx;
|
|
|
+ }
|
|
|
+ 100% {
|
|
|
+ bottom: 180rpx;
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|