|
@@ -6,11 +6,7 @@
|
|
|
<div class="clearfix top-line">
|
|
|
<div class="title">{{ goodsName }}</div>
|
|
|
<div class="bottoms">
|
|
|
- <el-button
|
|
|
- size="small"
|
|
|
- round
|
|
|
- @click="toShare()"
|
|
|
- >分享</el-button>
|
|
|
+ <el-button size="small" round @click="toShare()">分享</el-button>
|
|
|
<el-button
|
|
|
class="float-right"
|
|
|
type="primary"
|
|
@@ -20,7 +16,6 @@
|
|
|
>返回</el-button
|
|
|
>
|
|
|
</div>
|
|
|
-
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- pc端 -->
|
|
@@ -138,7 +133,7 @@
|
|
|
:close-on-press-escape="false"
|
|
|
:show-close="false"
|
|
|
width="400px"
|
|
|
- >
|
|
|
+ >
|
|
|
<div class="popCentent">
|
|
|
<div class="tips">您还没有开通直播课程,无法观看</div>
|
|
|
<div class="btns" @click="toAuth()">立即开通</div>
|
|
@@ -146,11 +141,7 @@
|
|
|
</el-dialog>
|
|
|
|
|
|
<!-- 分享弹窗 -->
|
|
|
- <el-dialog
|
|
|
- title="提示"
|
|
|
- :visible.sync="shareShow"
|
|
|
- width="600px"
|
|
|
- >
|
|
|
+ <el-dialog title="提示" :visible.sync="shareShow" width="600px">
|
|
|
<div v-loading="shareLoading" class="popShare">
|
|
|
<el-form ref="form" :model="formShare" label-width="130px">
|
|
|
<el-form-item label="观看链接(pc端):">
|
|
@@ -179,13 +170,13 @@ import "@/assets/css/chatroom.css";
|
|
|
import "@/assets/css/pc.css";
|
|
|
import "@/assets/css/tool.css";
|
|
|
import "@/assets/css/public.css";
|
|
|
-let Base64 = require('js-base64').Base64
|
|
|
+let Base64 = require("js-base64").Base64;
|
|
|
|
|
|
export default {
|
|
|
components: {
|
|
|
Footer,
|
|
|
Header,
|
|
|
- ToolBar,
|
|
|
+ ToolBar
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
@@ -207,7 +198,7 @@ export default {
|
|
|
liveSdk: null, // 保存直播 JS-SDK 实例
|
|
|
socket: null, // 保存 WebSocket 实例
|
|
|
scene: "", // 场景
|
|
|
- mainPosition: "ppt", // 用于记录当前主屏幕是文档还是播放器
|
|
|
+ mainPosition: "ppt" // 用于记录当前主屏幕是文档还是播放器
|
|
|
},
|
|
|
sectionId: 0,
|
|
|
goodsId: 0,
|
|
@@ -223,29 +214,30 @@ export default {
|
|
|
isFirst: true,
|
|
|
backNum: -1, //返回页面数
|
|
|
buyCourse: 1, // 是否购买课程:1是 0否
|
|
|
- identification: '', // 标识
|
|
|
- goodsName: '', // 名称
|
|
|
+ identification: "", // 标识
|
|
|
+ goodsName: "", // 名称
|
|
|
checkStatus: 0, // 0没有权限,1有权限
|
|
|
goodsStatus: 0, // 0未上架,1上架
|
|
|
- showAuth: false,
|
|
|
+ showAuth: false,
|
|
|
shareShow: false,
|
|
|
- sectionType: 2, //sectionType: 2, // 节类型 1视频 2直播 3回放
|
|
|
- vid: '', // 回放的id
|
|
|
+ sectionType: 2, //sectionType: 2, // 节类型 1视频 2直播 3回放
|
|
|
+ vid: "", // 回放的id
|
|
|
formShare: {
|
|
|
- links: '',
|
|
|
- ercode: '',
|
|
|
+ links: "",
|
|
|
+ ercode: ""
|
|
|
},
|
|
|
- shareLoading: false
|
|
|
+ shareLoading: false,
|
|
|
+ tsTime:null,
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
- ...mapGetters(["userInfo"]),
|
|
|
+ ...mapGetters(["userInfo"])
|
|
|
},
|
|
|
beforeRouteEnter(to, from, next) {
|
|
|
- next((vm) => {
|
|
|
+ next(vm => {
|
|
|
if (from.path.includes("my-course-detail")) {
|
|
|
vm.backNum = -2;
|
|
|
- } else if (from.path == '/login') {
|
|
|
+ } else if (from.path == "/login") {
|
|
|
vm.backNum = 0;
|
|
|
} else {
|
|
|
vm.backNum = -1;
|
|
@@ -253,172 +245,198 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
created() {
|
|
|
- console.log('是否登录了', this.$route.query)
|
|
|
+ console.log("是否登录了", this.$route.query);
|
|
|
if (!this.$tools.isLogin()) {
|
|
|
this.setCurrentRouter(this.$route);
|
|
|
this.$router.push({
|
|
|
- path: "/login",
|
|
|
+ path: "/login"
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
- const { a } = this.$route.query
|
|
|
- console.log('aaaaaaaaa', a, location.search.slice(5))
|
|
|
- this.channelId = this.$route.params.channelId
|
|
|
+ const { a } = this.$route.query;
|
|
|
+ console.log("aaaaaaaaa", a, location.search.slice(5));
|
|
|
+ this.channelId = this.$route.params.channelId;
|
|
|
// 有a字段是标识是复制链接进来
|
|
|
- if (a ==1) {
|
|
|
- this.getParam()
|
|
|
- return
|
|
|
+ if (a == 1) {
|
|
|
+ this.getParam();
|
|
|
+ return;
|
|
|
}
|
|
|
// 下面不是复制链接进来的
|
|
|
- const {sectionId, goodsId, courseId, orderGoodsId, gradeId, chapterId, moduleId, goodsName, sectionType, vid} = this.$route.query
|
|
|
- this.sectionId = sectionId
|
|
|
- this.goodsId = goodsId
|
|
|
- this.courseId = courseId
|
|
|
- this.orderGoodsId = orderGoodsId
|
|
|
- this.gradeId = gradeId
|
|
|
- this.chapterId = chapterId
|
|
|
- this.moduleId = moduleId
|
|
|
+ const {
|
|
|
+ sectionId,
|
|
|
+ goodsId,
|
|
|
+ courseId,
|
|
|
+ orderGoodsId,
|
|
|
+ gradeId,
|
|
|
+ chapterId,
|
|
|
+ moduleId,
|
|
|
+ goodsName,
|
|
|
+ sectionType,
|
|
|
+ vid
|
|
|
+ } = this.$route.query;
|
|
|
+ this.sectionId = sectionId;
|
|
|
+ this.goodsId = goodsId;
|
|
|
+ this.courseId = courseId;
|
|
|
+ this.orderGoodsId = orderGoodsId;
|
|
|
+ this.gradeId = gradeId;
|
|
|
+ this.chapterId = chapterId;
|
|
|
+ this.moduleId = moduleId;
|
|
|
// this.channelId = this.$route.params.channelId;
|
|
|
- this.goodsName = goodsName
|
|
|
- this.sectionType = sectionType
|
|
|
- this.vid = vid
|
|
|
- this.identification = new Date().valueOf() + ""
|
|
|
- this.buyCourse = 1 // 不是复制链接进来的,说明已经购买课程
|
|
|
+ this.goodsName = goodsName;
|
|
|
+ this.sectionType = sectionType;
|
|
|
+ this.vid = vid;
|
|
|
+ this.identification = new Date().valueOf() + "";
|
|
|
+ this.buyCourse = 1; // 不是复制链接进来的,说明已经购买课程
|
|
|
this.playVideo();
|
|
|
- if (this.sectionType !=3 ) {
|
|
|
+ if (this.sectionType != 3) {
|
|
|
this.studyRecordGetLastLive();
|
|
|
}
|
|
|
-
|
|
|
},
|
|
|
beforeDestroy() {
|
|
|
- if (!this.$tools.isLogin()) return
|
|
|
+ if (!this.$tools.isLogin()) return;
|
|
|
this.plv.liveSdk.destroy();
|
|
|
clearInterval(this.timer);
|
|
|
},
|
|
|
methods: {
|
|
|
...mapMutations(["setCurrentRouter", "getCartCount"]),
|
|
|
returnBack() {
|
|
|
- console.log('backNum', this.backNum)
|
|
|
+ console.log("backNum", this.backNum);
|
|
|
if (this.backNum == 0) {
|
|
|
this.$router.push({
|
|
|
- path: '/home'
|
|
|
- })
|
|
|
+ path: "/home"
|
|
|
+ });
|
|
|
} else {
|
|
|
- this.$router.go(this.backNum)
|
|
|
+ this.$router.go(this.backNum);
|
|
|
}
|
|
|
},
|
|
|
toShare() {
|
|
|
- this.shareLoading = true
|
|
|
- this.shareShow = true
|
|
|
+ this.shareLoading = true;
|
|
|
+ this.shareShow = true;
|
|
|
this.$axios({
|
|
|
- url: '/course/watch/per',
|
|
|
- method: 'get',
|
|
|
+ url: "/course/watch/per",
|
|
|
+ method: "get",
|
|
|
params: {
|
|
|
- courseId: this.courseId, //课程ID
|
|
|
+ courseId: this.courseId, //课程ID
|
|
|
goodsId: this.goodsId, // 商品id
|
|
|
moduleId: this.moduleId || null,
|
|
|
chapterId: this.chapterId || null,
|
|
|
sectionId: this.sectionId, // 节id
|
|
|
- sectionType: this.sectionType, //节类型 1视频 2直播 3回放
|
|
|
- },
|
|
|
- }).then((res) => {
|
|
|
- this.shareLoading = false
|
|
|
- if (res.code == 200) {
|
|
|
- this.formShare.links = res.data.enCodePC
|
|
|
- this.formShare.ercode = res.data.enCode
|
|
|
+ sectionType: this.sectionType //节类型 1视频 2直播 3回放
|
|
|
}
|
|
|
- }).catch((err) => {
|
|
|
- this.shareLoading = false
|
|
|
- this.$message.warning(err.msg)
|
|
|
})
|
|
|
+ .then(res => {
|
|
|
+ this.shareLoading = false;
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.formShare.links = res.data.enCodePC;
|
|
|
+ this.formShare.ercode = res.data.enCode;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ this.shareLoading = false;
|
|
|
+ this.$message.warning(err.msg);
|
|
|
+ });
|
|
|
},
|
|
|
// 获取直播间跳转参数的接口
|
|
|
getParam() {
|
|
|
- let decodeValue = decodeURIComponent(location.search.slice(5))
|
|
|
- let paramArr = Base64.decode(decodeValue.split('&')[0]).split('&')
|
|
|
- console.log('paramArr:',paramArr)
|
|
|
- let paramObj = {}
|
|
|
+ let decodeValue = decodeURIComponent(location.search.slice(5));
|
|
|
+ let paramArr = Base64.decode(decodeValue.split("&")[0]).split("&");
|
|
|
+ console.log("paramArr:", paramArr);
|
|
|
+ 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];
|
|
|
}
|
|
|
- const { cid, gid, sid} = paramObj
|
|
|
- console.log('cid, gid, sid', cid, gid, sid)
|
|
|
+ const { cid, gid, sid } = paramObj;
|
|
|
+ console.log("cid, gid, sid", cid, gid, sid);
|
|
|
this.$axios({
|
|
|
- url: '/course/check/watch/per',
|
|
|
- method: 'get',
|
|
|
+ url: "/course/check/watch/per",
|
|
|
+ method: "get",
|
|
|
params: {
|
|
|
- courseId: cid, //课程ID
|
|
|
+ courseId: cid, //课程ID
|
|
|
goodsId: gid, // 商品id
|
|
|
- sectionId: sid, // 节id
|
|
|
- },
|
|
|
- }).then((res) => {
|
|
|
- if (res.code == 200) {
|
|
|
- let item = res.data
|
|
|
- const {sectionId, goodsId, courseId, orderGoodsId, gradeId, chapterId, moduleId, buyCourse, sectionType, recordingUrl} = item
|
|
|
- this.goodsId = goodsId
|
|
|
- this.sectionId = sectionId
|
|
|
- this.courseId = courseId
|
|
|
- this.orderGoodsId = orderGoodsId
|
|
|
- this.gradeId = gradeId || 0
|
|
|
- this.chapterId = chapterId
|
|
|
- this.moduleId = moduleId
|
|
|
- this.buyCourse = buyCourse
|
|
|
- this.goodsStatus = item.goodsStatus
|
|
|
- this.goodsName = item.goodsName
|
|
|
- this.sectionType = sectionType
|
|
|
- this.vid = recordingUrl || ''
|
|
|
- console.log('vid', this.vid, this.sectionType)
|
|
|
- if (item.checkStatus == 1) { // 有权限
|
|
|
- this.identification = new Date().valueOf() + ""
|
|
|
- this.playVideo();
|
|
|
- if (this.sectionType != 3) {
|
|
|
- this.studyRecordGetLastLive();
|
|
|
+ sectionId: sid // 节id
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ let item = res.data;
|
|
|
+ const {
|
|
|
+ sectionId,
|
|
|
+ goodsId,
|
|
|
+ courseId,
|
|
|
+ orderGoodsId,
|
|
|
+ gradeId,
|
|
|
+ chapterId,
|
|
|
+ moduleId,
|
|
|
+ buyCourse,
|
|
|
+ sectionType,
|
|
|
+ recordingUrl
|
|
|
+ } = item;
|
|
|
+ this.goodsId = goodsId;
|
|
|
+ this.sectionId = sectionId;
|
|
|
+ this.courseId = courseId;
|
|
|
+ this.orderGoodsId = orderGoodsId;
|
|
|
+ this.gradeId = gradeId || 0;
|
|
|
+ this.chapterId = chapterId;
|
|
|
+ this.moduleId = moduleId;
|
|
|
+ this.buyCourse = buyCourse;
|
|
|
+ this.goodsStatus = item.goodsStatus;
|
|
|
+ this.goodsName = item.goodsName;
|
|
|
+ this.sectionType = sectionType;
|
|
|
+ this.vid = recordingUrl || "";
|
|
|
+ console.log("vid", this.vid, this.sectionType);
|
|
|
+ if (item.checkStatus == 1) {
|
|
|
+ // 有权限
|
|
|
+ this.identification = new Date().valueOf() + "";
|
|
|
+ this.playVideo();
|
|
|
+ if (this.sectionType != 3) {
|
|
|
+ this.studyRecordGetLastLive();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.showAuth = true;
|
|
|
}
|
|
|
- } else {
|
|
|
- this.showAuth = true
|
|
|
}
|
|
|
- }
|
|
|
- }).catch((err) => {
|
|
|
- console.log('500:', err)
|
|
|
- this.$message({
|
|
|
- message: err.msg,
|
|
|
- type: "warning",
|
|
|
})
|
|
|
- this.$router.push({
|
|
|
- path: '/home'
|
|
|
- })
|
|
|
- })
|
|
|
-
|
|
|
+ .catch(err => {
|
|
|
+ console.log("500:", err);
|
|
|
+ this.$message({
|
|
|
+ message: err.msg,
|
|
|
+ type: "warning"
|
|
|
+ });
|
|
|
+ this.$router.push({
|
|
|
+ path: "/home"
|
|
|
+ });
|
|
|
+ });
|
|
|
},
|
|
|
toAuth() {
|
|
|
- if (this.goodsStatus == 1) { //已上架
|
|
|
+ if (this.goodsStatus == 1) {
|
|
|
+ //已上架
|
|
|
this.$router.push({
|
|
|
- path: "/course-detail/" + this.goodsId,
|
|
|
- })
|
|
|
+ path: "/course-detail/" + this.goodsId
|
|
|
+ });
|
|
|
} else {
|
|
|
this.$router.push({
|
|
|
- path: '/home'
|
|
|
- })
|
|
|
+ path: "/home"
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
// 新增用户视频学习日志
|
|
|
studyLog() {
|
|
|
this.$axios({
|
|
|
- url: '/user/study/log',
|
|
|
- method: 'post',
|
|
|
+ url: "/user/study/log",
|
|
|
+ method: "post",
|
|
|
data: {
|
|
|
goodsId: this.goodsId,
|
|
|
courseId: this.courseId,
|
|
|
- moduleId: this.moduleId || 0,
|
|
|
- chapterId: this.chapterId || 0,
|
|
|
+ moduleId: this.moduleId || 0,
|
|
|
+ chapterId: this.chapterId || 0,
|
|
|
sectionId: this.sectionId || 0,
|
|
|
fromPlat: 2, //来源平台 1小程序 2PC网站
|
|
|
goodsType: 6, // 商品类型 1视频2题库 3补考 4前培 5虚拟赠送题库 6直播
|
|
|
- orderGoodsId: this.orderGoodsId,
|
|
|
+ orderGoodsId: this.orderGoodsId
|
|
|
}
|
|
|
- }).then((res) => {
|
|
|
- console.log('直播的用户学习日志:', res)
|
|
|
- })
|
|
|
+ }).then(res => {
|
|
|
+ console.log("直播的用户学习日志:", res);
|
|
|
+ });
|
|
|
},
|
|
|
close() {
|
|
|
this.signModal = false;
|
|
@@ -432,25 +450,26 @@ export default {
|
|
|
// /polyv/live/sign
|
|
|
this.$request
|
|
|
.polyvLivesign({
|
|
|
- channelId: this.channelId,
|
|
|
+ channelId: this.channelId
|
|
|
})
|
|
|
- .then((res) => {
|
|
|
+ .then(res => {
|
|
|
if (res.code == 200) {
|
|
|
- this.sign = res.data.sign;
|
|
|
- this.token = res.data.token;
|
|
|
- this.mediaChannelKey = res.data.mediaChannelKey;
|
|
|
- this.timestamp = res.data.timestamp;
|
|
|
- this.appId = res.data.appId;
|
|
|
-
|
|
|
- this.loadPlayerzb();
|
|
|
- // 新增用户视频学习日志
|
|
|
- this.studyLog()
|
|
|
+ this.sign = res.data.sign;
|
|
|
+ this.token = res.data.token;
|
|
|
+ this.mediaChannelKey = res.data.mediaChannelKey;
|
|
|
+ this.timestamp = res.data.timestamp;
|
|
|
+ this.appId = res.data.appId;
|
|
|
+
|
|
|
+ this.loadPlayerzb();
|
|
|
+ // 新增用户视频学习日志
|
|
|
+ this.studyLog();
|
|
|
} else {
|
|
|
- this.$message.warning(res.msg)
|
|
|
+ this.$message.warning(res.msg);
|
|
|
}
|
|
|
- }).catch((err) => {
|
|
|
- this.$message.warning(err.msg)
|
|
|
- })
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ this.$message.warning(err.msg);
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
async playVideo() {
|
|
@@ -470,9 +489,9 @@ export default {
|
|
|
this.$request
|
|
|
.studyRecordGetLastLive({
|
|
|
orderGoodsId: this.orderGoodsId,
|
|
|
- courseId: this.courseId,
|
|
|
+ courseId: this.courseId
|
|
|
})
|
|
|
- .then((res) => {
|
|
|
+ .then(res => {
|
|
|
if (!res.data) {
|
|
|
// this.signModal = true;
|
|
|
}
|
|
@@ -481,7 +500,7 @@ export default {
|
|
|
},
|
|
|
|
|
|
jquery() {
|
|
|
- return new Promise((resolve) => {
|
|
|
+ return new Promise(resolve => {
|
|
|
if (!window.polyvLivePlayer) {
|
|
|
const myScript = document.createElement("script");
|
|
|
myScript.setAttribute("src", "../../assets/jquery.min.js");
|
|
@@ -499,7 +518,7 @@ export default {
|
|
|
pptEl: "", // 文档容器选择器, 普通直播不需要设置pptEl
|
|
|
controllerEl: "", // 三分屏控制栏的容器选择器, pc三分屏的场景才需要设置controllerEl,
|
|
|
chatContainer: "", // 聊天室的容器选择器
|
|
|
- pptEl: "#tab-ppt",
|
|
|
+ pptEl: "#tab-ppt"
|
|
|
};
|
|
|
|
|
|
els.chatContainer = "#plv-pc-chat"; // DOM选择器,HTML元素,用于渲染聊天室
|
|
@@ -523,7 +542,7 @@ export default {
|
|
|
height: "100%",
|
|
|
token: this.token,
|
|
|
mediaChannelKey: this.mediaChannelKey,
|
|
|
- roomMessage: (data) => {
|
|
|
+ roomMessage: data => {
|
|
|
// data为聊天室socket消息,当有聊天室消息时会触发此方法
|
|
|
console.log(data);
|
|
|
if (this.plv.liveSdk && this.plv.liveSdk.player) {
|
|
@@ -532,7 +551,7 @@ export default {
|
|
|
this.plv.liveSdk.player.sendBarrage(data.content);
|
|
|
}
|
|
|
}
|
|
|
- },
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
this.plv.socket = chatroom.chat.socket;
|
|
@@ -549,8 +568,8 @@ export default {
|
|
|
userName: this.userInfo.realname,
|
|
|
pic:
|
|
|
this.$tools.splitImgHost(this.userInfo.avatar, true) ||
|
|
|
- "http://livestatic.videocc.net/assets/wimages/missing_face.png",
|
|
|
- },
|
|
|
+ "http://livestatic.videocc.net/assets/wimages/missing_face.png"
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
this.plv.liveSdk.on(
|
|
@@ -558,9 +577,8 @@ export default {
|
|
|
(event, status) => {
|
|
|
if (status == "end") {
|
|
|
clearInterval(this.timer);
|
|
|
- let duraing = this.playTime - this.duraing;
|
|
|
+ this.studyRecord(1);
|
|
|
this.duraing = 0;
|
|
|
- this.studyRecord(1, duraing);
|
|
|
}
|
|
|
}
|
|
|
); // 监听流状态变化
|
|
@@ -577,18 +595,17 @@ export default {
|
|
|
pptNavBottom: "80px",
|
|
|
barrage: true, // 是否开启弹幕
|
|
|
defaultBarrageStatus: true,
|
|
|
- autoplay: true,
|
|
|
- }
|
|
|
+ autoplay: true
|
|
|
+ };
|
|
|
if (this.sectionType == 3) {
|
|
|
// 回放模式需要fileId、url、sessionId
|
|
|
// fileId: undefined, //ppt数据id,回放模式必填
|
|
|
// url: undefined, // 回放视频链接,回放模式必填
|
|
|
// sessionId: undefined, // 回放场次id,回放模式必填
|
|
|
// vid: undefined, // 回放id,回放模式下传入该参数,可不传fileId、url、sessionId
|
|
|
- options.type = 'vod',
|
|
|
- options.vid = this.vid
|
|
|
+ (options.type = "vod"), (options.vid = this.vid);
|
|
|
}
|
|
|
- console.log('options', options)
|
|
|
+ console.log("options", options);
|
|
|
this.plv.liveSdk.on(
|
|
|
PolyvLiveSdk.EVENTS.CHANNEL_DATA_INIT,
|
|
|
(event, data) => {
|
|
@@ -616,59 +633,67 @@ export default {
|
|
|
// this.studyRecord(1);
|
|
|
// });
|
|
|
|
|
|
- this.plv.liveSdk.player.on("pause", (state) => {
|
|
|
- let duraing = this.playTime - this.duraing;
|
|
|
- this.duraing = 0;
|
|
|
- this.studyRecord(0, duraing);
|
|
|
+ this.plv.liveSdk.player.on("playing", state => {
|
|
|
+ this.tsTime = new Date().getTime() + 200
|
|
|
+ clearInterval(this.timer);
|
|
|
+ this.timer = setInterval(() => {
|
|
|
+ this.studyRecord(0);
|
|
|
+ }, 15000);
|
|
|
+ });
|
|
|
+ this.plv.liveSdk.player.on("pause", state => {
|
|
|
+ this.studyRecord(0);
|
|
|
clearInterval(this.timer);
|
|
|
});
|
|
|
|
|
|
- this.plv.liveSdk.player.on("loadedmetadata", (state) => {
|
|
|
+ this.plv.liveSdk.player.on("loadedmetadata", state => {
|
|
|
if (this.isFirst) {
|
|
|
+ this.duraing = 0;
|
|
|
this.studyRecord(0);
|
|
|
this.isFirst = false;
|
|
|
}
|
|
|
-
|
|
|
- clearInterval(this.timer);
|
|
|
- this.timer = setInterval(() => {
|
|
|
- this.studyRecord(0, 20);
|
|
|
- this.duraing += 20;
|
|
|
- }, 20000);
|
|
|
});
|
|
|
|
|
|
- this.plv.liveSdk.player.on("timeupdate", (time) => {
|
|
|
+ this.plv.liveSdk.player.on("timeupdate", time => {
|
|
|
this.playTime = time;
|
|
|
+ //节流
|
|
|
+ let jieliuTime = new Date().getTime()
|
|
|
+ if(this.tsTime > jieliuTime){
|
|
|
+ return
|
|
|
+ }else{
|
|
|
+ this.tsTime = jieliuTime + 1000
|
|
|
+ this.duraing += 1
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
);
|
|
|
},
|
|
|
|
|
|
- studyRecord(status, duraing) {
|
|
|
+ studyRecord(status) {
|
|
|
if (!this.sectionId) {
|
|
|
return;
|
|
|
}
|
|
|
let self = this;
|
|
|
- this.$request.studyRecord({
|
|
|
- fromPlat: 2, //来源平台 1小程序 2网站
|
|
|
- buyCourse: this.buyCourse,
|
|
|
- identification: this.identification,
|
|
|
- sectionId: parseInt(this.sectionId),
|
|
|
+ self.$request.studyRecord({
|
|
|
+ fromPlat: 2, //来源平台 1小程序 2网站
|
|
|
+ buyCourse: self.buyCourse,
|
|
|
+ identification: self.identification,
|
|
|
+ sectionId: parseInt(self.sectionId),
|
|
|
goodsId: parseInt(self.goodsId),
|
|
|
courseId: parseInt(self.courseId),
|
|
|
- orderGoodsId: this.orderGoodsId,
|
|
|
- studyDuration: parseInt(duraing) || 0,
|
|
|
+ orderGoodsId: self.orderGoodsId,
|
|
|
+ studyDuration: parseInt(self.duraing) || 0,
|
|
|
gradeId: parseInt(self.gradeId),
|
|
|
chapterId: parseInt(self.chapterId),
|
|
|
moduleId: parseInt(self.moduleId),
|
|
|
- videoCurrentTime: 2,
|
|
|
- status: status,
|
|
|
+ videoCurrentTime: self.playTime || 0,
|
|
|
+ status: status
|
|
|
});
|
|
|
},
|
|
|
/**
|
|
|
* @param {String} 直播js加载
|
|
|
*/
|
|
|
loadChatroomScriptzb() {
|
|
|
- return new Promise((resolve) => {
|
|
|
+ return new Promise(resolve => {
|
|
|
if (!window.polyvLivePlayer) {
|
|
|
const myScript = document.createElement("script");
|
|
|
myScript.setAttribute("src", this.chatroomJs);
|
|
@@ -683,7 +708,7 @@ export default {
|
|
|
* @param {String} 聊天室js加载
|
|
|
*/
|
|
|
loadPlayerScriptzb() {
|
|
|
- return new Promise((resolve) => {
|
|
|
+ return new Promise(resolve => {
|
|
|
if (!window.polyvLivePlayer) {
|
|
|
const myScript = document.createElement("script");
|
|
|
myScript.setAttribute("src", this.playerJs);
|
|
@@ -709,8 +734,8 @@ export default {
|
|
|
// 点击到文档tab时调用播放器的resize方法,原因:
|
|
|
// ppt父容器样式改变会导致ppt显示异常,需要调用resize刷新ppt尺寸,该函数用于移动端三分屏场景
|
|
|
handlePptTabClick() {
|
|
|
- $("[data-type=ppt]").click(function () {
|
|
|
- setTimeout(function () {
|
|
|
+ $("[data-type=ppt]").click(function() {
|
|
|
+ setTimeout(function() {
|
|
|
this.plv.liveSdk.player.resize();
|
|
|
}, 0);
|
|
|
});
|
|
@@ -748,7 +773,7 @@ export default {
|
|
|
this.plv.liveSdk.player.resizeBarrage(); // 刷新弹幕显示区域尺寸
|
|
|
},
|
|
|
download() {
|
|
|
- var url = this.formShare.ercode
|
|
|
+ var url = this.formShare.ercode;
|
|
|
var a = document.createElement("a");
|
|
|
var event = new MouseEvent("click");
|
|
|
a.download = "二维码";
|
|
@@ -771,8 +796,8 @@ export default {
|
|
|
} catch (err) {
|
|
|
this.$message.error("复制失败,请检查浏览器兼容");
|
|
|
}
|
|
|
- },
|
|
|
- },
|
|
|
+ }
|
|
|
+ }
|
|
|
};
|
|
|
</script>
|
|
|
|
|
@@ -915,15 +940,15 @@ export default {
|
|
|
}
|
|
|
|
|
|
.popCentent {
|
|
|
- display: flex;
|
|
|
- flex-direction: column;
|
|
|
- align-items: center;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
.btns {
|
|
|
width: 300px;
|
|
|
height: 40px;
|
|
|
line-height: 40px;
|
|
|
text-align: center;
|
|
|
- background-color: #3577E8;
|
|
|
+ background-color: #3577e8;
|
|
|
color: #fff;
|
|
|
font-size: 16px;
|
|
|
border-radius: 20px;
|