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

feat: log

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