|
@@ -3,7 +3,7 @@
|
|
|
<nav-bar title="课程详情"></nav-bar>
|
|
|
<view class="videoBox">
|
|
|
<!-- <view > -->
|
|
|
- <view class="video_box" v-if="!startStatus">
|
|
|
+ <view class="video_box" v-if="!vid">
|
|
|
<image
|
|
|
:src="$method.splitImgHost(detail.coverUrl)"
|
|
|
style="width: 100%; height: 450rpx"
|
|
@@ -17,24 +17,12 @@
|
|
|
</view>
|
|
|
|
|
|
<view v-else class="video_box" style="width: 100%; height: 450rpx">
|
|
|
- <!-- #ifdef MP-WEIXIN -->
|
|
|
- <polyv-player
|
|
|
- id="playerVideo"
|
|
|
- playerId="playerVideo"
|
|
|
- height="450rpx"
|
|
|
- :vid="vid"
|
|
|
- :showSettingBtn="true"
|
|
|
- :enablePlayGesture="true"
|
|
|
- :playbackRate="playbackRate"
|
|
|
- :isAllowSeek="isAllowSeek"
|
|
|
- :autoplay="autoplay"
|
|
|
- :startTime="startTime"
|
|
|
- @statechange="onStateChange"
|
|
|
- ></polyv-player>
|
|
|
- <!-- #endif -->
|
|
|
- <!-- #ifdef H5 -->
|
|
|
- <view v-show="vid" id="player"></view>
|
|
|
- <!-- #endif -->
|
|
|
+ <my-player
|
|
|
+ ref="player"
|
|
|
+ :playVid="vid"
|
|
|
+ :autoplay="true"
|
|
|
+ @timeupdate="timeupdate"
|
|
|
+ ></my-player>
|
|
|
</view>
|
|
|
|
|
|
<view class="cou_title">
|
|
@@ -352,6 +340,7 @@ import courseChapter from "@/components/course/courseChapter.vue";
|
|
|
import courseSection from "@/components/course/courseSection.vue";
|
|
|
import handoutsBox from "@/components/course/handoutsBox.vue";
|
|
|
import courseTree from "@/components/course/courseTree.vue";
|
|
|
+import myPlayer from "@/components/myPlayer/polyvPlayer.vue";
|
|
|
import { mapGetters, mapMutations } from "vuex";
|
|
|
export default {
|
|
|
components: {
|
|
@@ -360,6 +349,7 @@ export default {
|
|
|
courseSection,
|
|
|
handoutsBox,
|
|
|
courseTree,
|
|
|
+ myPlayer,
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
@@ -397,15 +387,11 @@ export default {
|
|
|
specAttrPriceList: [],
|
|
|
options: {},
|
|
|
courseId: "",
|
|
|
+ refPlv: null,
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
- ...mapGetters([
|
|
|
- "userInfo",
|
|
|
- "goodsAuditionConfigIdList",
|
|
|
- "playSectionId",
|
|
|
- "hideBuyState",
|
|
|
- ]),
|
|
|
+ ...mapGetters(["userInfo", "playSectionId", "hideBuyState"]),
|
|
|
allPrice() {
|
|
|
if (!this.specList.length) return 0;
|
|
|
let allPrice = this.specList.slice(-1)[0].specAttrList.reduce((a, b) => {
|
|
@@ -514,48 +500,24 @@ export default {
|
|
|
},
|
|
|
|
|
|
mounted() {
|
|
|
- let self = this;
|
|
|
- uni.$on("getSection", (item) => {
|
|
|
- console.log("🚀 ~ file: detail.vue:578 ~ uni.$on ~ item:", item);
|
|
|
+ uni.$on("getSection", (item, listen) => {
|
|
|
+ console.log("🚀 ~ file: detail.vue:578 ~ uni.$on ~ item:", item, listen);
|
|
|
//播放试听
|
|
|
- self.listenSecond = 0;
|
|
|
- for (var itemChild of self.listenConfigList) {
|
|
|
- if (
|
|
|
- item.sectionId == (itemChild.sectionId || itemChild.menuId) &&
|
|
|
- item.courseId == itemChild.courseId
|
|
|
- ) {
|
|
|
- if (itemChild.auditionMinute > 0) {
|
|
|
- // self.listenSecond = itemChild.auditionMinute *60 //试听秒数
|
|
|
- self.listenSecond = itemChild.auditionMinute; //试听秒数 auditionMinute调整为秒单位
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- console.log(self.listenSecond, "self.listenSecond");
|
|
|
- if (self.listenSecond > 0) {
|
|
|
- if (self.timer) {
|
|
|
- clearInterval(self.timer);
|
|
|
- }
|
|
|
+ this.listenSecond = listen.auditionMinute;
|
|
|
+ if (this.listenSecond > 0) {
|
|
|
if (item.recordingUrl) {
|
|
|
- self.vid = item.recordingUrl;
|
|
|
- if (this.player) {
|
|
|
- this.player.changeVid(this.vid);
|
|
|
- return;
|
|
|
+ this.vid = item.recordingUrl;
|
|
|
+ if (this.refPlv) {
|
|
|
+ this.refPlv.changeVid({
|
|
|
+ vid: this.vid,
|
|
|
+ videoCurrentTime: 0,
|
|
|
+ });
|
|
|
}
|
|
|
- //切换视频
|
|
|
- // #ifdef H5
|
|
|
- this.loadPlayerScript(this.loadPlayer);
|
|
|
- // #endif
|
|
|
- // #ifdef MP-WEIXIN
|
|
|
- this.player = self.selectComponent("#player");
|
|
|
- // #endif
|
|
|
} else {
|
|
|
- self.$u.toast("地址错误,无法播放");
|
|
|
+ this.$u.toast("地址错误,无法播放");
|
|
|
}
|
|
|
-
|
|
|
- self.startStatus = true;
|
|
|
- self.startTime = 0;
|
|
|
} else {
|
|
|
- self.$u.toast("试听配置错误");
|
|
|
+ this.$u.toast("试听配置错误");
|
|
|
}
|
|
|
});
|
|
|
this.updateChapterOpen(true);
|
|
@@ -645,6 +607,22 @@ export default {
|
|
|
return "0.00";
|
|
|
}
|
|
|
},
|
|
|
+ timeupdate(time) {
|
|
|
+ if (time >= this.listenSecond) {
|
|
|
+ this.refPlv && (this.refPlv = this.$refs.player);
|
|
|
+ this.refPlv.playPause();
|
|
|
+ this.refPlv.exitFullScreen();
|
|
|
+ uni.showModal({
|
|
|
+ title: "提示",
|
|
|
+ content: "试听结束,购买课程可学习全部",
|
|
|
+ showCancel: false,
|
|
|
+ success: (resst) => {
|
|
|
+ this.vid = "";
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
+ console.log("🚀 ~ file: detail.vue:615 ~ timeupdate ~ time:", time);
|
|
|
+ },
|
|
|
onStateChange(newstate, oldstate) {
|
|
|
if (newstate.detail.newstate == "playing") {
|
|
|
//开始播放
|
|
@@ -710,6 +688,10 @@ export default {
|
|
|
goodsCourseList() {
|
|
|
// url: '/app/common/goods/course/list/'+ data,
|
|
|
this.$api.goodsCourseList(this.id).then((res) => {
|
|
|
+ console.log(
|
|
|
+ "🚀 ~ file: detail.vue:708 ~ this.$api.goodsCourseList ~ res:",
|
|
|
+ res
|
|
|
+ );
|
|
|
if (res.data.code == 200) {
|
|
|
for (let i = 0; i < res.data.rows.length; i++) {
|
|
|
let item = res.data.rows[i];
|
|
@@ -874,7 +856,6 @@ export default {
|
|
|
},
|
|
|
getFxDetail() {
|
|
|
let self = this;
|
|
|
- let sectionIdList = [];
|
|
|
this.$api
|
|
|
.fxGoodsDetail({
|
|
|
goodsId: this.id,
|
|
@@ -897,13 +878,6 @@ export default {
|
|
|
self.listenConfigList = JSON.parse(
|
|
|
self.detail.goodsAuditionConfig
|
|
|
);
|
|
|
- console.log(self.listenConfigList, "self.listenConfigList");
|
|
|
- for (var itemChild of self.listenConfigList) {
|
|
|
- sectionIdList.push(itemChild.sectionId); //存储试听节ID
|
|
|
- }
|
|
|
- self.$store.commit("setGoodsAuditionConfigIdList", {
|
|
|
- goodsAuditionConfigIdList: sectionIdList,
|
|
|
- });
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -912,7 +886,6 @@ export default {
|
|
|
// 获取课程详情
|
|
|
getDetail() {
|
|
|
let self = this;
|
|
|
- let sectionIdList = [];
|
|
|
this.$api.commonGoodsDetail(this.id).then((res) => {
|
|
|
if (res.data.code == 200) {
|
|
|
if (res.data.data) {
|
|
@@ -925,19 +898,11 @@ export default {
|
|
|
}
|
|
|
|
|
|
self.detail = res.data.data;
|
|
|
- console.log(self.detail, 789);
|
|
|
this.courseBusiness();
|
|
|
if (self.detail.goodsAuditionConfig) {
|
|
|
self.listenConfigList = JSON.parse(
|
|
|
self.detail.goodsAuditionConfig
|
|
|
);
|
|
|
- console.log(self.listenConfigList, "self.listenConfigList");
|
|
|
- for (var itemChild of self.listenConfigList) {
|
|
|
- sectionIdList.push(itemChild.sectionId); //存储试听节ID
|
|
|
- }
|
|
|
- self.$store.commit("setGoodsAuditionConfigIdList", {
|
|
|
- goodsAuditionConfigIdList: sectionIdList,
|
|
|
- });
|
|
|
}
|
|
|
}
|
|
|
}
|