Commit 90cee03c authored by limingzhe's avatar limingzhe

fix: debug

parent 770b04a2
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
import { getSprNodeByUrl, setSprNodeMaxLen } from "./util"; import { getSprNodeByUrl, setSprNodeMaxLen } from "./util";
const {ccclass, property} = cc._decorator; const { ccclass, property } = cc._decorator;
@ccclass @ccclass
export default class NewClass extends cc.Component { export default class NewClass extends cc.Component {
...@@ -36,7 +36,7 @@ export default class NewClass extends cc.Component { ...@@ -36,7 +36,7 @@ export default class NewClass extends cc.Component {
// onLoad () {} // onLoad () {}
start () { start() {
this.initData(); this.initData();
this.initView(); this.initView();
} }
...@@ -46,50 +46,53 @@ export default class NewClass extends cc.Component { ...@@ -46,50 +46,53 @@ export default class NewClass extends cc.Component {
{ {
type: "music", type: "music",
iconRes: "btn_music", iconRes: "btn_music",
text_cn:"拼读儿歌", text_cn: "拼读儿歌",
text_en:"Music", text_en: "Music",
}, },
{ {
type: "class", type: "class",
iconRes: "btn_class", iconRes: "btn_class",
text_cn:"外教课堂", text_cn: "外教课堂",
text_en:"Class", text_en: "Class",
}, },
{ {
type: "chant", type: "chant",
iconRes: "btn_chant", iconRes: "btn_chant",
text_cn:"律动时光", text_cn: "律动时光",
text_en:"Chant", text_en: "Chant",
}, },
{ {
type: "practice", type: "practice",
iconRes: "btn_practice", iconRes: "btn_practice",
text_cn:"闯关练习", text_cn: "闯关练习",
text_en:"Practice", text_en: "Practice",
}, },
{ {
type: "video", type: "video",
iconRes: "btn_video", iconRes: "btn_video",
text_cn:"场景动画", text_cn: "场景动画",
text_en:"Video", text_en: "Video",
}, },
{ {
type: "review", type: "review",
iconRes: "btn_review", iconRes: "btn_review",
text_cn:"故事复述", text_cn: "故事复述",
text_en:"Review", text_en: "Review",
isLock: true,
}, },
{ {
type: "speaking", type: "speaking",
iconRes: "btn_speaking", iconRes: "btn_speaking",
text_cn:"外教带读", text_cn: "外教带读",
text_en:"Speaking", text_en: "Speaking",
isLock: true,
}, },
{ {
type: "show", type: "show",
iconRes: "btn_show", iconRes: "btn_show",
text_cn:"外教带读", text_cn: "外教带读",
text_en:"My Show", text_en: "My Show",
isLock: true,
}, },
] ]
} }
...@@ -120,7 +123,7 @@ export default class NewClass extends cc.Component { ...@@ -120,7 +123,7 @@ export default class NewClass extends cc.Component {
const listItem = cc.find("view/content/item", this.scrollView); const listItem = cc.find("view/content/item", this.scrollView);
const itemArr = []; const itemArr = [];
for (let i=0; i<dataArr.length; i++) { for (let i = 0; i < dataArr.length; i++) {
const data = dataArr[i]; const data = dataArr[i];
...@@ -128,11 +131,11 @@ export default class NewClass extends cc.Component { ...@@ -128,11 +131,11 @@ export default class NewClass extends cc.Component {
itemNode['data'] = data; itemNode['data'] = data;
const iconNodeBase = cc.find(data.iconRes , this.resNode); const iconNodeBase = cc.find(data.iconRes, this.resNode);
const iconLockedBase = cc.find(data.iconRes + "_locked" , this.resNode); const iconLockedBase = cc.find(data.iconRes + "_locked", this.resNode);
const iconNode = cc.instantiate( iconNodeBase ); const iconNode = cc.instantiate(iconNodeBase);
const iconLocked = cc.instantiate( iconLockedBase ); const iconLocked = cc.instantiate(iconLockedBase);
const picLayer = cc.find("pic_layer", itemNode); const picLayer = cc.find("pic_layer", itemNode);
...@@ -158,22 +161,43 @@ export default class NewClass extends cc.Component { ...@@ -158,22 +161,43 @@ export default class NewClass extends cc.Component {
const lock = cc.find("icon_lock", itemNode); const lock = cc.find("icon_lock", itemNode);
lock.active = false; lock.active = false;
const isLocked = Math.floor( Math.random() * 2); const isLocked = data.isLock;
if (isLocked) { if (isLocked) {
iconLocked.active = true; iconLocked.active = true;
lock.active = true; lock.active = true;
} }
itemNode.addComponent(cc.Button);
itemNode.on("click", () => {
switch(data.type) {
case "music":
this.musicCardClick();
break;
}
})
itemArr.push(itemNode); itemArr.push(itemNode);
} }
return itemArr; return itemArr;
} }
musicCardClick() {
if ( global.middleLayer ) {
const middleLayer = cc.find("middleLayer");
middleLayer.active = false;
console.log('middleLayer: ', middleLayer);
global.middleLayer.loadOnlineCourseWare(20522);
}
}
initScrollViewItem(sv, itemArr, row=1) { initScrollViewItem(sv, itemArr, row = 1) {
sv.scrollToTop(); sv.scrollToTop();
const content = sv.content; const content = sv.content;
...@@ -192,7 +216,7 @@ export default class NewClass extends cc.Component { ...@@ -192,7 +216,7 @@ export default class NewClass extends cc.Component {
let lastX = baseX; let lastX = baseX;
for (let i=0; i<itemArr.length; i++) { for (let i = 0; i < itemArr.length; i++) {
const item = itemArr[i]; const item = itemArr[i];
......
...@@ -41,8 +41,8 @@ export default class NewClass extends cc.Component { ...@@ -41,8 +41,8 @@ export default class NewClass extends cc.Component {
// this._currentViewNode = this.loginPage; // this._currentViewNode = this.loginPage;
// this._currentViewName = "LoginPage" // this._currentViewName = "LoginPage"
this._currentViewNode = this.libraryReadPage; this._currentViewNode = this.missionPage;
this._currentViewName = "LibraryReadPage" this._currentViewName = "MissionPage"
this._currentViewNode.active = true; this._currentViewNode.active = true;
} }
......
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