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

feat:

parent e08f64c7
......@@ -99,7 +99,8 @@ cc.Class({
// this.baseUrl = 'http://staging-teach.ireadabc.com/api/';
// this.initStoryBoxView({
// coursewareId: 18307
// // coursewareId: 18307
// coursewareId: 18582
// });
// this.bundleType = 'StoryBox';
......@@ -175,41 +176,27 @@ cc.Class({
ExitBtn.active = true;
});
const videoMenuItemData = data.rows.find(row => row.name == 'Video');
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");
this.menuItemNodeList = [];
const videoMenuNode = cc.find('middleLayer/storyBox/menu/menuBase/menuItem_video');
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];
let storyBoxMenuLength = 0;
menuItemNodeList.forEach(node => {
node.active = false;
});
console.log(data.rows.map(row => row.name));
let storyBoxMenuLength = 0;
data.rows.filter((row) => {
return row.name != '默认';
}).forEach((data, idx) => {
console.log(data.name);
if (!data) {
console.log('wordsMenuItemData')
return;
}
console.log(data.name, idx);
const node = menuItemNodeList[idx];
const node = cc.instantiate(cc.find('middleLayer/menuItem'));
node.name = 'menuItem_' + idx;
node.parent = cc.find('middleLayer/storyBox/menu/menuBase');
node.active = true;
node.x = 0;
node.y = 50 + storyBoxMenuLength * 100;
storyBoxMenuLength++;
this.menuItemNodeList.push(node);
const menuBase = cc.find('bubbleBase', node);
const label = cc.find('label', node);
......@@ -245,7 +232,7 @@ cc.Class({
console.error('沒有課件!');
return;
}
this.syllabus_id = data.children[0].id;
this.loadBundleByConf(data.children[0].conf);
} else {
......@@ -287,8 +274,9 @@ cc.Class({
});
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);
console.log("optionNode = " + optionNode);
optionNode.active = false;
}
data.children.forEach((menuData, idx) => {
......@@ -316,7 +304,7 @@ cc.Class({
const titleNode = cc.find('middleLayer/storyBox/menu/menuBase/title');
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');
storyBox.active = true;
......@@ -325,15 +313,7 @@ cc.Class({
},
hideAllSubmenu() {
const videoMenuNode = cc.find('middleLayer/storyBox/menu/menuBase/menuItem_video');
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 => {
this.menuItemNodeList.forEach(node => {
const btn = cc.find('btn', node);
const btnLight = cc.find('btnHightLight', node);
const btnSelected = cc.find('btnSelected', node);
......@@ -342,6 +322,11 @@ cc.Class({
btnLight.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);
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