Commit 6276e71f authored by 范雪寒's avatar 范雪寒

feat: callMiddleLayerFunction - NS_login

parent 7d405dda
...@@ -83,22 +83,24 @@ cc.Class({ ...@@ -83,22 +83,24 @@ cc.Class({
uiNode.scale = scale; uiNode.scale = scale;
initAir(this); initAir(this);
// this.preloadAll(); // this.preloadAll();
this.role = 'student';
}, },
getBaseUrl(callback) { getBaseUrl(callback) {
if(window.air.engineInfo){ if (window.air.engineInfo) {
const {isDev} = JSON.parse(window.air.engineInfo); const { isDev } = JSON.parse(window.air.engineInfo);
if(isDev==1){ if (isDev == 1) {
callback('https://staging-teach.ireadabc.com'); callback('https://staging-teach.ireadabc.com');
}else{ } else {
callback('https://iteachabc.com'); callback('https://iteachabc.com');
} }
}else{ } else {
window.courseware.getEngineInfo(()=>{ window.courseware.getEngineInfo(() => {
const {isDev} = JSON.parse(window.air.engineInfo); const { isDev } = JSON.parse(window.air.engineInfo);
if(isDev==1){ if (isDev == 1) {
callback('https://staging-teach.ireadabc.com'); callback('https://staging-teach.ireadabc.com');
}else{ } else {
callback('https://iteachabc.com'); callback('https://iteachabc.com');
} }
}); });
...@@ -264,6 +266,40 @@ cc.Class({ ...@@ -264,6 +266,40 @@ cc.Class({
loadingProgress.getComponent(cc.ProgressBar).progress = this.loadedCount / this.preloadCount; loadingProgress.getComponent(cc.ProgressBar).progress = this.loadedCount / this.preloadCount;
}, },
onHomeworkFinish(callBack, data = null) {
console.log('this.courseIndex = ' + JSON.stringify(this.currentBundleInfo));
if (this.currentBundleInfo.sceneName == 'ls_fly') {
const rightCount = data.reduce((preValue, right) => {
if (right) {
return preValue + 1;
} else {
return preValue;
}
}, 0);
console.log('rightCount = ' + rightCount);
}
console.log('onHomeworkFinish: ' + JSON.stringify(data));
},
callMiddleLayerFunction(apiName, data, callback) {
switch (apiName) {
case 'NS_login':
if (data.userName == 'admin' && data.password == '123456') {
this.showLog('登陆成功!');
callback('登陆成功!');
// this.goNextPage();
// this.goPrePage();
} else {
this.showLog('密码错误!');
callback('密码错误!');
}
break;
default:
this.showLog('未定义接口: ' + apiName);
break;
}
},
asyncDelayLog(str) { asyncDelayLog(str) {
console.log(str); console.log(str);
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
...@@ -291,7 +327,7 @@ cc.Class({ ...@@ -291,7 +327,7 @@ cc.Class({
window.courseware.freeAllOcMethod(); window.courseware.freeAllOcMethod();
const flag = cc.director.loadScene("debug_shell", null, null, (err, scene) => { const flag = cc.director.loadScene("debug_shell", null, null, (err, scene) => {
}); });
if(!flag){ if (!flag) {
// 没有壳的情况下,直接加载中间层场景 // 没有壳的情况下,直接加载中间层场景
cc.director.loadScene("middleLayer_for_debug", null, null, (err, scene) => { cc.director.loadScene("middleLayer_for_debug", null, null, (err, scene) => {
}); });
...@@ -671,9 +707,9 @@ cc.Class({ ...@@ -671,9 +707,9 @@ cc.Class({
script.setProgress(changeObj.value); script.setProgress(changeObj.value);
}, 1); }, 1);
const changeObj = {value: 0}; const changeObj = { value: 0 };
cc.tween(changeObj) cc.tween(changeObj)
.to(5, {value: 0.9}) .to(5, { value: 0.9 })
.call(() => { .call(() => {
clearInterval(id); clearInterval(id);
}) })
...@@ -761,7 +797,7 @@ cc.Class({ ...@@ -761,7 +797,7 @@ cc.Class({
cc.director.loadScene("emptyScene", () => { cc.director.loadScene("emptyScene", () => {
this.callNativeFunction({ name: 'exit', value: '' }); this.callNativeFunction({ name: 'exit', value: '' });
}); });
}, },
getRainbowColorList() { getRainbowColorList() {
return [ return [
......
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