69 lines
1.7 KiB
JavaScript
69 lines
1.7 KiB
JavaScript
|
|
"use strict";
|
||
|
|
cc._RF.push(module, '531e3iS4blNObGbe+m+eqGQ', 'cmp.act.dailyfirstcharge');
|
||
|
|
// Scripts/mod/acts/dailyfirstcharge/cmp/cmp.act.dailyfirstcharge.js
|
||
|
|
|
||
|
|
"use strict";
|
||
|
|
|
||
|
|
var ActPage = require("act.page.base");
|
||
|
|
var ItemList = require("cmp.common.itemlayout");
|
||
|
|
var mod = require("act.dailyfirstcharge.mod");
|
||
|
|
var FID = require("bridge.function.ids");
|
||
|
|
|
||
|
|
/***
|
||
|
|
*
|
||
|
|
* 每日首次充值相關
|
||
|
|
*/
|
||
|
|
|
||
|
|
cc.Class({
|
||
|
|
"extends": ActPage,
|
||
|
|
properties: {
|
||
|
|
nodReward: {
|
||
|
|
"default": null,
|
||
|
|
type: ItemList
|
||
|
|
},
|
||
|
|
nodOp: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
}
|
||
|
|
},
|
||
|
|
// 初始化
|
||
|
|
build: function build(_params) {
|
||
|
|
this._super(_params);
|
||
|
|
var cfgs = gdata(this.mod.data.config, "data_daily_reward");
|
||
|
|
var now = new Date();
|
||
|
|
var day = now.getDay() + 1;
|
||
|
|
var rewards = cfgs[day];
|
||
|
|
this.nodReward.rebuild(rewards.reward);
|
||
|
|
this.mod.vbind(this, [["dailyfirstCharge", this.freshDailyFirstInfo.bind(this)]]);
|
||
|
|
|
||
|
|
// this.mod.reqDailyFChargeData();
|
||
|
|
},
|
||
|
|
|
||
|
|
onEnable: function onEnable() {
|
||
|
|
this.mod.reqDailyFChargeData();
|
||
|
|
},
|
||
|
|
// 销毁
|
||
|
|
onDestroy: function onDestroy() {
|
||
|
|
// 活动监听解除
|
||
|
|
if (this.mod) {
|
||
|
|
this.mod.vunbind(this);
|
||
|
|
}
|
||
|
|
this._super();
|
||
|
|
},
|
||
|
|
freshDailyFirstInfo: function freshDailyFirstInfo(_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 onTouchCharge() {
|
||
|
|
nx.bridge.jumper.jump2Window(FID.ActMySteryGift);
|
||
|
|
},
|
||
|
|
onTouchGet: function onTouchGet() {
|
||
|
|
this.mod.reqGetDailyFirstc();
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
cc._RF.pop();
|