Commit b1602877 authored by 范雪寒's avatar 范雪寒
parents dfbda67a 0b4eaa59
...@@ -5,9 +5,9 @@ cc.Class({ ...@@ -5,9 +5,9 @@ cc.Class({
properties: { properties: {
}, },
callNetworkApiPost(uri, data, callBack) { callNetworkApiPost(baseUrl, uri, data, callBack) {
const xhr = new XMLHttpRequest(); const xhr = new XMLHttpRequest();
const url = `${this.baseUrl}${uri}`; const url = `${baseUrl}${uri}`;
xhr.open("POST", url, true); xhr.open("POST", url, true);
xhr.setRequestHeader('content-type', 'application/json'); xhr.setRequestHeader('content-type', 'application/json');
xhr.onreadystatechange = () => { xhr.onreadystatechange = () => {
...@@ -48,13 +48,13 @@ cc.Class({ ...@@ -48,13 +48,13 @@ cc.Class({
this.preloadCount = 0; this.preloadCount = 0;
this.loadedCount = 0; this.loadedCount = 0;
initAir(this); initAir(this);
if (!window.preloadBundleAndSourcesFlag) { // if(!window.preloadBundleAndSourcesFlag){
// 只加载一次就行了 // // 只加载一次就行了
window.preloadBundleAndSourcesFlag = true; // window.preloadBundleAndSourcesFlag = true;
cc.find("middleLayer/ui/ProgressLabel").active = true; // cc.find("middleLayer/ui/ProgressLabel").active = true;
this.preloadBundle(); // this.preloadBundle();
this.preloadSource(); // this.preloadSource();
} // }
}, },
start() { start() {
...@@ -393,6 +393,7 @@ cc.Class({ ...@@ -393,6 +393,7 @@ cc.Class({
this.loadBundle(sceneName, version, bondleUrl); this.loadBundle(sceneName, version, bondleUrl);
}, },
loadBundle(sceneName, version, bondleUrl) { loadBundle(sceneName, version, bondleUrl) {
cc.find('middleLayer/ExitBtn').active = true;
cc.assetManager.loadBundle(bondleUrl, { version: version }, async (err, bundle) => { cc.assetManager.loadBundle(bondleUrl, { version: version }, async (err, bundle) => {
if (err) { if (err) {
return this.asyncDelayLog(err); return this.asyncDelayLog(err);
...@@ -423,10 +424,15 @@ cc.Class({ ...@@ -423,10 +424,15 @@ cc.Class({
this.goPrePage(); this.goPrePage();
} }
window.courseware.sendAnswer = (answerObj) => { window.courseware.sendAnswer = (answerObj) => {
// TODO 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 = (answerObj) => { window.courseware.getAnswer = (queryObj, callback) => {
// TODO 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));
});
} }
}, },
......
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