Files
fc/dev/project/library/imports/9b/9bda9195-f96b-415f-95cd-ae137452f7e5.js
T

77 lines
1.7 KiB
JavaScript
Raw Normal View History

2026-05-24 10:21:26 +08:00
"use strict";
cc._RF.push(module, '9bda9GV+WtBX5XNrhN0Uvfl', 'cmp.notice.wnd');
// Scripts/mod/login/notice/cmp.notice.wnd.js
"use strict";
/******************************************************************
*
* 系统公告
*
******************************************************************/
var BridgeWindow = require("bridge.window");
var FxSVC = require("nx.fx.sv.expand");
cc.Class({
"extends": BridgeWindow,
properties: {
lstMenu: {
"default": null,
type: FxSVC
},
nodContent: {
"default": null,
type: cc.Node
}
},
// 展示
onEnable: function onEnable() {
var _this = this;
// 获取公告
var url = nx.bridge.vget("noticeURL");
nx.web.get(url, {}, function (_err, _data) {
if (_err) {
// nx.tbox( "NoticeFetchFailed" );
return;
}
_this.build(_data.data);
}, false);
},
// 构建
build: function build(_data) {
var _this2 = this;
// 统计菜单项
this.menus = [];
for (var i in _data) {
var item = _data[i];
this.menus.push({
type: item.type,
name: "NoticeMenu" + item.type,
title: item.title,
text: item.content
});
}
this.lstMenu.rebuild(this.menus);
// 默认1
this.scheduleOnce(function () {
_this2.onSelectMenu({
index: 0,
mdata: _this2.menus[0]
});
}, 0.1);
},
// 菜单切换
onSelectMenu: function onSelectMenu(_item) {
// 聚焦
this.lstMenu.cleanFocus();
this.lstMenu.addFocus(_item.index);
// 设置
nx.gui.setString(this.nodContent, "head/txt", _item.mdata.title);
nx.gui.setString(this.nodContent, "head/date", "");
nx.gui.setString(this.nodContent, "text", _item.mdata.text);
}
});
cc._RF.pop();