Files

97 lines
2.7 KiB
JavaScript
Raw Permalink Normal View History

2026-05-24 10:21:26 +08:00
"use strict";
cc._RF.push(module, 'a04b1xfsI5FYpcn6XTxrjGR', 'cmp.act.appoint8');
// Scripts/mod/acts/appoint8/cmp.act.appoint8.js
"use strict";
/******************************************************************
*
* 八日约定
*
******************************************************************/
var ActPopup = require("act.popup.base");
var Mod = require("act.appoint8.mod");
var FID = require("bridge.function.ids");
var themeMod = require("acts.mod");
cc.Class({
"extends": ActPopup,
properties: {
nodReward: {
type: cc.Node,
"default": null
}
},
// 初始化
onOpenConfigs: function onOpenConfigs(_params) {
this._super(_params);
this.mod = Mod.getInstance();
if (!this.mod) {
this.delayClose();
return;
}
// console.log( JSON.stringify( this.data ) + "当前的活动" + JSON.stringify( this.mod ) );
// 视图监听
this.mod.vbind(this, [["appoint8", this.freshDayReward.bind(this)]]);
// 请求信息
this.mod.reqBaseData();
},
// 销毁
onDestroy: function onDestroy() {
// 活动监听解除
if (this.mod) {
this.mod.vunbind(this);
}
delete this.mod;
this._super();
},
close: function close() {
this._super();
//判断下是不是要回到openserver
var needShow = cc.sys.localStorage.getItem("needBackOpenServerAct");
if (needShow == 1) {
//cc.sys.localStorage.removeItem("needBackOpenServerAct")
nx.bridge.createPanel("WndOpenServer");
}
},
freshDayReward: function freshDayReward(_data) {
var _this = this;
var self = this;
var chd = this.nodReward.children;
var cfgs = gdata(this.mod.data.config, "data_day");
if (cfgs) {
this.state = _data ? _data : this.mod.vget("appoint8");
// console.log( "当前的领取状态" + JSON.stringify( this.state ) );
var _loop = function _loop(i) {
var cfg = cfgs[i];
var nod = chd[i - 1];
var state_cp = nx.dt.objClone(_this.state);
state_cp.day = i;
state_cp.status = 1;
var cmp = nx.gui.getComponent(nod, "", "cmp.act.appoint8.item");
if (cmp) {
cmp.setData({
index: i,
award: cfg.rewards[0],
state: _this.state[i - 1] ? _this.state[i - 1] : state_cp,
cb: function cb() {
self.mod.reqGetDayAward(i);
}
});
}
};
for (var i in cfgs) {
_loop(i);
}
}
},
onTouchClose: function onTouchClose() {
this.close();
// let theme = themeMod.getInstance().queryTheme( this.mod.data.theme_id );
// nx.bridge.jumper.jump2Window( FID.ActOpenServer, theme );
}
});
cc._RF.pop();