|
@@ -5,6 +5,8 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import { WEBVIEW_URL } from '@/common/request.js'
|
|
|
+import { mapGetters } from 'vuex'
|
|
|
export default {
|
|
|
components: {},
|
|
|
data() {
|
|
@@ -15,13 +17,64 @@ export default {
|
|
|
color: "#007AFF",
|
|
|
},
|
|
|
},
|
|
|
+ options: {},
|
|
|
+ optObj: {},
|
|
|
};
|
|
|
},
|
|
|
onLoad(option) {
|
|
|
- this.url = decodeURIComponent(option.url);
|
|
|
- console.log(this.url);
|
|
|
+ this.options = option
|
|
|
+ },
|
|
|
+ onShow() {
|
|
|
+ if (this.$method.isGoLogin()) { // 扫二维码进来的没登录需要跳到登录页,登录后返回
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.optObj = {}
|
|
|
+ let arrs = decodeURIComponent(this.options.scene).split('&')
|
|
|
+ for (let i = 0; i < arrs.length; i++) {
|
|
|
+ this.optObj[arrs[i].split('=')[0]] = arrs[i].split('=')[1]
|
|
|
+ }
|
|
|
+ console.log('this.optObj', this.optObj)
|
|
|
+ // 有a字段是标识是扫二维码进来的
|
|
|
+ if (this.optObj.a == 1) {
|
|
|
+ this.getParam()
|
|
|
+ } else {
|
|
|
+ this.url = decodeURIComponent(this.options.url);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapGetters(['userInfo']),
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 获取直播间跳转参数的接口
|
|
|
+ getParam() {
|
|
|
+ const { cid, gid, sid} = this.optObj
|
|
|
+ this.$http({
|
|
|
+ url: '/course/check/watch/per',
|
|
|
+ method: 'get',
|
|
|
+ data: {
|
|
|
+ courseId: cid, //课程ID
|
|
|
+ goodsId: gid, // 商品id
|
|
|
+ sectionId: sid, // 节id
|
|
|
+ },
|
|
|
+ }).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 || item.menuId
|
|
|
+ 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)
|
|
|
+ } else {
|
|
|
+ this.$u.toast(res.data.msg)
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ },
|
|
|
},
|
|
|
- methods: {},
|
|
|
};
|
|
|
</script>
|
|
|
|