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

feat:

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