|
@@ -17,6 +17,7 @@
|
|
|
</view>
|
|
|
<view v-else>
|
|
|
<my-player
|
|
|
+ v-if="playVID"
|
|
|
ref="player"
|
|
|
:playVid="playVID"
|
|
|
:autoplay="autoplay"
|
|
@@ -104,11 +105,8 @@
|
|
|
></course-tree>
|
|
|
</view>
|
|
|
<!--讲义 -->
|
|
|
- <view v-show="current == 1">
|
|
|
- <handouts-box
|
|
|
- :handoutsId="goodsData.handoutsId"
|
|
|
- v-if="goodsData.handoutsId"
|
|
|
- ></handouts-box>
|
|
|
+ <view v-if="current == 1">
|
|
|
+ <handouts-box :handoutsId="goodsData.handoutsId"></handouts-box>
|
|
|
</view>
|
|
|
<!--笔记 -->
|
|
|
<view v-if="current == 2">
|
|
@@ -120,76 +118,25 @@
|
|
|
></note-Box>
|
|
|
</view>
|
|
|
<!--答疑 -->
|
|
|
- <view v-show="current == 3">
|
|
|
- <answer-box
|
|
|
- :userId="userInfo ? userInfo.userId : 0"
|
|
|
- :params="params(['orderGoodsId', 'goodsId', 'courseId', 'gradeId'])"
|
|
|
- ></answer-box>
|
|
|
+ <view v-if="current == 3">
|
|
|
+ <answer-box :userId="userInfo ? userInfo.userId : 0"></answer-box>
|
|
|
</view>
|
|
|
<!--目录 -->
|
|
|
- <view v-show="current == 4">
|
|
|
- <view
|
|
|
- class="menuBox"
|
|
|
- v-for="(item, index) in reMenuList"
|
|
|
- :key="index"
|
|
|
- >
|
|
|
- <!--模块 -->
|
|
|
- <view v-if="item.type == 1"
|
|
|
- ><courseModule
|
|
|
- :orderGoodsId="orderGoodsId"
|
|
|
- :sectionMaxNum="goodsData.sectionMaxNum"
|
|
|
- :courseId="courseId"
|
|
|
- :learningOrder="orderNum"
|
|
|
- :goodsId="goodsId"
|
|
|
- :gradeId="gradeId"
|
|
|
- :isRebuild="true"
|
|
|
- :isBuy="true"
|
|
|
- :menuItem="item"
|
|
|
- :levelId="item.menuId"
|
|
|
- :goodsType="1"
|
|
|
- :menuAllList="menuAllList"
|
|
|
- :sectionItem="sectionItem"
|
|
|
- ></courseModule
|
|
|
- ></view>
|
|
|
- <!--章 -->
|
|
|
- <view v-if="item.type == 2">
|
|
|
- <courseChapter
|
|
|
- :orderGoodsId="orderGoodsId"
|
|
|
- :courseId="courseId"
|
|
|
- :learningOrder="orderNum"
|
|
|
- :sectionMaxNum="goodsData.sectionMaxNum"
|
|
|
- @playEnd="sectionPlayEnd($event, index)"
|
|
|
- :gradeId="gradeId"
|
|
|
- :goodsId="goodsId"
|
|
|
- :isRebuild="true"
|
|
|
- :isBuy="true"
|
|
|
- :menuItem="item"
|
|
|
- :levelId="'0-' + item.menuId"
|
|
|
- :goodsType="1"
|
|
|
- :menuAllList="menuAllList"
|
|
|
- ></courseChapter>
|
|
|
- </view>
|
|
|
- <!--节 -->
|
|
|
- <view v-if="item.type == 3">
|
|
|
- <courseSection
|
|
|
- :orderGoodsId="orderGoodsId"
|
|
|
- :courseId="courseId"
|
|
|
- :learningOrder="orderNum"
|
|
|
- :sectionMaxNum="goodsData.sectionMaxNum"
|
|
|
- @playEnd="sectionPlayEnd($event, index)"
|
|
|
- :gradeId="gradeId"
|
|
|
- :goodsId="goodsId"
|
|
|
- :isRebuild="true"
|
|
|
- :isBuy="true"
|
|
|
- :nextMenuItem="findMenuNextSection(index)"
|
|
|
- :menuItem="item"
|
|
|
- :levelId="'0-0-' + item.menuId"
|
|
|
- :goodsType="1"
|
|
|
- :testType="3"
|
|
|
- :menuAllList="menuAllList"
|
|
|
- ></courseSection>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
+ <view v-if="current == 4">
|
|
|
+ <course-tree
|
|
|
+ v-if="sectionItem.id || sectionItem.sectionId"
|
|
|
+ :orderGoodsId="orderGoodsId"
|
|
|
+ :sectionMaxNum="goodsData.sectionMaxNum"
|
|
|
+ :courseId="courseId"
|
|
|
+ :learningOrder="orderNum"
|
|
|
+ :goodsId="goodsId"
|
|
|
+ :gradeId="gradeId"
|
|
|
+ :isRebuild="true"
|
|
|
+ :isBuy="true"
|
|
|
+ :goodsType="1"
|
|
|
+ :menuAllList="menuAllList"
|
|
|
+ :sectionItem="sectionItem"
|
|
|
+ ></course-tree>
|
|
|
</view>
|
|
|
</scroll-view>
|
|
|
</view>
|
|
@@ -356,19 +303,14 @@
|
|
|
</view>
|
|
|
</u-popup>
|
|
|
<!-- 摄像头 -->
|
|
|
- <Popup-camera :goodsId="goodsId" ref="camera"></Popup-camera>
|
|
|
+ <Popup-camera @submitPhoto="submitPhoto" ref="camera" />
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import plv from "../static/polyv-sdk/index";
|
|
|
-import courseModule from "@/components/course/courseModule.vue";
|
|
|
-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 PopupCamera from "../../components/popup/camera.vue";
|
|
|
-import myCompressImage from "@/common/compressPhoto.js";
|
|
|
import myPlayer from "@/components/myPlayer/polyvPlayer.vue";
|
|
|
import noteBox from "@/components/course/noteBox.vue";
|
|
|
import answerBox from "@/components/course/answerBox.vue";
|
|
@@ -376,9 +318,6 @@ import { mapGetters, mapMutations } from "vuex";
|
|
|
import { lockAction } from "../../utils/lock";
|
|
|
export default {
|
|
|
components: {
|
|
|
- courseModule,
|
|
|
- courseChapter,
|
|
|
- courseSection,
|
|
|
handoutsBox,
|
|
|
myPlayer,
|
|
|
noteBox,
|
|
@@ -396,9 +335,6 @@ export default {
|
|
|
orderGoodsId: 0,
|
|
|
noticeShow: false,
|
|
|
enableAutoRotation: true,
|
|
|
- seekTime: "",
|
|
|
- toastTimer: null,
|
|
|
- videoToastShow: false,
|
|
|
showSet: false,
|
|
|
startStatus: false,
|
|
|
courseId: 0,
|
|
@@ -414,9 +350,7 @@ export default {
|
|
|
playbackRate: [1.0],
|
|
|
timer: null,
|
|
|
goodsPhotographConfig: null,
|
|
|
- intervalTimeList: [], // 间隔拍照时长
|
|
|
- intervalTimeIndex: 0, //当前处于哪个时间段拍照
|
|
|
- playTime: 0, //页面播放时长,不含暂停
|
|
|
+ playTime: 0, // 播放时刻
|
|
|
currentTime: 0,
|
|
|
avatarUrl: "",
|
|
|
ossAvatarUrl: "",
|
|
@@ -426,6 +360,7 @@ export default {
|
|
|
moduleId: 0,
|
|
|
reMenuList: [],
|
|
|
recordObj: {},
|
|
|
+ photoIndex: 0,
|
|
|
isTaking: true, //是否正在拍照
|
|
|
needSeek: false, //第一次播放是否需要跳转
|
|
|
photoNum: 0,
|
|
@@ -433,7 +368,6 @@ export default {
|
|
|
photoConfig: false, //是否配置好拍照次数
|
|
|
photoHistoryList: [], //已拍照历史的下标点
|
|
|
sectionItem: {},
|
|
|
- showNotes: true,
|
|
|
uploadLock: false, //上传图片
|
|
|
isPlayRebuild: false, //是否正在播放重修视频needOpen
|
|
|
isRebuild: false, //视频是否从重修目录点击
|
|
@@ -465,6 +399,7 @@ export default {
|
|
|
isReach: false,
|
|
|
noticeShow1: false,
|
|
|
refPlv: null,
|
|
|
+ isCache: true,
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
@@ -476,6 +411,7 @@ export default {
|
|
|
"config",
|
|
|
]),
|
|
|
playSecIsLearn() {
|
|
|
+ return false;
|
|
|
return this.sectionItem.learning != 1;
|
|
|
},
|
|
|
orderNum() {
|
|
@@ -518,28 +454,6 @@ export default {
|
|
|
return this.courseList.find((e) => e.courseId == this.courseId);
|
|
|
},
|
|
|
},
|
|
|
- watch: {
|
|
|
- showSet(n) {
|
|
|
- if (n) {
|
|
|
- if (polyvPlayerContext) {
|
|
|
- // #ifdef MP-WEIXIN
|
|
|
- polyvPlayerContext.pause();
|
|
|
- // #endif
|
|
|
- // #ifdef H5
|
|
|
- polyvPlayerContext.j2s_pauseVideo(); // 暂停播放视频
|
|
|
- // #endif
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- photoPopup(n) {
|
|
|
- if (n) {
|
|
|
- if (this.prendreAutoCarme) {
|
|
|
- this.photoPopup = false;
|
|
|
- }
|
|
|
- this.showSet && (this.photoPopup = false);
|
|
|
- }
|
|
|
- },
|
|
|
- },
|
|
|
async onLoad(option) {
|
|
|
if (option.isOther) {
|
|
|
this.showMark = true;
|
|
@@ -547,39 +461,47 @@ export default {
|
|
|
}
|
|
|
this.option = option;
|
|
|
let { skipPort, id, goodsId, orderGoodsId, gradeId, informId } = option;
|
|
|
+ this.orderGoodsId = Number(orderGoodsId) || "";
|
|
|
+ this.courseId = Number(id) || "";
|
|
|
+ this.goodsId = Number(goodsId);
|
|
|
+ this.gradeId = Number(gradeId);
|
|
|
+ this.isCache = false;
|
|
|
if (skipPort) {
|
|
|
await this.$method.skipLogin(skipPort);
|
|
|
}
|
|
|
if (this.$method.isGoLogin()) {
|
|
|
return;
|
|
|
}
|
|
|
- this.orderGoodsId = Number(orderGoodsId) || "";
|
|
|
- this.isCanLearn();
|
|
|
- !this.userInfo && this.$api.refreshUserInfo();
|
|
|
- this.courseId = Number(id) || "";
|
|
|
- this.goodsId = Number(goodsId);
|
|
|
- this.gradeId = Number(gradeId);
|
|
|
// 公众号模板消息的数据埋点
|
|
|
informId && this.clickOfficial(informId);
|
|
|
- this.init();
|
|
|
- this.courseCourseList();
|
|
|
+ await this.init();
|
|
|
},
|
|
|
async onShow() {
|
|
|
- // this.closePhoto();
|
|
|
+ if (this.isCache) {
|
|
|
+ // #ifdef H5
|
|
|
+ location.reload();
|
|
|
+ // #endif
|
|
|
+ // #ifdef MP-WEIXIN
|
|
|
+ this.init();
|
|
|
+ // #endif
|
|
|
+ }
|
|
|
},
|
|
|
onUnload() {
|
|
|
console.log("onUnloadonUnloadonUnloadonUnload");
|
|
|
this.originUnload();
|
|
|
- this.clears();
|
|
|
clearInterval(this.lockTimer);
|
|
|
},
|
|
|
onHide() {
|
|
|
+ setTimeout(() => {
|
|
|
+ this.isCache = true;
|
|
|
+ }, 2000);
|
|
|
this.originUnload();
|
|
|
},
|
|
|
mounted() {},
|
|
|
methods: {
|
|
|
...mapMutations(["updateChapterOpen", "updateLiveLast"]),
|
|
|
- init() {
|
|
|
+ async init() {
|
|
|
+ this.isCache = false;
|
|
|
// #ifdef MP-WEIXIN
|
|
|
this.isAllowSeek = "no";
|
|
|
// #endif
|
|
@@ -589,6 +511,9 @@ export default {
|
|
|
// 锁
|
|
|
lockAction();
|
|
|
this.lockTimer = setInterval(lockAction, 10000);
|
|
|
+ await this.isCanLearn();
|
|
|
+ !this.userInfo && this.$api.refreshUserInfo();
|
|
|
+ this.courseCourseList();
|
|
|
},
|
|
|
// 七大员是否能进入学习
|
|
|
async qCheckIsCanLearn() {
|
|
@@ -640,9 +565,7 @@ export default {
|
|
|
.courseCourseList({
|
|
|
pageNum: 1,
|
|
|
pageSize: 200,
|
|
|
- goodsId: this.goodsId,
|
|
|
- gradeId: this.gradeId,
|
|
|
- orderGoodsId: this.orderGoodsId,
|
|
|
+ ...this.params(["goodsId", "orderGoodsId", "gradeId"]),
|
|
|
})
|
|
|
.then((res) => {
|
|
|
if (res.data.code == 200) {
|
|
@@ -898,7 +821,6 @@ export default {
|
|
|
//移除所有的事件监听器
|
|
|
uni.$off();
|
|
|
this.clearTimer && clearTimeout(this.clearTimer);
|
|
|
- this.toastTimer && clearTimeout(this.toastTimer);
|
|
|
|
|
|
if (this.studyTimer) {
|
|
|
clearInterval(this.studyTimer);
|
|
@@ -960,9 +882,7 @@ export default {
|
|
|
if (item.rebuild === 0) {
|
|
|
this.$navTo.togo("/pages2/learn/details", {
|
|
|
id: item.courseId,
|
|
|
- gradeId: item.gradeId,
|
|
|
- goodsId: this.goodsId,
|
|
|
- orderGoodsId: this.orderGoodsId,
|
|
|
+ ...this.params(["goodsId", "orderGoodsId", "gradeId"]),
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
@@ -1060,6 +980,7 @@ export default {
|
|
|
async initPlayVideo(sectionItem) {
|
|
|
this.moduleId = sectionItem.moduleId;
|
|
|
this.chapterId = sectionItem.chapterId;
|
|
|
+ this.sectionItem = sectionItem
|
|
|
if (sectionItem.sectionType == 1) {
|
|
|
//录播
|
|
|
this.playVideo(sectionItem);
|
|
@@ -1082,6 +1003,31 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
},
|
|
|
+ async submitPhoto(url, compareFaceData, cb) {
|
|
|
+ this.ossAvatarUrl = url;
|
|
|
+ this.compareFaceData = compareFaceData;
|
|
|
+ this.postCoursePhotoRecord()
|
|
|
+ .then(async (res) => {
|
|
|
+ this.photoHistoryList[this.photoIndex] = true;
|
|
|
+ await this.postStudyRecord();
|
|
|
+ if (!this.erJianErZao && this.isReach) {
|
|
|
+ await this.postStudyRecord(1);
|
|
|
+ cb();
|
|
|
+ this.nextSection();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ cb();
|
|
|
+ this.refPlv.resumeVideo();
|
|
|
+ this.enableAutoRotation = true;
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ uni.showToast({
|
|
|
+ title: "上传接口报错,请重新拍照上传" + err,
|
|
|
+ icon: "none",
|
|
|
+ });
|
|
|
+ cb(1);
|
|
|
+ });
|
|
|
+ },
|
|
|
toQuestionBank(sectionItem) {
|
|
|
uni.navigateTo({
|
|
|
url:
|
|
@@ -1116,6 +1062,7 @@ export default {
|
|
|
courseId: this.courseId,
|
|
|
})
|
|
|
.then((res) => {
|
|
|
+ console.log("🚀 ~ file: detail.vue:1071 ~ .then ~ res:", res)
|
|
|
let { data } = res.data;
|
|
|
if (!data.sectionId) {
|
|
|
data = this.menuAllList[0];
|
|
@@ -1283,9 +1230,7 @@ export default {
|
|
|
return this.$api
|
|
|
.studMenuAllList({
|
|
|
courseId: this.courseId,
|
|
|
- gradeId: this.gradeId,
|
|
|
- goodsId: this.goodsId,
|
|
|
- orderGoodsId: this.orderGoodsId,
|
|
|
+ ...this.params(["goodsId", "orderGoodsId", "gradeId"]),
|
|
|
})
|
|
|
.then((res) => {
|
|
|
let nowTime = Number(new Date().getTime() / 1000).toFixed(0);
|
|
@@ -1397,22 +1342,16 @@ export default {
|
|
|
},
|
|
|
loadedmetadata(event) {
|
|
|
this.refPlv = this.$refs.player;
|
|
|
- this.$refs["camera"].openCamera();
|
|
|
+ // this.openCamera()
|
|
|
},
|
|
|
getPhotoLastRecord() {
|
|
|
- // if (this.erJianErZao || !this.playSecIsLearn || this.photoNum <= 0) {
|
|
|
- // return;
|
|
|
- // }
|
|
|
- let self = this;
|
|
|
let { chapterId, sectionId, moduleId } = this.sectionItem;
|
|
|
let data = {
|
|
|
+ ...this.params(),
|
|
|
sectionId: sectionId || 0,
|
|
|
- goodsId: this.goodsId,
|
|
|
- courseId: this.courseId,
|
|
|
gradeId: this.gradeId,
|
|
|
chapterId: chapterId || 0,
|
|
|
moduleId: moduleId || 0,
|
|
|
- orderGoodsId: this.orderGoodsId,
|
|
|
};
|
|
|
this.$api.getPhotoLastRecord(data).then((res) => {
|
|
|
if (res.data.code == 200) {
|
|
@@ -1433,33 +1372,19 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
//postTime 只提交随机时间
|
|
|
- postCoursePhotoRecord() {
|
|
|
+ postCoursePhotoRecord(postTime = false) {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
- let currentTime = 0;
|
|
|
- // var polyvPlayerContext = this.selectComponent("#playerVideo");
|
|
|
- if (polyvPlayerContext) {
|
|
|
- // #ifdef MP-WEIXIN
|
|
|
- currentTime = polyvPlayerContext.getCurrentTime();
|
|
|
- // #endif
|
|
|
- // #ifdef H5
|
|
|
- currentTime = polyvPlayerContext.j2s_getCurrentTime();
|
|
|
- // #endif
|
|
|
- }
|
|
|
let data = {
|
|
|
+ ...this.params("orderGoodsId", "goodsId", "courseId", "gradeId"),
|
|
|
photo: this.ossAvatarUrl,
|
|
|
sectionId: this.playSectionId,
|
|
|
- goodsId: this.goodsId,
|
|
|
- courseId: this.courseId,
|
|
|
- photoTime: parseInt(currentTime > 0 ? currentTime : 0),
|
|
|
- gradeId: this.gradeId,
|
|
|
- photoIndex: -2, //从0算起,-2只提交随机时间
|
|
|
+ photoTime: this.playTime || 0,
|
|
|
+ photoIndex: postTime ? -2 : this.photoIndex, //从0算起,-2只提交随机时间
|
|
|
photoNum: this.photoNum,
|
|
|
chapterId: this.chapterId,
|
|
|
moduleId: this.moduleId,
|
|
|
- timeInterval: this.photoList.join(","),
|
|
|
- orderGoodsId: this.orderGoodsId,
|
|
|
+ timeInterval: postTime ? this.photoList.join(",") : "",
|
|
|
};
|
|
|
- // console.log("提交接口", data);
|
|
|
this.$api
|
|
|
.coursePhotoRecord(data)
|
|
|
.then((res) => {
|
|
@@ -1492,7 +1417,7 @@ export default {
|
|
|
if (this.photoConfig) {
|
|
|
return;
|
|
|
}
|
|
|
- let totalVideoTime = this.refPlv.getDuration()
|
|
|
+ let totalVideoTime = this.refPlv.getDuration();
|
|
|
this.photoConfig = true;
|
|
|
if (this.erJianErZao) {
|
|
|
this.photoList = this.randomConfig(totalVideoTime, duration);
|
|
@@ -1500,12 +1425,14 @@ export default {
|
|
|
}
|
|
|
//没有历史拍照间隔数据
|
|
|
if (!this.photoList || this.photoList.length == 0) {
|
|
|
+ // 46 * 60
|
|
|
this.photoList = this.commonConfig(
|
|
|
totalVideoTime,
|
|
|
- this.jjShiGongYuan ? 46 * 60 : undefined
|
|
|
+ this.jjShiGongYuan ? 10 : undefined
|
|
|
);
|
|
|
- this.postCoursePhotoRecord(); //提交随机拍照时间数组
|
|
|
+ this.postCoursePhotoRecord(true); //提交随机拍照时间数组
|
|
|
}
|
|
|
+ console.log(this.photoList, "this.photoList");
|
|
|
},
|
|
|
// 二建随机拍摄时间
|
|
|
randomConfig(totalVideoTime, duration) {
|
|
@@ -1590,7 +1517,6 @@ export default {
|
|
|
this.recordObj = videoCurrentTime
|
|
|
? { videoCurrentTime }
|
|
|
: await this.getRecordLast(item);
|
|
|
- await this.getPhotoLastRecord();
|
|
|
// 查找拍照历史
|
|
|
if ((this.photoNum > 0 || this.jjShiGongYuan) && learning != 1) {
|
|
|
await this.getPhotoLastRecord();
|
|
@@ -1613,15 +1539,12 @@ export default {
|
|
|
let { chapterId, sectionId, courseId, moduleId } = sectionItem;
|
|
|
return new Promise((resolve) => {
|
|
|
let data = {
|
|
|
+ ...this.params(),
|
|
|
gradeId:
|
|
|
this.gradeId || this.gradeId == 0 ? Number(this.gradeId) : null,
|
|
|
- goodsId:
|
|
|
- this.goodsId || this.goodsId == 0 ? Number(this.goodsId) : null,
|
|
|
sectionId: sectionId || 0,
|
|
|
- courseId: courseId || courseId == 0 ? Number(courseId) : null,
|
|
|
chapterId: chapterId || 0,
|
|
|
moduleId: moduleId || 0,
|
|
|
- orderGoodsId: this.orderGoodsId,
|
|
|
};
|
|
|
this.$api.recordLast(data).then((res) => {
|
|
|
resolve(res.data.data);
|
|
@@ -1679,22 +1602,24 @@ export default {
|
|
|
}
|
|
|
let self = this;
|
|
|
let data = {
|
|
|
+ ...this.params(
|
|
|
+ "orderGoodsId",
|
|
|
+ "goodsId",
|
|
|
+ "courseId",
|
|
|
+ "erJianErZao",
|
|
|
+ "gradeId"
|
|
|
+ ),
|
|
|
fromPlat: 1, //来源平台 1小程序 2网站
|
|
|
photo: self.ossAvatarUrl,
|
|
|
sectionId: sectionId || 0,
|
|
|
- goodsId: parseInt(self.goodsId),
|
|
|
- courseId: parseInt(self.courseId),
|
|
|
- orderGoodsId: this.orderGoodsId,
|
|
|
studyDuration: parseInt(
|
|
|
PlayDuration > 0 ? PlayDuration : self.studyDuration
|
|
|
),
|
|
|
- gradeId: parseInt(self.gradeId),
|
|
|
chapterId: this.chapterId || 0,
|
|
|
moduleId: this.moduleId || 0,
|
|
|
videoCurrentTime: parseInt(
|
|
|
currentTime > 0 ? currentTime : self.studyDuration
|
|
|
),
|
|
|
- erJianErZao: this.erJianErZao,
|
|
|
};
|
|
|
if (this.ossAvatarUrl) {
|
|
|
data.similarity = this.compareFaceData; // 相似度
|
|
@@ -1751,12 +1676,12 @@ export default {
|
|
|
title: res.data.msg,
|
|
|
duration: 2000,
|
|
|
});
|
|
|
- if (this.erJianErZao && code == 559) {
|
|
|
+ if (!this.erJianErZao && code == 559) {
|
|
|
this.isReach = true;
|
|
|
- this.openPhoto();
|
|
|
+ this.$refs["camera"].reTake();
|
|
|
}
|
|
|
if (code == 559 || code == 588) {
|
|
|
- reject("中断执行");
|
|
|
+ reject(res.data.msg);
|
|
|
}
|
|
|
}
|
|
|
resolve();
|
|
@@ -1766,149 +1691,38 @@ export default {
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
- uploadFile(options, int) {
|
|
|
- var self = this;
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
- var data = {
|
|
|
- imageStatus: int,
|
|
|
- gradeId: this.gradeId,
|
|
|
- orderGoodsId: this.orderGoodsId,
|
|
|
- };
|
|
|
- self.$api.aliyunpolicy(data).then((res) => {
|
|
|
- if (res.data.code != 200) {
|
|
|
- self.$method.showToast("签名错误" + JSON.stringify(res.data));
|
|
|
- return;
|
|
|
- }
|
|
|
- var ossToken = res.data.data.resultContent;
|
|
|
- if (ossToken.host == null || ossToken.host == undefined) {
|
|
|
- self.$method.showToast("上传路径报错" + JSON.stringify(res.data));
|
|
|
- return;
|
|
|
- }
|
|
|
- let filePath = "";
|
|
|
- // #ifdef H5
|
|
|
- var localData = options; //dataUrl为base64位
|
|
|
- let base = atob(localData.substring(localData.indexOf(",") + 1)); // base是将base64编码解码,去掉data:image/png;base64部分
|
|
|
- let length = base.length;
|
|
|
- let url = new Uint8Array(length);
|
|
|
- while (length--) {
|
|
|
- url[length] = base.charCodeAt(length);
|
|
|
- }
|
|
|
- filePath = new File([url], "a.jpg", {
|
|
|
- type: "image/jpg",
|
|
|
- });
|
|
|
- uni.uploadFile({
|
|
|
- url: ossToken.host,
|
|
|
- name: "file",
|
|
|
- file: filePath,
|
|
|
- fileType: "image",
|
|
|
- header: {
|
|
|
- AuthorizationToken: "WX " + uni.getStorageSync("token"),
|
|
|
- },
|
|
|
- formData: {
|
|
|
- key: ossToken.dir,
|
|
|
- OSSAccessKeyId: ossToken.accessid,
|
|
|
- policy: ossToken.policy,
|
|
|
- Signature: ossToken.signature,
|
|
|
- callback: ossToken.callback,
|
|
|
- success_action_status: 200,
|
|
|
- },
|
|
|
- success: (result) => {
|
|
|
- this.$u.toast("上传成功");
|
|
|
- self.ossAvatarUrl = ossToken.dir;
|
|
|
- resolve(ossToken.dir);
|
|
|
- },
|
|
|
- fail: (error) => {
|
|
|
- uni.showToast({
|
|
|
- title: "上传接口报错,请重新拍照上传" + error,
|
|
|
- icon: "none",
|
|
|
- });
|
|
|
- this.openPhoto();
|
|
|
- return;
|
|
|
- },
|
|
|
- });
|
|
|
- // #endif
|
|
|
-
|
|
|
- // #ifdef MP-WEIXIN
|
|
|
- uni.uploadFile({
|
|
|
- url: ossToken.host,
|
|
|
- name: "file",
|
|
|
- filePath: options,
|
|
|
- fileType: "image",
|
|
|
- header: {
|
|
|
- AuthorizationToken: "WX " + uni.getStorageSync("token"),
|
|
|
- },
|
|
|
- formData: {
|
|
|
- key: ossToken.dir,
|
|
|
- OSSAccessKeyId: ossToken.accessid,
|
|
|
- policy: ossToken.policy,
|
|
|
- Signature: ossToken.signature,
|
|
|
- callback: ossToken.callback,
|
|
|
- success_action_status: 200,
|
|
|
- },
|
|
|
- success: (result) => {
|
|
|
- // if (result.statusCode === 200) {
|
|
|
- this.$u.toast("上传成功");
|
|
|
- self.ossAvatarUrl = ossToken.dir;
|
|
|
- resolve(ossToken.dir);
|
|
|
- },
|
|
|
- fail: (error) => {
|
|
|
- uni.showToast({
|
|
|
- title: "上传接口报错,请重新拍照上传" + error,
|
|
|
- icon: "none",
|
|
|
- });
|
|
|
- this.openPhoto();
|
|
|
- return;
|
|
|
- },
|
|
|
- });
|
|
|
- // #endif
|
|
|
- });
|
|
|
- });
|
|
|
- },
|
|
|
- imageInfos() {
|
|
|
- var self = this;
|
|
|
- return new Promise(async (resolve, reject) => {
|
|
|
- let resPath = await myCompressImage(this.avatarUrl || this.faceUrl, 50);
|
|
|
- const waitUpload = await self.uploadFile(resPath, 0);
|
|
|
- resolve(waitUpload);
|
|
|
- });
|
|
|
- },
|
|
|
timeEvent(time) {
|
|
|
this.clearPauseTimer();
|
|
|
if (this.playSecIsLearn && (this.erJianErZao || this.photoNum > 0)) {
|
|
|
this.configPhoto(time);
|
|
|
this.isReach = false;
|
|
|
- const index = this.photoList.findIndex(
|
|
|
- (e) => e.photoTime < time && e.photoTime > time - 8
|
|
|
- );
|
|
|
+ const index = this.photoList.findIndex((e) => e < time && e > time - 8);
|
|
|
+ console.log(index, time, this.photoHistoryList, 789);
|
|
|
if (index != -1 && !this.photoHistoryList[index]) {
|
|
|
+ this.photoIndex = index;
|
|
|
// 拍照
|
|
|
this.openCamera();
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- closeToast() {
|
|
|
- clearTimeout(this.toastTimer);
|
|
|
- this.videoToastShow = false;
|
|
|
- },
|
|
|
// 新增用户视频学习日志
|
|
|
studyLog() {
|
|
|
this.$http({
|
|
|
url: "/user/study/log",
|
|
|
method: "post",
|
|
|
data: {
|
|
|
- goodsId: this.goodsId,
|
|
|
- courseId: this.courseId,
|
|
|
+ ...this.params(),
|
|
|
moduleId: this.moduleId || 0,
|
|
|
chapterId: this.chapterId || 0,
|
|
|
sectionId: this.playSectionId || 0,
|
|
|
fromPlat: 1, //来源平台 1小程序 2PC网站
|
|
|
goodsType: 1, // 商品类型 1视频2题库 3补考 4前培 5虚拟赠送题库 6直播
|
|
|
- orderGoodsId: this.orderGoodsId,
|
|
|
},
|
|
|
}).then((res) => {});
|
|
|
},
|
|
|
timeupdate(time) {
|
|
|
// console.log("播放中", time);
|
|
|
+ this.playTime = time;
|
|
|
this.clearPauseTimer();
|
|
|
this.timeEvent(time);
|
|
|
},
|
|
@@ -1918,7 +1732,6 @@ export default {
|
|
|
this.refPlv.playPause();
|
|
|
return;
|
|
|
}
|
|
|
- // this.$refs["camera"].openCamera();
|
|
|
this.studyLog();
|
|
|
if (!this.recordObj.videoCurrentTime) {
|
|
|
this.postStudyRecord(0);
|
|
@@ -1930,6 +1743,8 @@ export default {
|
|
|
},
|
|
|
openCamera() {
|
|
|
this.$refs["camera"].openCamera();
|
|
|
+ this.refPlv.playPause();
|
|
|
+ this.refPlv.exitFullScreen();
|
|
|
},
|
|
|
pause() {
|
|
|
this.erJianErZaoPauseTip();
|
|
@@ -2099,6 +1914,7 @@ export default {
|
|
|
let { data } = await this.$api.goodsDetail(this.goodsId);
|
|
|
this.goodsData = data.data;
|
|
|
this.erJianErZao = this.goodsData.erJianErZao;
|
|
|
+ this.jjShiGongYuan = this.goodsData.jjShiGongYuan;
|
|
|
this.erJianErZao && (await this.userConfirmInfoDetail());
|
|
|
this.option.periodWaitTime && (await this.checkFinishRequiredCourse());
|
|
|
this.goodsData.buyNote && this.baseHandoutTipList();
|
|
@@ -2149,7 +1965,6 @@ export default {
|
|
|
self.reMenuList = res.data.rows;
|
|
|
this.current = 0;
|
|
|
if (self.reMenuList.length > 0) {
|
|
|
- this.showNotes = false;
|
|
|
if (Object.keys(this.sectionItem).length) {
|
|
|
let playNextIdisRebuild = `moduleId${this.sectionItem.moduleId}chapterId${this.sectionItem.chapterId}sectionId${this.sectionItem.sectionId}isRebuild`;
|
|
|
this.$store.commit("updatePlayNextId", playNextIdisRebuild);
|
|
@@ -2176,14 +1991,6 @@ export default {
|
|
|
change(index) {
|
|
|
this.current = index;
|
|
|
},
|
|
|
- clears() {
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
- this.vid = "";
|
|
|
- polyvPlayerContext && polyvPlayerContext.destroy();
|
|
|
- polyvPlayerContext = null;
|
|
|
- resolve();
|
|
|
- });
|
|
|
- },
|
|
|
/**
|
|
|
* 退出全屏
|
|
|
*/
|
|
@@ -2209,6 +2016,16 @@ export default {
|
|
|
null
|
|
|
);
|
|
|
},
|
|
|
+ paramsFn(
|
|
|
+ keys = ["orderGoodsId", "goodsId", "courseId", "gradeId", "sectionItem"]
|
|
|
+ ) {
|
|
|
+ return this.params(keys);
|
|
|
+ },
|
|
|
+ },
|
|
|
+ provide() {
|
|
|
+ return {
|
|
|
+ paramsFn: this.paramsFn,
|
|
|
+ };
|
|
|
},
|
|
|
};
|
|
|
</script>
|