Commit 37b9eedc authored by liujiangnan's avatar liujiangnan

feat: 解锁下一关的逻辑

parent 5ab0ff43
......@@ -231,37 +231,39 @@ export default class NewClass extends middleLayerBase {
// 覆盖关系
this.golds.total -= this.golds[this.courseItem.id];
}
// 上报金币成绩
this.golds[this.courseItem.id] = gold;
this.golds.total += gold;
}
goNextPage() {
if (this.courseIndex<this.courses.length-1) {
if (this.courseIndex < this.courses.length-1) {
// 单页完成的庆祝画面
this.showGold(() => {
this.goTarIndexPage(this.courseIndex + 1);
return;
});
}
// 庆祝画面
if (this.courseIndex < this.courses.length){
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()
// 所有课件都完成的庆祝动画
this.showAllFinish();
}
}
}
crossArray = []; // 关卡数组
goNextCross() {
const currentid = this.courseItem.course_id;
let currentIndex = null;
for (let i = 0; i < this.crossArray.length; i++) {
const item = this.crossArray[i];
if (item.id == currentid) {
currentIndex = i;
break;
}
}
if (currentIndex!=null && this.crossArray[currentIndex+1]) {
const currentIndex = this.crossArray.findIndex(item => item.id == this.courseItem.course_id);
if (currentIndex!=-1 && this.crossArray[currentIndex+1]) {
this.loadOnlineCourseWare(this.crossArray[currentIndex+1].id, null, null);
} else {
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