Commit 088a8c18 authored by 范雪寒's avatar 范雪寒

feat: log

parent bac68d29
......@@ -97,12 +97,12 @@ cc.Class({
// })
// }, 20000);
// this.baseUrl = 'http://staging-teach.ireadabc.com/api/';
// this.initStoryBoxView({
// // coursewareId: 18307
// coursewareId: 18582
// });
// this.bundleType = 'StoryBox';
this.baseUrl = 'http://staging-teach.ireadabc.com/api/';
this.initStoryBoxView({
// coursewareId: 18307
coursewareId: 18582
});
this.bundleType = 'StoryBox';
this.log('汪汪汪');
},
......@@ -162,6 +162,7 @@ cc.Class({
initStoryBoxView(bundleInfo) {
this.hideWWView();
this.showLog(bundleInfo.coursewareId);
this.callNetworkApiGet('syllabus/v1/tree', { orgid: 483, pid: bundleInfo.coursewareId }, (data) => {
console.log(data);
const defaultBondle = data.rows.find(row => row.name == '默认');
......@@ -178,13 +179,9 @@ cc.Class({
this.menuItemNodeList = [];
let storyBoxMenuLength = 0;
console.log(data.rows.map(row => row.name));
data.rows.filter((row) => {
return row.name != '默认';
}).forEach((data, idx) => {
}).forEach((data, idx, arr) => {
console.log(data.name, idx);
const node = cc.instantiate(cc.find('middleLayer/menuItem'));
......@@ -192,8 +189,7 @@ cc.Class({
node.parent = cc.find('middleLayer/storyBox/menu/menuBase');
node.active = true;
node.x = 0;
node.y = 50 + storyBoxMenuLength * 100;
storyBoxMenuLength++;
node.y = 50 + (arr.length - 1 - idx) * 100;
this.menuItemNodeList.push(node);
......@@ -222,6 +218,7 @@ cc.Class({
.call(() => {
if (data.has_child == '0') {
this.hideAllSubmenu();
this.resetAllMenu();
this.hideMenu();
btn.active = false;
btnSelected.active = true;
......@@ -300,11 +297,11 @@ cc.Class({
}
});
this.storyBoxMenuLength = this.menuItemNodeList.filter(node => node.active).length;
const titleNode = cc.find('middleLayer/storyBox/menu/menuBase/title');
titleNode.y = 30 + storyBoxMenuLength * 100;
titleNode.y = 30 + this.storyBoxMenuLength * 100;
this.storyBoxMenuLength = this.menuItemNodeList.filter(node => node.active).length;
const storyBox = cc.find('middleLayer/storyBox');
storyBox.active = true;
......@@ -313,6 +310,13 @@ cc.Class({
},
hideAllSubmenu() {
this.menuItemNodeList.forEach(node => {
const menuBase = cc.find('bubbleBase', node);
menuBase.active = false;
});
},
resetAllMenu() {
this.menuItemNodeList.forEach(node => {
const btn = cc.find('btn', node);
const btnLight = cc.find('btnHightLight', node);
......@@ -326,9 +330,6 @@ cc.Class({
const labelSelected = cc.find('labelSelected', node);
label.active = true;
labelSelected.active = false;
const menuBase = cc.find('bubbleBase', node);
menuBase.active = false;
});
},
......@@ -387,6 +388,7 @@ cc.Class({
hideMenu() {
this.hideAllSubmenu();
this.resetAllMenu();
const lineBtnShow = cc.find('middleLayer/storyBox/menu/menuBase/lineBtnShow');
const lineBtnHide = cc.find('middleLayer/storyBox/menu/menuBase/lineBtnHide')
......
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