Files
fc/dev/project/library/imports/23/23e8f8a7-92fe-4d07-a989-ea2fff7fa43c.js
T
2026-05-24 10:21:26 +08:00

101 lines
3.0 KiB
JavaScript

"use strict";
cc._RF.push(module, '23e8finkv5NB6mJ6i//f6Q8', 'cmp.act.exchange.wnd');
// Scripts/mod/acts/exchange/cmp.act.exchange.wnd.js
"use strict";
var FxSVC = require("nx.fx.sv.expand");
var BasePage = require("act.page.base");
var NxSpine = require("nx.fx.spine");
cc.Class({
"extends": BasePage,
properties: {
svcshopLst: {
"default": null,
type: FxSVC,
displayName: "商城列表"
},
nodEndTime: {
"default": null,
type: cc.Node,
displayName: "結束時間"
},
nodRole: {
"default": null,
type: NxSpine,
displayName: "結束時間"
}
},
build: function build(_data) {
var _this = this;
this._super(_data);
// console.log( "當前的相關數據顯示" + JSON.stringify( _data ) );
// 获取指定主题信息
if (!this.mod) {
return;
}
// let list = this.mod.getExchangeInfo();
var extra = this.mod.getExtraInfo();
var free = this.mod.getFreeInfo();
var rolepath = nx.dt.objEmpty(extra) ? "H30117" : extra.model;
var finalpath = "resDB/models/" + rolepath + "/show";
var action = nx.dt.objEmpty(extra) ? "action1" : extra.act;
var fidd = nx.gui.getComponent(this, "panel/mat", "bridge.binder.item.icon.count");
var fiddc = nx.gui.getComponent(this, "panel/matc", "bridge.binder.item.icon.count");
if (fidd) {
fidd.setID(extra.item1);
}
if (fiddc) {
fiddc.setID(extra.item2);
}
this.nodRole.load(finalpath, function (_e) {
if (!_e) {
_this.nodRole.action(action, true);
} else {
_this.nodRole.stop();
}
});
var cmp = nx.gui.getComponent(this, "panel/free/item", "cmp.item.base");
if (cmp && free) {
cmp.setData(free[0]);
}
nx.gui.setString(this.nodEndTime, "txt", nx.bridge.time.toNeedTime(this.mod.data.end_time));
nx.gui.setActive(this, "panel/warn", this.mod.data.end_time - Math.floor(cc.sys.now() / 1000) <= 86400);
this.mod.vbind(this, [["exchangeInfo", this.freshInfo.bind(this)]]);
},
onEnable: function onEnable() {
this.mod.reqBaseInfo(this.mod.data.camp_id);
},
// 销毁
onDestroy: function onDestroy() {
// 活动监听解除
if (this.mod) {
this.mod.vunbind(this);
}
this._super();
},
freshInfo: function freshInfo(_data) {
if (!_data) {
return;
}
// 刷新顯示
var list = nx.dt.arrEmpty(_data.gift_buy_info) ? this.mod.getExchangeInfo() : _data.gift_buy_info;
nx.dt.arrEmpty(_data.gift_buy_info) ? list.sort(Utils.tableLowerSorter(["order"])) : list.sort(Utils.tableLowerSorter(["id"]));
this.svcshopLst.rebuild(list);
nx.gui.setActive(this, "panel/empty", nx.dt.arrEmpty(list));
nx.gui.setActive(this, "panel/free", _data.is_free == 0);
},
// 兌換
onTouchExChange: function onTouchExChange(_nod) {
var info = _nod;
this.mod.reqExchange(info.mdata.order || info.mdata.id);
},
// 兌換
onTouchGetFree: function onTouchGetFree() {
this.mod.reqGetFree();
}
});
cc._RF.pop();