Commit 512734ce authored by huoshizhe's avatar huoshizhe

feat: getData

parent 73ef6105
......@@ -4,7 +4,13 @@ cc.Class({
getData(callBack) {
const uri = 'courseware/v1/getdata';
const syllabus_id = this.bundleInfoList[this.currentBundleIndex].syllabus_id;
let syllabus_id;
if (this.bundleType == 'StoryBox') {
syllabus_id = this.syllabus_id;
} else if (this.bundleType == 'WW') {
syllabus_id = this.bundleInfoList[this.currentBundleIndex].syllabus_id;
}
const data = {
courseid: syllabus_id
};
......@@ -91,11 +97,11 @@ cc.Class({
// })
// }, 20000);
// this.baseUrl = 'http://staging-teach.ireadabc.com/api/';
// this.initStoryBoxView({
// coursewareId: 18307
// });
// this.bundleType = 'StoryBox';
this.baseUrl = 'http://staging-teach.ireadabc.com/api/';
this.initStoryBoxView({
coursewareId: 18307
});
this.bundleType = 'StoryBox';
this.log('汪汪汪');
},
......@@ -163,6 +169,7 @@ cc.Class({
return;
}
this.syllabus_id = defaultBondle.children[0].id;
this.loadBundleByConf(defaultBondle.children[0].conf, () => {
const ExitBtn = cc.find('middleLayer/storyBox/ExitBtn');
ExitBtn.active = true;
......@@ -263,14 +270,8 @@ cc.Class({
btnSelected.on('click', () => {
this.hideMenu();
if (cc.sys.isNative && cc.sys.os == cc.sys.OS_IOS) {
this.loadBundle(data.children[0].conf.ios);
} else if (cc.sys.isNative && cc.sys.os == cc.sys.OS_ANDROID) {
this.loadBundle(data.children[0].conf.android);
} else {
this.loadBundle(data.children[0].conf.web_desktop);
console.error('非源生环境');
}
this.syllabus_id = data.children[0].id;
this.loadBundleByConf(data.children[0].conf);
});
if (data.has_child == '1') {
......@@ -290,6 +291,7 @@ cc.Class({
.to(0.1, { scale: 1.00 })
.call(() => {
this.hideMenu();
this.syllabus_id = menuData.children[0].id;
this.loadBundleByConf(menuData.children[0].conf);
})
.start();
......@@ -492,37 +494,37 @@ cc.Class({
}
this.jumpToBundleByIndex(this.currentBundleIndex + 1);
});
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.on('click', () => {
btnClose.active = true;
btnOpen.active = false;
consoleNode.active = true;
consoleBg.active = true;
});
btnClose.on('click', () => {
btnClose.active = false;
btnOpen.active = true;
consoleNode.active = false;
consoleBg.active = false;
});
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.on('click', () => {
btnClose.active = true;
btnOpen.active = false;
consoleNode.active = true;
consoleBg.active = true;
});
btnClose.on('click', () => {
btnClose.active = false;
btnOpen.active = true;
consoleNode.active = false;
consoleBg.active = false;
});
},
log(str) {
const logStr = `${new Date().toLocaleString()}: ${str}`;
console.log(logStr);
const content = cc.instantiate(cc.find('middleLayer/ConsoleNode/content'));
content.active = true;
const label = content.getChildByName('label');
label.getComponent(cc.Label).string = logStr;
const consoleContent = cc.find('middleLayer/ConsoleNode/Console/content');
consoleContent.addChild(content);
consoleContent.getComponent(cc.Layout).updateLayout();
},
log(str) {
const logStr = `${new Date().toLocaleString()}: ${str}`;
console.log(logStr);
const content = cc.instantiate(cc.find('middleLayer/ConsoleNode/content'));
content.active = true;
const label = content.getChildByName('label');
label.getComponent(cc.Label).string = logStr;
const consoleContent = cc.find('middleLayer/ConsoleNode/Console/content');
consoleContent.addChild(content);
consoleContent.getComponent(cc.Layout).updateLayout();
},
callNativeFunction(param) {
const paramStr = JSON.stringify(param);
......
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