Files
2026-05-23 22:10:14 +08:00

84 lines
2.0 KiB
JavaScript

/******************************************************************
*
* 月 循環禮包
*
******************************************************************/
const BasePage = require( "act.page.base" );
const NxSpine = require( "nx.fx.spine" );
const ExpandList = require( "nx.fx.sv.expand" );
const VipController = require( "vip_controller" );
cc.Class( {
extends: BasePage,
properties: {
nodItems : { type: ExpandList, default: null },
spRole: { default: null, type: NxSpine },
nodEndTime : { default: null, type: cc.Node },
nodOp : { type: cc.Node, default: null },
},
// 初始化
onLoad: function( ) {
this.spRole.load( "resDB/models/H30102/show", ( _e ) => {
if( !_e ) {
this.spRole.action( "action1", true );
} else {
this.spRole.stop();
}
} );
this.mod = VipController.getInstance();
this.nodItems.rebuild( this.mod.giftInfos );
// 活动监听
this.vbind( [
[ "monthlygift", this.freshWeeklyGiftInfo.bind( this ) ],
] );
},
onEnable: function(){
let scv = nx.gui.getComponent( this.nodItems, "", cc.ScrollView );
if( scv ) {
scv.scrollToTop( 0.001 );
}
// 请求信息
this.mod.reqMonthlyGiftData();
},
onDisable: function(){
},
freshWeeklyGiftInfo: function( _data ){
if( !_data || nx.dt.objEmpty( _data ) ){
return;
}
let buyList = _data.first_gift;
let chd = nx.gui.find( this.nodItems.bindSCV, "view/content" ).children;
for (let i = 0; i < chd.length; i++) {
let nod = chd[i];
let cmp = nod.svItem;
if( cmp ){
buyList.forEach( _item => {
if( _item.id == cmp.mdata.gift.charge_id ){
cmp.freshLeft( _item.count );
}
} )
}
}
},
} );