Commit 284a85a2 authored by huoshizhe's avatar huoshizhe

feat: bundleType版

parent f4436818
...@@ -79,12 +79,10 @@ cc.Class({ ...@@ -79,12 +79,10 @@ cc.Class({
this.getBundleInfoList(); this.getBundleInfoList();
//
// /api/syllabus/v1/tree?orgid=483&pid=18567 // /api/syllabus/v1/tree?orgid=483&pid=18567
this.baseUrl = 'http://staging-teach.ireadabc.com'; this.baseUrl = 'http://staging-teach.ireadabc.com';
this.initStoryBoxView(18307); this.initStoryBoxView({ coursewareId: 18307 });
}, },
asyncDelayLog(str) { asyncDelayLog(str) {
...@@ -104,41 +102,36 @@ cc.Class({ ...@@ -104,41 +102,36 @@ cc.Class({
return; return;
} }
const { bundleInfoList, defaultBundleIdx, baseUrl, coursewareId, bundleType, bundleInfo } = JSON.parse(jsonStr); const { bundleInfoList, defaultBundleIdx, bundleType, bundleInfo } = JSON.parse(jsonStr);
if (bundleType == 'PetRoom') { if (bundleType == 'PetRoom') {
// const bundleInfo = { this.baseUrl = bundleInfo.baseUrl;
// "sceneName": "dfzx_cocos_T_FT_01", this.token = bundleInfo.token;
// "version": "c1a41", this.homework_id = bundleInfo.homework_id;
// "bondleUrl": "http://staging-teach.cdn.ireadabc.com//h5template/dfzx_cocos_T_FT_01/v3/android/dfzx_cocos_T_FT_01", this.syllabus_id = bundleInfo.syllabus_id;
// "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NDYyLCJ1dWlkIjoiZDNlODE0OGItOTNlNC00NzdiLWEyMmEtMjNkYTk4ZWVlMGYwIiwicGhvbmUiOiIxNTk0MDgzMzk1MCIsIm5pY2tfbmFtZSI6IuaZk-aFp-a1i-ivlSIsIm9yZ19pZCI6MTEsInNjaG9vbF9pZCI6MjA0LCJjbGFzc19pZCI6MTQxLCJkZnp4X3VzZXJfdXVpZCI6ImVmMTNhNTI3ZDg2ZDQ1MGY4MWJjMWE1OWQ0NDcyZTQwIiwiZGVsIjowLCJjcmVhdGVkX2RhdGUiOiIyMDIwLTA4LTA2VDA2OjA1OjUxLjAwMFoiLCJ1cGRhdGVkX2RhdGUiOiIyMDIwLTA4LTA3VDA4OjI3OjQwLjAwMFoiLCJhY2NvdW50X3R5cGUiOjIsImVuZF9kYXRlIjoiMjAyMS0xMC0xM1QxNjowMDowMC4wMDBaIiwiY2xhc3NSb2xlIjoic3R1IiwiaWF0IjoxNjI5ODYyMTA2LCJleHAiOjE2MzI0NTQxMDZ9.pKvGgI9yijd57vJBLAM9wuiPV5KkCriezV-FlD8fmLI", this.role = bundleInfo.role;
// "baseUrl": "http://staging-teach.ireadabc.com/api/",
// } this.loadBundle(bundleInfo);
} else if (bundleType == "StoryBox") {
// this.baseUrl = baseUrl; const descLabel = cc.find('middleLayer/storyBox/menu/menuBase/title/name');
// this.token = token; descLabel.getComponent(cc.Label).string = bundleInfo.coursewareDescription;
// this.homework_id = homework_id;
// this.syllabus_id = syllabus_id; const nameLabel = cc.find('middleLayer/storyBox/menu/menuBase/title/Lession');
// this.role = role; nameLabel.getComponent(cc.Label).string = bundleInfo.coursewareName;
// cc.find('middleLayer').getComponent('middleLayer').baseUrl this.baseUrl = bundleInfo.baseUrl;
this.initStoryBoxView(bundleInfo);
} else { } else {
if (baseUrl) { // WW模板
this.baseUrl = baseUrl; this.bundleInfoList = bundleInfoList;
this.initStoryBoxView(coursewareId); this.jumpToBundleByIndex(defaultBundleIdx);
} else {
// WW模板
this.bundleInfoList = bundleInfoList;
this.jumpToBundleByIndex(defaultBundleIdx);
}
} }
}, },
initStoryBoxView(coursewareId) { initStoryBoxView(bundleInfo) {
this.hideWWView(); this.hideWWView();
this.callNetworkApiGet('/api/syllabus/v1/tree', { orgid: 483, pid: coursewareId }, (data) => { this.callNetworkApiGet('/api/syllabus/v1/tree', { orgid: 483, pid: bundleInfo.coursewareId }, (data) => {
console.log(data); console.log(data);
const defaultBondle = data.rows.find(row => row.name == '默认'); const defaultBondle = data.rows.find(row => row.name == '默认');
if (!defaultBondle) { if (!defaultBondle) {
...@@ -361,6 +354,10 @@ cc.Class({ ...@@ -361,6 +354,10 @@ cc.Class({
lineBtnHide.active = true; lineBtnHide.active = true;
lineBtnShow.active = false; lineBtnShow.active = false;
const canvas = cc.find('Canvas');
console.log('canvas.width = ' + canvas.width);
console.log('canvas.height = ' + canvas.height);
const menuBase = cc.find('middleLayer/storyBox/menu/menuBase'); const menuBase = cc.find('middleLayer/storyBox/menu/menuBase');
cc.tween(menuBase) cc.tween(menuBase)
.to(1, { y: this.storyBoxMenuLength * -105 - 200 }, { easing: 'bounceOut' }) .to(1, { y: this.storyBoxMenuLength * -105 - 200 }, { easing: 'bounceOut' })
...@@ -573,7 +570,7 @@ cc.Class({ ...@@ -573,7 +570,7 @@ cc.Class({
cc.game.removePersistRootNode(this.node); cc.game.removePersistRootNode(this.node);
cc.director.loadScene("emptyScene", () => { cc.director.loadScene("emptyScene", () => {
this.callNativeFunction({ name: 'exit', value: '' }); this.callNativeFunction({ name: 'exit', value: '' });
}); });
}, },
getRainbowColorList() { getRainbowColorList() {
......
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