Commit 37b9eedc authored by liujiangnan's avatar liujiangnan

feat: 解锁下一关的逻辑

parent 5ab0ff43
...@@ -231,37 +231,39 @@ export default class NewClass extends middleLayerBase { ...@@ -231,37 +231,39 @@ export default class NewClass extends middleLayerBase {
// 覆盖关系 // 覆盖关系
this.golds.total -= this.golds[this.courseItem.id]; this.golds.total -= this.golds[this.courseItem.id];
} }
// 上报金币成绩
this.golds[this.courseItem.id] = gold; this.golds[this.courseItem.id] = gold;
this.golds.total += gold; this.golds.total += gold;
} }
goNextPage() { goNextPage() {
if (this.courseIndex<this.courses.length-1) { if (this.courseIndex < this.courses.length-1) {
this.goTarIndexPage(this.courseIndex + 1); // 单页完成的庆祝画面
return; this.showGold(() => {
} this.goTarIndexPage(this.courseIndex + 1);
// 庆祝画面 });
if (this.courseIndex < this.courses.length){
this.showFinish();
} else {
this.showAllFinish()
} }
if (this.courseIndex >= this.courses.length){
const lastCurse = this.crossArray[this.crossArray.length-1];
if (this.courseItem.course_id != lastCurse.id) {
// 课件完成的庆祝画面
this.showFinish();
// 上报解锁下一关
const currentIndex = this.crossArray.findIndex(item => item.id == this.courseItem.course_id);
const nextCourse = this.crossArray[currentIndex + 1];
this.unlockNext(nextCourse.id);
} else {
// 所有课件都完成的庆祝动画
this.showAllFinish();
}
}
} }
crossArray = []; // 关卡数组 crossArray = []; // 关卡数组
goNextCross() { goNextCross() {
const currentid = this.courseItem.course_id; const currentid = this.courseItem.course_id;
let currentIndex = null; const currentIndex = this.crossArray.findIndex(item => item.id == this.courseItem.course_id);
for (let i = 0; i < this.crossArray.length; i++) { if (currentIndex!=-1 && this.crossArray[currentIndex+1]) {
const item = this.crossArray[i];
if (item.id == currentid) {
currentIndex = i;
break;
}
}
if (currentIndex!=null && this.crossArray[currentIndex+1]) {
this.loadOnlineCourseWare(this.crossArray[currentIndex+1].id, null, null); this.loadOnlineCourseWare(this.crossArray[currentIndex+1].id, null, null);
} else { } else {
this.showTips(`已经是最后一关了`); this.showTips(`已经是最后一关了`);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment