Commit 512734ce authored by huoshizhe's avatar huoshizhe

feat: getData

parent 73ef6105
...@@ -4,7 +4,13 @@ cc.Class({ ...@@ -4,7 +4,13 @@ cc.Class({
getData(callBack) { getData(callBack) {
const uri = 'courseware/v1/getdata'; 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 = { const data = {
courseid: syllabus_id courseid: syllabus_id
}; };
...@@ -91,11 +97,11 @@ cc.Class({ ...@@ -91,11 +97,11 @@ cc.Class({
// }) // })
// }, 20000); // }, 20000);
// this.baseUrl = 'http://staging-teach.ireadabc.com/api/'; this.baseUrl = 'http://staging-teach.ireadabc.com/api/';
// this.initStoryBoxView({ this.initStoryBoxView({
// coursewareId: 18307 coursewareId: 18307
// }); });
// this.bundleType = 'StoryBox'; this.bundleType = 'StoryBox';
this.log('汪汪汪'); this.log('汪汪汪');
}, },
...@@ -163,6 +169,7 @@ cc.Class({ ...@@ -163,6 +169,7 @@ cc.Class({
return; return;
} }
this.syllabus_id = defaultBondle.children[0].id;
this.loadBundleByConf(defaultBondle.children[0].conf, () => { this.loadBundleByConf(defaultBondle.children[0].conf, () => {
const ExitBtn = cc.find('middleLayer/storyBox/ExitBtn'); const ExitBtn = cc.find('middleLayer/storyBox/ExitBtn');
ExitBtn.active = true; ExitBtn.active = true;
...@@ -263,14 +270,8 @@ cc.Class({ ...@@ -263,14 +270,8 @@ cc.Class({
btnSelected.on('click', () => { btnSelected.on('click', () => {
this.hideMenu(); this.hideMenu();
if (cc.sys.isNative && cc.sys.os == cc.sys.OS_IOS) { this.syllabus_id = data.children[0].id;
this.loadBundle(data.children[0].conf.ios); this.loadBundleByConf(data.children[0].conf);
} 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('非源生环境');
}
}); });
if (data.has_child == '1') { if (data.has_child == '1') {
...@@ -290,6 +291,7 @@ cc.Class({ ...@@ -290,6 +291,7 @@ cc.Class({
.to(0.1, { scale: 1.00 }) .to(0.1, { scale: 1.00 })
.call(() => { .call(() => {
this.hideMenu(); this.hideMenu();
this.syllabus_id = menuData.children[0].id;
this.loadBundleByConf(menuData.children[0].conf); this.loadBundleByConf(menuData.children[0].conf);
}) })
.start(); .start();
......
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