Commit 284a85a2 authored by huoshizhe's avatar huoshizhe

feat: bundleType版

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