"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();