Files
fc/dev/project/library/imports/ae/ae893f17-1c29-40c7-a52e-50ea41d4d839.js
2026-05-24 10:21:26 +08:00

83 lines
2.2 KiB
JavaScript

"use strict";
cc._RF.push(module, 'ae8938XHClAx6UuUOpB1Ng5', 'act.vipLevel.mod');
// Scripts/mod/acts/vipLevel/act.vipLevel.mod.js
"use strict";
/*******************************************************************************
*
* 活动: VIP升级
*
*
******************************************************************************/
var ActBase = require("act.base");
var ActVipLevelup = cc.Class({
"extends": ActBase,
// 初始化配置数据
initConfig: function initConfig() {
// 视图附着
nx.plugin.add(this, ["view"]);
this.vattach("Acts");
},
// 注册协议接受事件
registerProtocals: function registerProtocals() {
this.RegisterProtocal(16750, this.handle16750.bind(this)); // 等级礼包信息
this.RegisterProtocal(16751, this.handle16751.bind(this)); // 领取礼包
},
// 从服务器初始化数据
reqBaseFromServer: function reqBaseFromServer(_cb) {
// nx.dt.fnInvoke( _cb, true );
this.reqBaseData(_cb);
},
// ============================================================
// 操作
// ============================================================
// 等级礼包信息
reqBaseData: function reqBaseData(_cb) {
this.SendProtocal(16750, {}, _cb);
},
// 等级礼包信息
handle16750: function handle16750(_data) {
if (!this.isGoodData(_data)) {
return;
}
this.vset("VipTasks", _data.lev_gift_list || []);
this.freshTips();
},
// 领取礼包
reqGetRewardsOnce: function reqGetRewardsOnce(_cb) {
this.SendProtocal(16751, {}, _cb);
},
// 领取礼包
handle16751: function handle16751(_data) {
if (!this.isGoodData(_data)) {
return;
}
},
// ============================================================
// 活动红点提示
// ============================================================
// 红点提示更新
freshTips: function freshTips() {
var can = false;
var list = this.vget("VipTasks") || [];
for (var i = 0; i < list.length; ++i) {
// 0不可领取 1可领取 2已领取
var task = list[i];
if (task && task.status == 1) {
can = true;
break;
}
}
this.openTip("reward", can);
}
});
// 模块导出
module.exports = ActVipLevelup;
cc._RF.pop();