Files
fc/dev/project/library/imports/02/0258d09f-6164-4ad6-a1cb-c7ad4f129073.js
2026-05-24 10:21:26 +08:00

85 lines
2.1 KiB
JavaScript

"use strict";
cc._RF.push(module, '0258dCfYWRK1qHLx61PEpBz', 'cmp.act.monthlygift');
// Scripts/mod/payment/cmp/cmp.act.monthlygift.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/H30102/show", function (_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 onEnable() {
var scv = nx.gui.getComponent(this.nodItems, "", cc.ScrollView);
if (scv) {
scv.scrollToTop(0.001);
}
// 请求信息
this.mod.reqMonthlyGiftData();
},
onDisable: function onDisable() {},
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();