123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- cc.Class({
- extends: require("Base"),
- properties: {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- back: {
- default: null,
- type: cc.Sprite
- },
- detail: {
- default: null,
- type: cc.Sprite
- },
- popup_prefab: {
- default: null,
- type: cc.Prefab
- },
- popup_layout: {
- default: null,
- type: cc.Layout
- },
- tab_layout: {
- default: null,
- type: cc.Layout
- },
- nav_prefab: {
- default: null,
- type: cc.Prefab
- },
- video_prefab: {
- default: null,
- type: cc.Prefab
- }
-
- },
-
- onLoad () {
-
- setViewTouch(
- this.back,
- null,
- function() {
- this.node.destroy();
- },
- null,
- this
- );
-
- setViewTouch(
- this.detail,
- null,
- function() {
- this.showDetail()
- },
- null,
- this
- );
- this.tabInit()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- },
- tabInit: function () {
- var tabContent = cc.instantiate(this.nav_prefab);
- this.tab_layout.node.addChild(tabContent);
- var video = cc.instantiate(this.video_prefab);
- for (let i = 0; i < 5; i++) {
- var courseware = cc.instantiate(this.popup_prefab);
- this.popup_layout.node.addChild(courseware);
- var length = this.popup_layout.node.childrenCount;
-
- var temp = this;
- courseware.getComponent("tabItem").setClickFunction(function(item) {
- for(var index = 0; index < length; index++) {
- temp.popup_layout.node.children[index].getComponent("tabItem").shu.enabled = true
- tabContent.getComponent("nav")['nav'+ (index+1)].enabled = false
- }
- item.target.getComponent("tabItem").shu.enabled = false
- tabContent.getComponent("nav")['nav'+ (i+1)].enabled = true
- if(i == 1) {
- tabContent.getComponent("nav").node.addChild(video)
- }else if(tabContent.getComponent("nav").node.childrenCount == 7) {
- tabContent.getComponent("nav").node.removeChild(video)
- }
- });
- }
- },
-
-
-
-
-
-
-
-
-
-
- start () {
- },
- showDetail: function() {
- this.curriculum_window.showDetail();
- }
-
- });
|