77 lines
1.8 KiB
JavaScript
77 lines
1.8 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, '183cesEO/VPp5wJvvKyvhp1', 'cmp.act.stepup.gift.wnd');
|
|
// Scripts/mod/acts/stepup/cmp/cmp.act.stepup.gift.wnd.js
|
|
|
|
"use strict";
|
|
|
|
/******************************************************************
|
|
*
|
|
* STEPUP 助力禮包
|
|
*
|
|
******************************************************************/
|
|
|
|
var ActPage = require("act.page.base");
|
|
var STModel = require("act.stepup.mod");
|
|
var TDefine = require("trace.define");
|
|
var TTT = TDefine.TraceType;
|
|
cc.Class({
|
|
"extends": ActPage,
|
|
properties: {
|
|
lstProd: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
nodDate: {
|
|
"default": null,
|
|
type: cc.Node
|
|
}
|
|
},
|
|
// 初始化
|
|
build: function build(_data) {
|
|
this._super(_data);
|
|
var model = STModel.getInstance();
|
|
if (!model) {
|
|
this.delayClose();
|
|
return;
|
|
}
|
|
|
|
// 视图监听
|
|
model.vbind(this, [["stepGifts", this.onGiftsFresh.bind(this)]]);
|
|
nx.gui.setActive(this.nodDate, "", false);
|
|
model.reqGiftList();
|
|
|
|
// 埋点
|
|
if (nx.mTrace) {
|
|
nx.mTrace.trace(TTT.actCampOpened, model.data.camp_id, 1);
|
|
}
|
|
},
|
|
// 关闭
|
|
onDestroy: function onDestroy() {
|
|
// 视图监听
|
|
var model = STModel.getInstance();
|
|
if (model) {
|
|
model.vunbind(this);
|
|
}
|
|
},
|
|
// 礼包刷新
|
|
onGiftsFresh: function onGiftsFresh(_lst, _old, _init) {
|
|
if (_init) return;
|
|
|
|
// 空
|
|
if (nx.dt.arrEmpty(_lst)) {
|
|
nx.gui.setActive(this.lstProd, "", false);
|
|
return;
|
|
}
|
|
|
|
// 重建
|
|
nx.gui.setActive(this.lstProd, "", true);
|
|
var root = nx.gui.find(this.lstProd, "view/content");
|
|
nx.gui.gocChildren(root, "", _lst.length, root.children[0]);
|
|
for (var i = 0; i < _lst.length; ++i) {
|
|
var cmp = nx.gui.getComponent(root.children[i], "", "cmp.act.stepup.gift.item");
|
|
cmp.setData(_lst[i]);
|
|
}
|
|
}
|
|
});
|
|
|
|
cc._RF.pop(); |