Files

80 lines
1.9 KiB
JavaScript
Raw Permalink Normal View History

2026-05-24 10:21:26 +08:00
"use strict";
cc._RF.push(module, '8e95739jK1CUp70pQFyoEf1', 'cmp.act.weeklygift');
// Scripts/mod/payment/cmp/cmp.act.weeklygift.js
"use strict";
/******************************************************************
*
* 集結令 開服活动
*
******************************************************************/
var BasePage = require("act.page.base");
var NxSpine = require("nx.fx.spine");
var ExpandList = require("nx.fx.sv.expand");
var 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 onLoad() {
var _this = this;
this.spRole.load("resDB/models/H30084/show", function (_e) {
if (!_e) {
_this.spRole.action("action1", true);
} else {
_this.spRole.stop();
}
});
this.mod = VipController.getInstance();
this.nodItems.rebuild(this.mod.giftInfo);
// 活动监听
this.vbind([["weeklygift", this.freshWeeklyGiftInfo.bind(this)]]);
},
onEnable: function onEnable() {
// 请求信息
this.mod.reqMonthlyGiftData(1);
},
freshWeeklyGiftInfo: function freshWeeklyGiftInfo(_data) {
if (!_data || nx.dt.objEmpty(_data)) {
return;
}
var buyList = _data.first_gift;
var chd = nx.gui.find(this.nodItems.bindSCV, "view/content").children;
var _loop = function _loop() {
var nod = chd[i];
var cmp = nod.svItem;
if (cmp) {
buyList.forEach(function (_item) {
if (_item.id == cmp.mdata.gift.charge_id) {
cmp.freshLeft(_item.count);
}
});
}
};
for (var i = 0; i < chd.length; i++) {
_loop();
}
}
});
cc._RF.pop();