|
@@ -6,9 +6,9 @@
|
|
|
<view class="tag tagColor2" v-if="menuItem.sectionType==2">直播</view>
|
|
|
<view class="tag tagColor3" v-if="menuItem.sectionType==3">回放</view>
|
|
|
<view class="t_content">
|
|
|
- <view v-if="menuItem.sectionType==1" :class="playSectionId==newId && playNextId==playId?'color1':''">{{menuItem.name}}</view>
|
|
|
- <view v-if="menuItem.sectionType==2" :class="playSectionId==newId && playNextId==playId?'color2':''">{{menuItem.name}}</view>
|
|
|
- <view v-if="menuItem.sectionType==3" :class="playSectionId==newId && playNextId==playId?'color3':''">{{menuItem.name}}</view>
|
|
|
+ <view v-if="menuItem.sectionType==1" :class="playSectionId==newId && playNextId==playId?'color1':''">{{menuItem.name || ''}}</view>
|
|
|
+ <view v-if="menuItem.sectionType==2" :class="playSectionId==newId && playNextId==playId?'color2':''">{{menuItem.name || ''}}</view>
|
|
|
+ <view v-if="menuItem.sectionType==3" :class="playSectionId==newId && playNextId==playId?'color3':''">{{menuItem.name || ''}}</view>
|
|
|
<view style="font-size: 20rpx;color: #FF3B30;" v-if="menuItem.sectionType==2 && menuItem.liveStartTime">
|
|
|
<view v-if="menuItem.liveStartTime>nowTime">
|
|
|
<text>{{$method.timestampToTime(menuItem.liveStartTime, isDay =false)}}</text>-
|
|
@@ -22,7 +22,7 @@
|
|
|
</view> -->
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view v-if="menuItem.sectionType==null">{{menuItem.name}}</view>
|
|
|
+ <view v-if="menuItem.sectionType==null">{{menuItem.name || ''}}</view>
|
|
|
</view>
|
|
|
<view style="font-size: 20rpx;color: #FF3B30;" v-if="menuItem.liveStartTime && menuItem.sectionType != 3">
|
|
|
<view class="tagWillPlay" v-if="menuItem.liveStartTime>nowTime">
|
|
@@ -92,6 +92,9 @@ export default {
|
|
|
type: Object,
|
|
|
default: {}
|
|
|
},
|
|
|
+ sectionMaxNum:{
|
|
|
+ default:undefined,
|
|
|
+ },
|
|
|
},
|
|
|
watch:{
|
|
|
menuItem(val) {
|
|
@@ -106,7 +109,8 @@ export default {
|
|
|
clickLock:false, //点击锁,防止连续点击多次
|
|
|
};
|
|
|
},
|
|
|
- onLoad() {},
|
|
|
+ onLoad() {
|
|
|
+ },
|
|
|
created() {
|
|
|
|
|
|
},
|
|
@@ -166,59 +170,123 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
methods: {
|
|
|
- getVideo(){
|
|
|
+ studyRecordMenuAllList() {
|
|
|
+ return new Promise(resolve => {
|
|
|
+
|
|
|
+ this.$api.studyRecordMenuAllList({
|
|
|
+ courseId:this.courseId,
|
|
|
+ gradeId:this.gradeId,
|
|
|
+ goodsId:this.goodsId
|
|
|
+ }).then(res => {
|
|
|
+ if(res.data.code == 200) {
|
|
|
+ resolve(res.data.data)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ goodsTodayStudySectionNum() {
|
|
|
+ return new Promise(resolve => {
|
|
|
+ this.$api.goodsTodayStudySectionNum({goodsId:this.goodsId,gradeId:this.gradeId}).then(res => {
|
|
|
+ if(res.data.code == 200) {
|
|
|
+ resolve(res.data.data)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ async getVideo(){
|
|
|
if(this.clickLock) {
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
this.clickLock = true;
|
|
|
console.log(this.learningOrder,'this.learningOrder')
|
|
|
console.log(this.preItem,'this.preItem')
|
|
|
- if(this.learningOrder == 2 && !this.isRebuild) { //要按从头到尾顺序学习, 且不是重修课程
|
|
|
+ // let learnNum = await this.goodsTodayStudySectionNum()
|
|
|
+
|
|
|
+ // if(this.sectionMaxNum > 0) {
|
|
|
+ // if(learnNum >= this.sectionMaxNum) {
|
|
|
+ // uni.showToast({
|
|
|
+ // icon:'none',
|
|
|
+ // title:`每天最多学习${this.sectionMaxNum}节`
|
|
|
+ // })
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ if(this.learningOrder == 2 && !this.menuItem.isRebuild) { //要按从头到尾顺序学习, 且不是重修课程
|
|
|
if(this.preItem) {
|
|
|
- if(this.preItem.menuType == 3) { //上一个是节
|
|
|
- if(this.preItem.learning == 1) { //上一节学完
|
|
|
- this.playVideo();
|
|
|
+ let rows = await this.studyRecordMenuAllList();
|
|
|
+ let newRows = [];
|
|
|
+ for(let i = 0; i < rows.length; i++ ) {
|
|
|
+ let moduleTrue = (rows[i].moduleId == this.menuItem.menuId) || (rows[i].moduleId == this.menuItem.moduleId)
|
|
|
+ let chapterTrue = rows[i].chapterId == this.menuItem.chapterId;
|
|
|
+ let sectionTrue = rows[i].sectionId == this.menuItem.sectionId;
|
|
|
+ if(moduleTrue && chapterTrue && sectionTrue) {
|
|
|
+ break;
|
|
|
} else {
|
|
|
- uni.showToast({
|
|
|
- icon:'none',
|
|
|
- title:'请按顺序学习视频课程'
|
|
|
- })
|
|
|
- }
|
|
|
- } else if(this.preItem.menuType == 2) { //上一个是章
|
|
|
- this.$api.reSectionList({chapterId: this.preItem.menuId || this.preItem.chapterId,gradeId:this.gradeId,courseId:this.courseId,moduleId:this.preItem.moduleId || 0}).then(res => {
|
|
|
- if(res.data.code==200){
|
|
|
- let lastItem = res.data.data[res.data.data.length -1];
|
|
|
- if(lastItem.learning == 1) {
|
|
|
- this.playVideo();
|
|
|
- } else {
|
|
|
- uni.showToast({
|
|
|
- icon:'none',
|
|
|
- title:'请按顺序学习视频课程'
|
|
|
- })
|
|
|
- }
|
|
|
+ if(rows[i].sectionType != 2) {
|
|
|
+ newRows.push(rows[i])
|
|
|
}
|
|
|
- });
|
|
|
- } else if(this.preItem.menuType == 1) { //上一个是模块
|
|
|
- this.$api.reChapterList({moduleId:this.preItem.menuId,gradeId:this.gradeId,courseId:this.courseId}).then(res => {
|
|
|
- if(res.data.code==200){
|
|
|
- let lastChapterItem = res.data.data[res.data.data.length -1];
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log(newRows)
|
|
|
+ let isAllLearn = newRows.every(item => {
|
|
|
+ return item.studyStatus == 1;
|
|
|
+ })
|
|
|
+
|
|
|
+ if(isAllLearn) {
|
|
|
+ this.playVideo();
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ icon:'none',
|
|
|
+ title:'请按顺序学习视频课程'
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ // if(this.preItem.menuType == 3) { //上一个是节
|
|
|
+ // if(this.preItem.learning == 1) { //上一节学完
|
|
|
+ // this.playVideo();
|
|
|
+ // } else {
|
|
|
+ // uni.showToast({
|
|
|
+ // icon:'none',
|
|
|
+ // title:'请按顺序学习视频课程'
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // } else if(this.preItem.menuType == 2) { //上一个是章
|
|
|
+ // this.$api.reSectionList({chapterId: this.preItem.menuId || this.preItem.chapterId,gradeId:this.gradeId,courseId:this.courseId,moduleId:this.preItem.moduleId || 0}).then(res => {
|
|
|
+ // if(res.data.code==200){
|
|
|
+ // let lastItem = res.data.data[res.data.data.length -1];
|
|
|
+ // if(lastItem.learning == 1) {
|
|
|
+ // this.playVideo();
|
|
|
+ // } else {
|
|
|
+ // uni.showToast({
|
|
|
+ // icon:'none',
|
|
|
+ // title:'请按顺序学习视频课程'
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // } else if(this.preItem.menuType == 1) { //上一个是模块
|
|
|
+ // this.$api.reChapterList({moduleId:this.preItem.menuId,gradeId:this.gradeId,courseId:this.courseId}).then(res => {
|
|
|
+ // if(res.data.code==200){
|
|
|
+ // let lastChapterItem = res.data.data[res.data.data.length -1];
|
|
|
|
|
|
- this.$api.reSectionList({chapterId:lastChapterItem.chapterId,gradeId:this.gradeId,courseId:this.courseId,moduleId:this.menuItem.menuId || this.menuItem.moduleId}).then(res => {
|
|
|
- if(res.data.code==200){
|
|
|
- let lastSectionItem = res.data.data[res.data.data.length -1];
|
|
|
- if(lastSectionItem.learning == 1) {
|
|
|
- this.playVideo();
|
|
|
- } else {
|
|
|
- uni.showToast({
|
|
|
- icon:'none',
|
|
|
- title:'请按顺序学习视频课程'
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+ // this.$api.reSectionList({chapterId:lastChapterItem.chapterId,gradeId:this.gradeId,courseId:this.courseId,moduleId:this.menuItem.menuId || this.menuItem.moduleId}).then(res => {
|
|
|
+ // if(res.data.code==200){
|
|
|
+ // let lastSectionItem = res.data.data[res.data.data.length -1];
|
|
|
+ // if(lastSectionItem.learning == 1) {
|
|
|
+ // this.playVideo();
|
|
|
+ // } else {
|
|
|
+ // uni.showToast({
|
|
|
+ // icon:'none',
|
|
|
+ // title:'请按顺序学习视频课程'
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // }
|
|
|
} else { //第一章第一节
|
|
|
this.playVideo();
|
|
|
}
|