const ActPage = require( "act.page.base" ); const ItemList = require( "cmp.common.itemlayout" ); const mod = require( "act.dailyfirstcharge.mod" ); const FID = require( "bridge.function.ids" ); /*** * * 每日首次充值相關 */ cc.Class({ extends: ActPage, properties: { nodReward:{ default: null, type : ItemList }, nodOp: { default: null, type : cc.Node } }, // 初始化 build: function( _params ) { this._super( _params ); let cfgs = gdata( this.mod.data.config, "data_daily_reward" ); let now = new Date(); let day = now.getDay() + 1; let rewards = cfgs[day]; this.nodReward.rebuild( rewards.reward ); this.mod.vbind( this, [ [ "dailyfirstCharge", this.freshDailyFirstInfo.bind( this ) ], ] ); // this.mod.reqDailyFChargeData(); }, onEnable: function(){ this.mod.reqDailyFChargeData(); }, // 销毁 onDestroy: function() { // 活动监听解除 if( this.mod ) { this.mod.vunbind( this ); } this._super(); }, freshDailyFirstInfo: function( _data ){ if( !_data ){ return; } nx.gui.setActive( this.nodOp, "charge", _data.status == 0 ); nx.gui.setActive( this.nodOp, "get", _data.status == 1 ); nx.gui.setActive( this.nodOp, "finish", _data.status == 2 ); }, onTouchCharge: function(){ nx.bridge.jumper.jump2Window( FID.ActMySteryGift ); }, onTouchGet: function(){ this.mod.reqGetDailyFirstc(); }, });