Commit 28ce1ee7 authored by 范雪寒's avatar 范雪寒

feat:

parent 666ecc6d
......@@ -81,7 +81,7 @@ cc.Class({
initAir(this);
this.reWriteAir();
window.courseware.getEngineInfo((dataStr)=>{
window.courseware.getEngineInfo((dataStr) => {
const engineInfo = JSON.parse(dataStr);
console.log(engineInfo.isDev);
let coursewareId;
......@@ -89,7 +89,7 @@ cc.Class({
coursewareId = 21506;
this.baseUrl = "http://staging-openapi.iteachabc.com/api/";
} else {
console.waring('汪汪汪');
console.waring("汪汪汪");
coursewareId = 21506;
this.baseUrl = "http://openapi.iteachabc.com/api/";
}
......@@ -101,11 +101,11 @@ cc.Class({
this.initListener();
window.g = null;
this.getBundleInfoList(coursewareId);
});
},
reWriteAir() {
window.courseware.getData = (callback) => {
let data = null;
......@@ -114,26 +114,36 @@ cc.Class({
}
this.log("===成功调用getData===" + this.courseItem.data);
callback && callback(data);
}
};
window.courseware.nextPage = () => {
this.goNextPage();
}
};
window.courseware.beforePage = () => {
this.goPrePage();
}
};
window.courseware.sendAnswer = (answerObj) => {
this.log("===成功调用sendAnswer===" + JSON.stringify(answerObj));
this.callNetworkApiPost(`http://staging-teach.ireadabc.com`, `/api/oxford/courseware/v1/${this.courseItem.id}/saveanswer`, answerObj, (data) => {
this.callNetworkApiPost(
`http://staging-teach.ireadabc.com`,
`/api/oxford/courseware/v1/${this.courseItem.id}/saveanswer`,
answerObj,
(data) => {
answerObj.callback && answerObj.callback(JSON.stringify(data.row));
});
}
);
};
window.courseware.getAnswer = (queryObj, callback) => {
this.log("===成功调用getAnswer===" + JSON.stringify(queryObj));
this.callNetworkApiGet(`http://staging-teach.ireadabc.com`, `/api/oxford/courseware/v1/${this.courseItem.id}/getanswer`, queryObj, (datastr) => {
this.callNetworkApiGet(
`http://staging-teach.ireadabc.com`,
`/api/oxford/courseware/v1/${this.courseItem.id}/getanswer`,
queryObj,
(datastr) => {
const data = JSON.parse(datastr);
callback && callback(JSON.stringify(data.rows));
});
}
);
};
},
asyncDelayLog(str) {
......@@ -196,6 +206,7 @@ cc.Class({
initListener() {
const exitBtn = this.node.getChildByName("ExitBtn");
exitBtn.off("click");
exitBtn.on("click", () => {
cc.tween(exitBtn)
.to(0.1, { scaleX: 0.9, scaleY: 1.1 })
......@@ -208,25 +219,51 @@ cc.Class({
});
const btnLeft = this.node.getChildByName("BtnLeft");
btnLeft.off("click");
btnLeft.on("click", () => {
if (btnLeft.cantClick) {
return;
}
btnLeft.cantClick = true;
cc.tween(btnLeft)
.to(0.1, { scale: 1.1 })
.to(0.1, { scale: 1.0 })
.call(() => {
btnLeft.cantClick = false;
if (this.currentBundleIndex - 1 < 0) {
return;
}
this.jumpToBundleByIndex(this.currentBundleIndex - 1);
})
.start();
});
const btnRight = this.node.getChildByName("BtnRight");
btnRight.off("click");
btnRight.on("click", () => {
if (btnRight.cantClick) {
return;
}
btnRight.cantClick = true;
cc.tween(btnRight)
.to(0.1, { scale: -1.1 })
.to(0.1, { scale: -1.0 })
.call(() => {
btnRight.cantClick = false;
if (this.currentBundleIndex + 1 >= this.bundleInfoList.length) {
return;
}
console.log("btnRight clicked");
this.jumpToBundleByIndex(this.currentBundleIndex + 1);
})
.start();
});
const btnClose = cc.find("middleLayer/ConsoleNode/BtnClose");
const btnOpen = cc.find("middleLayer/ConsoleNode/BtnOpen");
const consoleNode = cc.find("middleLayer/ConsoleNode/Console");
const consoleBg = cc.find("middleLayer/ConsoleNode/bg");
btnOpen.off("click");
btnOpen.on("click", () => {
btnClose.active = true;
btnOpen.active = false;
......@@ -234,6 +271,7 @@ cc.Class({
consoleBg.active = true;
});
btnClose.off("click");
btnClose.on("click", () => {
btnClose.active = false;
btnOpen.active = true;
......
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