|
@@ -3,7 +3,7 @@
|
|
|
<template v-if="url">
|
|
|
<web-view :webview-styles="webviewStyles" :src="url"></web-view>
|
|
|
</template>
|
|
|
-
|
|
|
+
|
|
|
<u-popup v-model="showAuth" mode="center" border-radius="30">
|
|
|
<view class="popCentent">
|
|
|
<view class="tips">您还没有开通直播课程,无法观看</view>
|
|
@@ -14,8 +14,8 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { mapGetters } from 'vuex'
|
|
|
-import config from '@/common/config'
|
|
|
+import { mapGetters } from "vuex";
|
|
|
+import config from "@/common/config";
|
|
|
export default {
|
|
|
components: {},
|
|
|
data() {
|
|
@@ -39,137 +39,165 @@ export default {
|
|
|
checkStatus: 0, // 0没有权限,1有权限
|
|
|
goodsStatus: 0, // 0未上架,1上架
|
|
|
sectionType: 2, // 2直播
|
|
|
- vid: '', // 回放id
|
|
|
+ vid: "", // 回放id
|
|
|
};
|
|
|
},
|
|
|
onLoad(option) {
|
|
|
- console.log('--option-', option)
|
|
|
- this.options = option
|
|
|
+ console.log("--option-", option);
|
|
|
+ this.options = option;
|
|
|
},
|
|
|
onShow() {
|
|
|
- if (this.$method.isGoLogin()) { // 扫二维码进来的没登录需要跳到登录页,登录后返回
|
|
|
+ if (this.$method.isGoLogin()) {
|
|
|
+ // 扫二维码进来的没登录需要跳到登录页,登录后返回
|
|
|
return;
|
|
|
}
|
|
|
if (this.options.scene) {
|
|
|
- this.optObj = {}
|
|
|
- let arrs = decodeURIComponent(this.options.scene).split('&')
|
|
|
+ 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]
|
|
|
+ this.optObj[arrs[i].split("=")[0]] = arrs[i].split("=")[1];
|
|
|
}
|
|
|
- console.log('this.optObj', this.optObj)
|
|
|
+ console.log("this.optObj", this.optObj);
|
|
|
}
|
|
|
// 有a字段是标识是扫二维码进来的
|
|
|
if (this.optObj.a == 1) {
|
|
|
if (!this.userInfo) {
|
|
|
- this.getInfo()
|
|
|
+ this.getInfo();
|
|
|
} else {
|
|
|
- this.getParam()
|
|
|
+ this.getParam();
|
|
|
}
|
|
|
-
|
|
|
} else {
|
|
|
- this.url = decodeURIComponent(decodeURIComponent(this.options.url))
|
|
|
- console.log('小程序进来的url:', this.url)
|
|
|
- let index = this.url.indexOf('?')
|
|
|
- let paramArr = this.url.slice(index + 1).split('&')
|
|
|
- let paramObj = {}
|
|
|
+ this.url = decodeURIComponent(decodeURIComponent(this.options.url));
|
|
|
+ console.log("小程序进来的url:", this.url);
|
|
|
+ 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]
|
|
|
+ paramObj[paramArr[i].split("=")[0]] = paramArr[i].split("=")[1];
|
|
|
}
|
|
|
- this.paramObj = paramObj
|
|
|
- this.sectionType = this.paramObj.sectionType || 2 // 默认直播,回放的加了sectionType=3
|
|
|
- this.vid = this.paramObj.vid || ''
|
|
|
- // console.log('paramObj', paramObj)
|
|
|
- this.studyLog(paramObj)
|
|
|
+ this.paramObj = paramObj;
|
|
|
+ this.sectionType = this.paramObj.sectionType || 2; // 默认直播,回放的加了sectionType=3
|
|
|
+ this.vid = this.paramObj.vid || "";
|
|
|
+ this.url = this.url + "&tid=" + config.tenantId;
|
|
|
+ this.studyLog(paramObj);
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
- ...mapGetters(['userInfo']),
|
|
|
- },
|
|
|
+ ...mapGetters(["userInfo"]),
|
|
|
+ },
|
|
|
methods: {
|
|
|
getInfo() {
|
|
|
- // /app/user/getInfo 登录用户信息 // fromPlat来源平台 1小程序 2PC网站
|
|
|
- this.$api.getInfo({ fromPlat: 1 }).then(res => {
|
|
|
- if(res.data.code == 200){
|
|
|
- this.$store.state.userInfo = res.data.data
|
|
|
+ // /app/user/getInfo 登录用户信息 // fromPlat来源平台 1小程序 2PC网站
|
|
|
+ this.$api.getInfo({ fromPlat: 1 }).then((res) => {
|
|
|
+ if (res.data.code == 200) {
|
|
|
+ this.$store.state.userInfo = res.data.data;
|
|
|
// console.log('this.userInfo', this.userInfo)
|
|
|
- this.getParam()
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
+ this.getParam();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
// 获取直播间跳转参数的接口
|
|
|
getParam() {
|
|
|
- const { cid, gid, sid} = this.optObj
|
|
|
+ const { cid, gid, sid } = this.optObj;
|
|
|
this.$http({
|
|
|
- url: '/course/check/watch/per',
|
|
|
- method: 'get',
|
|
|
+ url: "/course/check/watch/per",
|
|
|
+ method: "get",
|
|
|
data: {
|
|
|
- courseId: cid, //课程ID
|
|
|
+ courseId: cid, //课程ID
|
|
|
goodsId: gid, // 商品id
|
|
|
sectionId: sid, // 节id
|
|
|
},
|
|
|
}).then((res) => {
|
|
|
if (res.data.code == 200) {
|
|
|
- let item = res.data.data
|
|
|
- this.paramObj = item
|
|
|
- this.goodsId = item.goodsId
|
|
|
- this.goodsStatus = item.goodsStatus
|
|
|
- this.sectionType = item.sectionType
|
|
|
- this.vid = item.recordingUrl || ''
|
|
|
- if (item.checkStatus == 1) { // 有权限
|
|
|
- let moduleId = item.moduleId || 0
|
|
|
- let chapterId = item.chapterId || 0
|
|
|
- let sectionId = item.sectionId
|
|
|
-
|
|
|
- let uuid = new Date().valueOf() + ""
|
|
|
+ let item = res.data.data;
|
|
|
+ this.paramObj = item;
|
|
|
+ this.goodsId = item.goodsId;
|
|
|
+ this.goodsStatus = item.goodsStatus;
|
|
|
+ this.sectionType = item.sectionType;
|
|
|
+ this.vid = item.recordingUrl || "";
|
|
|
+ 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 = config.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+'§ionType='+ this.sectionType+'&vid='+this.vid
|
|
|
- console.log('url:', this.url)
|
|
|
- this.studyLog(item)
|
|
|
+ this.url =
|
|
|
+ config.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 +
|
|
|
+ "§ionType=" +
|
|
|
+ this.sectionType +
|
|
|
+ "&vid=" +
|
|
|
+ this.vid +
|
|
|
+ "&tid=" +
|
|
|
+ config.tenantId;
|
|
|
+ this.studyLog(item);
|
|
|
} else {
|
|
|
// 没有权限
|
|
|
- this.url = ''
|
|
|
- this.showAuth = true
|
|
|
+ this.url = "";
|
|
|
+ this.showAuth = true;
|
|
|
}
|
|
|
-
|
|
|
} else {
|
|
|
- this.$u.toast(res.data.msg)
|
|
|
+ this.$u.toast(res.data.msg);
|
|
|
uni.switchTab({
|
|
|
- url:'/pages/index/index'
|
|
|
- })
|
|
|
+ url: "/pages/index/index",
|
|
|
+ });
|
|
|
}
|
|
|
- })
|
|
|
-
|
|
|
+ });
|
|
|
},
|
|
|
// 新增用户视频学习日志
|
|
|
studyLog(item) {
|
|
|
this.$http({
|
|
|
- url: '/user/study/log',
|
|
|
- method: 'post',
|
|
|
+ url: "/user/study/log",
|
|
|
+ method: "post",
|
|
|
data: {
|
|
|
goodsId: item.goodsId,
|
|
|
courseId: item.courseId,
|
|
|
- moduleId: item.moduleId || 0,
|
|
|
- chapterId: item.chapterId || 0,
|
|
|
+ moduleId: item.moduleId || 0,
|
|
|
+ chapterId: item.chapterId || 0,
|
|
|
sectionId: item.sectionId || 0,
|
|
|
fromPlat: 1, //来源平台 1小程序 2PC网站
|
|
|
goodsType: 6, // 商品类型 1视频2题库 3补考 4前培 5虚拟赠送题库 6直播
|
|
|
orderGoodsId: item.orderGoodsId,
|
|
|
- }
|
|
|
+ },
|
|
|
}).then((res) => {
|
|
|
- console.log('直播的用户学习日志:', res)
|
|
|
- })
|
|
|
+ console.log("直播的用户学习日志:", res);
|
|
|
+ });
|
|
|
},
|
|
|
toAuth() {
|
|
|
- if (this.goodsStatus == 1) { //已上架
|
|
|
+ if (this.goodsStatus == 1) {
|
|
|
+ //已上架
|
|
|
uni.navigateTo({
|
|
|
- url:'/pages3/course/detail?id='+this.goodsId + '&goodsType=6'
|
|
|
- })
|
|
|
+ url: "/pages3/course/detail?id=" + this.goodsId + "&goodsType=6",
|
|
|
+ });
|
|
|
} else {
|
|
|
uni.switchTab({
|
|
|
- url:'/pages/index/index'
|
|
|
- })
|
|
|
+ url: "/pages/index/index",
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
},
|
|
@@ -191,7 +219,7 @@ export default {
|
|
|
height: 80rpx;
|
|
|
line-height: 80rpx;
|
|
|
text-align: center;
|
|
|
- background-color: #3577E8;
|
|
|
+ background-color: #3577e8;
|
|
|
color: #fff;
|
|
|
font-size: 24rpx;
|
|
|
border-radius: 20rpx;
|