Commit bac68d29 authored by 范雪寒's avatar 范雪寒

feat:

parent e08f64c7
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -99,7 +99,8 @@ cc.Class({ ...@@ -99,7 +99,8 @@ cc.Class({
// 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
// }); // });
// this.bundleType = 'StoryBox'; // this.bundleType = 'StoryBox';
...@@ -175,41 +176,27 @@ cc.Class({ ...@@ -175,41 +176,27 @@ cc.Class({
ExitBtn.active = true; ExitBtn.active = true;
}); });
const videoMenuItemData = data.rows.find(row => row.name == 'Video'); this.menuItemNodeList = [];
const songMenuItemData = data.rows.find(row => row.name == 'Song');
const talkMenuItemData = data.rows.find(row => row.name == "Let's talk");
const wordsMenuItemData = data.rows.find(row => row.name == "Words");
const funtimesMenuItemData = data.rows.find(row => row.name == "FunTime");
const videoMenuNode = cc.find('middleLayer/storyBox/menu/menuBase/menuItem_video'); let storyBoxMenuLength = 0;
const songMenuNode = cc.find('middleLayer/storyBox/menu/menuBase/menuItem_song');
const talkMenuNode = cc.find('middleLayer/storyBox/menu/menuBase/menuItem_letsTalk');
const wordsMenuNode = cc.find('middleLayer/storyBox/menu/menuBase/menuItem_words');
const funtimesMenuNode = cc.find('middleLayer/storyBox/menu/menuBase/menuItem_funTime');
const menuItemDataList = [funtimesMenuItemData, wordsMenuItemData, talkMenuItemData, songMenuItemData, videoMenuItemData];
const menuItemNodeList = [funtimesMenuNode, wordsMenuNode, talkMenuNode, songMenuNode, videoMenuNode];
menuItemNodeList.forEach(node => { console.log(data.rows.map(row => row.name));
node.active = false;
});
let storyBoxMenuLength = 0;
data.rows.filter((row) => { data.rows.filter((row) => {
return row.name != '默认'; return row.name != '默认';
}).forEach((data, idx) => { }).forEach((data, idx) => {
console.log(data.name); console.log(data.name, idx);
if (!data) { const node = cc.instantiate(cc.find('middleLayer/menuItem'));
console.log('wordsMenuItemData') node.name = 'menuItem_' + idx;
return; node.parent = cc.find('middleLayer/storyBox/menu/menuBase');
}
const node = menuItemNodeList[idx];
node.active = true; node.active = true;
node.x = 0;
node.y = 50 + storyBoxMenuLength * 100; node.y = 50 + storyBoxMenuLength * 100;
storyBoxMenuLength++; storyBoxMenuLength++;
this.menuItemNodeList.push(node);
const menuBase = cc.find('bubbleBase', node); const menuBase = cc.find('bubbleBase', node);
const label = cc.find('label', node); const label = cc.find('label', node);
...@@ -287,8 +274,9 @@ cc.Class({ ...@@ -287,8 +274,9 @@ cc.Class({
}); });
if (data.has_child == '1') { if (data.has_child == '1') {
for (let i = 0; i < 5; i++) { for (let i = 0; i < 10; i++) {
const optionNode = cc.find(`bubbleBase/bubbleBg/option_${i}`, node); const optionNode = cc.find(`bubbleBase/bubbleBg/option_${i}`, node);
console.log("optionNode = " + optionNode);
optionNode.active = false; optionNode.active = false;
} }
data.children.forEach((menuData, idx) => { data.children.forEach((menuData, idx) => {
...@@ -316,7 +304,7 @@ cc.Class({ ...@@ -316,7 +304,7 @@ cc.Class({
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 + storyBoxMenuLength * 100;
this.storyBoxMenuLength = menuItemNodeList.filter(node => node.active).length; 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;
...@@ -325,15 +313,7 @@ cc.Class({ ...@@ -325,15 +313,7 @@ cc.Class({
}, },
hideAllSubmenu() { hideAllSubmenu() {
const videoMenuNode = cc.find('middleLayer/storyBox/menu/menuBase/menuItem_video'); this.menuItemNodeList.forEach(node => {
const songMenuNode = cc.find('middleLayer/storyBox/menu/menuBase/menuItem_song');
const talkMenuNode = cc.find('middleLayer/storyBox/menu/menuBase/menuItem_letsTalk');
const wordsMenuNode = cc.find('middleLayer/storyBox/menu/menuBase/menuItem_words');
const funtimesMenuNode = cc.find('middleLayer/storyBox/menu/menuBase/menuItem_funTime');
const menuItemNodeList = [funtimesMenuNode, wordsMenuNode, talkMenuNode, songMenuNode, videoMenuNode];
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);
const btnSelected = cc.find('btnSelected', node); const btnSelected = cc.find('btnSelected', node);
...@@ -342,6 +322,11 @@ cc.Class({ ...@@ -342,6 +322,11 @@ cc.Class({
btnLight.active = false; btnLight.active = false;
btnSelected.active = false; btnSelected.active = false;
const label = cc.find('label', node);
const labelSelected = cc.find('labelSelected', node);
label.active = true;
labelSelected.active = false;
const menuBase = cc.find('bubbleBase', node); const menuBase = cc.find('bubbleBase', node);
menuBase.active = false; menuBase.active = false;
}); });
......
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