"use strict"; cc._RF.push(module, '753923H14lIw47IwSJ/4udQ', 'cmp.item.chat.friend'); // Scripts/mod/chat/cmp/cmp.item.chat.friend.js "use strict"; // Learn cc.Class: var SvcItem = require("nx.fx.sv.expand.item"); cc.Class({ "extends": SvcItem, properties: { head_icon: { "default": null, type: cc.Node }, level: { "default": null, type: cc.Label }, pname: { "default": null, type: cc.Label }, check: { "default": null, type: cc.Node }, fabHeader: { "default": null, type: cc.Prefab } }, // 数据重置 rebind: function rebind(_idx, _data, _key) { this._super(_idx, _data, _key); // 刷新 this.setData(this.mdata); }, setData: function setData(data) { if (nx.dt.objEmpty(data)) { return false; } this.friend_vo = data.vo; // this.select_cb = data.select_cb; this.delete_cb = data.delete_cb; // this.check.active = data.is_select; if (this.delete_cb == null) { return false; } this.fxindex = this.friend_vo.srv_id + this.friend_vo.rid; this.updateWidget(); }, updateWidget: function updateWidget() { //头像 if (!this.play_head) { this.play_head = cc.instantiate(this.fabHeader); this.play_head.parent = this.head_icon; } var cmp = this.play_head.getComponent("cmp.common.header"); if (cmp) { cmp.setData(this.friend_vo); } this.level.string = this.friend_vo.lev || ""; this.pname.string = this.friend_vo.name || ""; }, onFocus: function onFocus() { this.check.active = true; }, outFocus: function outFocus() { this.check.active = false; }, // selectItem: function() { // if (this.select_cb) // this.check.active = !this.check.active; // this.select_cb(this.index, this.friend_vo); // }, deleteItem: function deleteItem() { var self = this; var str = nx.text.getKey("ChatDelaFriMsg"); var fun = function (_key, _box) { _box.close(); if (_key == "btn_sure") { if (self.delete_cb) self.delete_cb(self.fxindex, self.friend_vo); } // self.node.destroy(); }.bind(this); nx.mbox(str, ["btn_sure"], fun, "DeleteFriend"); }, start: function start() {} // update (dt) {}, }); cc._RF.pop();