|
@@ -1,6 +1,15 @@
|
|
|
<template>
|
|
|
<view class="webview">
|
|
|
- <web-view :webview-styles="webviewStyles" :src="url"></web-view>
|
|
|
+ <template v-if="url">
|
|
|
+ <web-view :webview-styles="webviewStyles" :src="url"></web-view>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <u-popup v-model="showAuth" mode="center" border-radius="50">
|
|
|
+ <view class="popCentent">
|
|
|
+ <view class="tips">您还没有开通直播课程,无法观看</view>
|
|
|
+ <view class="btns" @click="toAuth()">立即开通</view>
|
|
|
+ </view>
|
|
|
+ </u-popup>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
@@ -25,8 +34,29 @@ export default {
|
|
|
courseId: 0,
|
|
|
sectionId: 0,
|
|
|
orderGoodsId: 0,
|
|
|
+ paramObj: {},
|
|
|
+ showAuth: true,
|
|
|
+ checkStatus: 0, // 0没有权限,1有权限
|
|
|
+ checkMsg: '',
|
|
|
+ goodsStatus: 0, // 0未上架,1上架
|
|
|
+
|
|
|
};
|
|
|
},
|
|
|
+ onShareAppMessage() {
|
|
|
+ let item = this.paramObj
|
|
|
+ let moduleId = item.moduleId || 0
|
|
|
+ let chapterId = item.chapterId || 0
|
|
|
+ let sectionId = item.sectionId
|
|
|
+ let uuid = new Date().valueOf() + ""
|
|
|
+ // buyCourse 是否购买课程:1是 0否
|
|
|
+ let encode = encodeURIComponent(WEBVIEW_URL+'pages/live/index?token='+uni.getStorageSync('token')+'&userInfo='+JSON.stringify(this.userInfo)+'&channelId='
|
|
|
+ +item.liveUrl+'&gradeId='+0+'&courseId='+item.courseId+'&goodsId='+item.goodsId+'&orderGoodsId='+item.orderGoodsId+'§ionId='+sectionId+'&chapterId='
|
|
|
+ +chapterId+'&moduleId='+moduleId+'&buyCourse='+item.buyCourse+'&ident='+uuid)
|
|
|
+ return {
|
|
|
+ title: '直播',
|
|
|
+ path: `/pages/webview/index?url=` + encode
|
|
|
+ };
|
|
|
+ },
|
|
|
onLoad(option) {
|
|
|
console.log('--option-', option)
|
|
|
this.options = option
|
|
@@ -45,14 +75,15 @@ export default {
|
|
|
if (this.optObj.a == 1) {
|
|
|
this.getParam()
|
|
|
} else {
|
|
|
- this.url = decodeURIComponent(this.options.url);
|
|
|
+ this.url = decodeURIComponent(decodeURIComponent(this.options.url))
|
|
|
console.log('小程序进来的url:', this.url)
|
|
|
- let index = this.options.url.indexOf('?')
|
|
|
- let paramArr = this.options.url.slice(index + 1).split('&')
|
|
|
+ let index = this.url.indexOf('?')
|
|
|
+ let paramArr = this.url.slice(index + 1).split('&')
|
|
|
let paramObj = {}
|
|
|
for (let i = 0; i < paramArr.length; i++) {
|
|
|
paramObj[paramArr[i].split('=')[0]] = paramArr[i].split('=')[1]
|
|
|
}
|
|
|
+ this.paramObj = paramObj
|
|
|
console.log('paramObj', paramObj)
|
|
|
this.studyLog(paramObj)
|
|
|
}
|
|
@@ -75,19 +106,29 @@ export default {
|
|
|
}).then((res) => {
|
|
|
if (res.data.code == 200) {
|
|
|
let item = res.data.data
|
|
|
- let moduleId = item.moduleId || 0
|
|
|
- let chapterId = item.chapterId || 0
|
|
|
- let sectionId = item.sectionId
|
|
|
- let uuid = new Date().valueOf() + ""
|
|
|
- // buyCourse 是否购买课程:1是 0否
|
|
|
- this.url = WEBVIEW_URL+'pages/live/index?token='+uni.getStorageSync('token')+'&userInfo='+JSON.stringify(this.userInfo)+'&channelId='
|
|
|
- +item.channelId+'&gradeId='+0+'&courseId='+item.courseId+'&goodsId='+item.goodsId+'&orderGoodsId='+item.orderGoodsId+'§ionId='+sectionId
|
|
|
- +'&chapterId='+chapterId+'&moduleId='+moduleId+'&buyCourse='+item.buyCourse+'&ident='+uuid
|
|
|
- console.log('url:', this.url)
|
|
|
-
|
|
|
- this.studyLog(item)
|
|
|
+ this.paramObj = item
|
|
|
+ this.goodsId = item.goodsId
|
|
|
+ this.goodsStatus = item.goodsStatus
|
|
|
+ if (item.checkStatus == 1) { // 有权限
|
|
|
+ let moduleId = item.moduleId || 0
|
|
|
+ let chapterId = item.chapterId || 0
|
|
|
+ let sectionId = item.sectionId
|
|
|
+
|
|
|
+ let uuid = new Date().valueOf() + ""
|
|
|
+ // buyCourse 是否购买课程:1是 0否
|
|
|
+ this.url = WEBVIEW_URL+'pages/live/index?token='+uni.getStorageSync('token')+'&userInfo='+JSON.stringify(this.userInfo)+'&channelId='
|
|
|
+ +item.channelId+'&gradeId='+0+'&courseId='+item.courseId+'&goodsId='+item.goodsId+'&orderGoodsId='+item.orderGoodsId+'§ionId='+sectionId
|
|
|
+ +'&chapterId='+chapterId+'&moduleId='+moduleId+'&buyCourse='+item.buyCourse+'&ident='+uuid
|
|
|
+ console.log('url:', this.url)
|
|
|
+ this.studyLog(item)
|
|
|
+ } else {
|
|
|
+ this.url = ''
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
} else {
|
|
|
this.$u.toast(res.data.msg)
|
|
|
+
|
|
|
}
|
|
|
})
|
|
|
|
|
@@ -111,9 +152,40 @@ export default {
|
|
|
console.log('直播的用户学习日志:', res)
|
|
|
})
|
|
|
},
|
|
|
+ toAuth() {
|
|
|
+ if (this.goodsStatus == 1) { //已上架
|
|
|
+ uni.navigateTo({
|
|
|
+ url:'/pages3/course/detail?id='+this.goodsId
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ uni.switchTab({
|
|
|
+ url:'/pages/index/index'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
+.popCentent {
|
|
|
+ width: 600rpx;
|
|
|
+ height: 300rpx;
|
|
|
+ padding: 24rpx;
|
|
|
+ text-align: center;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ .btns {
|
|
|
+ width: 500rpx;
|
|
|
+ height: 80rpx;
|
|
|
+ line-height: 80rpx;
|
|
|
+ text-align: center;
|
|
|
+ background-color: #3577E8;
|
|
|
+ color: #fff;
|
|
|
+ font-size: 24rpx;
|
|
|
+ border-radius: 20rpx;
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|