Commit 14cec8da authored by 李维's avatar 李维

修复最后一题跳转错误的问题

parent 0503c238
...@@ -1687,6 +1687,8 @@ ...@@ -1687,6 +1687,8 @@
"__id__": 15 "__id__": 15
}, },
"_enabled": true, "_enabled": true,
"setTimeoutIDs": [],
"setIntervalIDs": [],
"_id": "42XWQfk9tE94NY0efe9K5z" "_id": "42XWQfk9tE94NY0efe9K5z"
}, },
{ {
......
...@@ -448,10 +448,8 @@ cc.Class({ ...@@ -448,10 +448,8 @@ cc.Class({
console.log("preloadArr: ", JSON.stringify(preloadArr)); console.log("preloadArr: ", JSON.stringify(preloadArr));
cc.assetManager.loadAny(preloadArr, null, null, (err, data) => { cc.assetManager.loadAny(preloadArr, null, null, (err, data) => {
// console.log(' preload data, ', data); // console.log(' preload data, ', data);
// this.loadEnd(); // this.loadEnd();
this.addServerListener(); this.addServerListener();
if (window && window["air"]) { if (window && window["air"]) {
window["air"].hideAirClassLoading(); window["air"].hideAirClassLoading();
} }
...@@ -550,10 +548,8 @@ cc.Class({ ...@@ -550,10 +548,8 @@ cc.Class({
// return; // return;
console.log(" in getState 1"); console.log(" in getState 1");
callMiddleLayerFunction("PSQS_get_course_info", {}, (data) => { callMiddleLayerFunction("PSQS_get_course_info", {}, (data) => {
console.log("PSQS_get_course_info",data.first, data.last, data.playTime, JSON.stringify(data.saveData)); console.log("PSQS_get_course_info",data.first, data.last, data.playTime, JSON.stringify(data.saveData));
this.isFirst = data.first; //this.checkIsFirst(); this.isFirst = data.first; //this.checkIsFirst();
this.isLast = data.last // this.checkIsLast(); this.isLast = data.last // this.checkIsLast();
this.playTimes = data.playTime// this.checkPlayTimes(); this.playTimes = data.playTime// this.checkPlayTimes();
...@@ -585,7 +581,7 @@ cc.Class({ ...@@ -585,7 +581,7 @@ cc.Class({
}, },
getJumpData() { getJumpData() {
return {step: 1}; return {step: 7};
}, },
maskSpr: null, maskSpr: null,
...@@ -694,9 +690,8 @@ cc.Class({ ...@@ -694,9 +690,8 @@ cc.Class({
addServerListener() { addServerListener() {
console.log(" in addServerListener"); console.log(" in addServerListener");
const c = window.courseware;
// this.loadEnd(()=>{}); // this.loadEnd(()=>{});
const c = window.courseware;
if (!c) { if (!c) {
return; return;
} }
...@@ -1053,7 +1048,7 @@ cc.Class({ ...@@ -1053,7 +1048,7 @@ cc.Class({
}, },
startQuesVideo(currentTime = null) { startQuesVideo(currentTime = null) {
console.log(" in startQuesVideo"); console.log("in startQuesVideo", currentTime);
this.wrongTimes = 0; this.wrongTimes = 0;
const video = this.video; const video = this.video;
...@@ -1073,6 +1068,11 @@ cc.Class({ ...@@ -1073,6 +1068,11 @@ cc.Class({
} }
} }
// 如果是最后一题
if(this.isTheEndVideo) {
this.curEndTime = -1;
}
delayCall(0.01, () => { delayCall(0.01, () => {
video.play(); video.play();
this.videoControlBar.emit("update_video_status", 1); this.videoControlBar.emit("update_video_status", 1);
...@@ -1081,7 +1081,7 @@ cc.Class({ ...@@ -1081,7 +1081,7 @@ cc.Class({
isWaitingUserAction: false, isWaitingUserAction: false,
startWaitVideo() { startWaitVideo() {
console.log(" in startWaitVideo "); console.log("in startWaitVideo");
this.isWaitingUserAction = true; this.isWaitingUserAction = true;
this.curQues.hotZoneBg.active = true; this.curQues.hotZoneBg.active = true;
this.hand.active = true; this.hand.active = true;
...@@ -1137,7 +1137,7 @@ cc.Class({ ...@@ -1137,7 +1137,7 @@ cc.Class({
}, },
startRightVideo() { startRightVideo() {
console.log(" in startRightVideo "); console.log("in startRightVideo");
// const videoNode = this.curQues?.videoObj?.right_video; // const videoNode = this.curQues?.videoObj?.right_video;
// const video = videoNode.getComponent(cc.VideoPlayer); // const video = videoNode.getComponent(cc.VideoPlayer);
...@@ -1159,7 +1159,7 @@ cc.Class({ ...@@ -1159,7 +1159,7 @@ cc.Class({
}, },
startWrongVideo() { startWrongVideo() {
console.log(" in startWrongVideo "); console.log("in startWrongVideo");
// const videoNode = this.curQues?.videoObj?.wrong_video; // const videoNode = this.curQues?.videoObj?.wrong_video;
// const video = videoNode.getComponent(cc.VideoPlayer); // const video = videoNode.getComponent(cc.VideoPlayer);
...@@ -1187,7 +1187,7 @@ cc.Class({ ...@@ -1187,7 +1187,7 @@ cc.Class({
}, },
startEndVideo() { startEndVideo() {
console.log(" in startEndVideo "); console.log("in startEndVideo");
// const videoNode = this.curQues?.videoObj?.end_video; // const videoNode = this.curQues?.videoObj?.end_video;
// const video = videoNode.getComponent(cc.VideoPlayer); // const video = videoNode.getComponent(cc.VideoPlayer);
...@@ -1225,11 +1225,12 @@ cc.Class({ ...@@ -1225,11 +1225,12 @@ cc.Class({
}, },
initCurQues() { initCurQues() {
if(this.quesIndex >=0) { if(this.quesIndex >= 0) {
this.curQues = this.data.quesArr[this.quesIndex]; this.curQues = this.data.quesArr[this.quesIndex];
console.log("curQues: ", this.curQues); console.log("curQues: ", this.curQues);
} else { } else {
console.log('题目序号不能为负数'); this.curQues = this.data.quesArr[this.data.quesArr.length-1];
console.log('题目序号为负 - 跳转到最后一段音频');
} }
}, },
...@@ -1363,6 +1364,7 @@ cc.Class({ ...@@ -1363,6 +1364,7 @@ cc.Class({
this.startQuesVideo(this.jumpTime); this.startQuesVideo(this.jumpTime);
}, },
isTheEndVideo: false,
setJumpTime() { setJumpTime() {
let isFind = false; let isFind = false;
for (let i = 0; i < this.data.quesArr.length; i++) { for (let i = 0; i < this.data.quesArr.length; i++) {
...@@ -1377,8 +1379,10 @@ cc.Class({ ...@@ -1377,8 +1379,10 @@ cc.Class({
} }
if (!isFind) { if (!isFind) {
// 没有找到就是最后一题
const lastQuesData = this.data.quesArr[this.data.quesArr.length - 1]; const lastQuesData = this.data.quesArr[this.data.quesArr.length - 1];
this.jumpTime = lastQuesData.ques_end; this.jumpTime = lastQuesData.ques_end;
this.isTheEndVideo = true;
} }
}, },
...@@ -1386,7 +1390,6 @@ cc.Class({ ...@@ -1386,7 +1390,6 @@ cc.Class({
if (this.playTimes == 0) { if (this.playTimes == 0) {
return; return;
} }
switch (this.video.node.name) { switch (this.video.node.name) {
case "ques_video": case "ques_video":
this.startWaitVideo(); this.startWaitVideo();
...@@ -2925,7 +2928,6 @@ cc.Class({ ...@@ -2925,7 +2928,6 @@ cc.Class({
console.log("clicked"); console.log("clicked");
this.video.pause(); this.video.pause();
this.videoControlBar.emit("update_video_status", 0); this.videoControlBar.emit("update_video_status", 0);
this.curQues.isRight = isRight; this.curQues.isRight = isRight;
if (isRight) { if (isRight) {
this.startRightVideo(); this.startRightVideo();
......
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