--进入牌友圈View对象 --author:-- local GroupJoinsView = {} local M = GroupJoinsView function GroupJoinsView.new(blur_view) setmetatable(M, {__index = BaseWindow}) local self = setmetatable({}, {__index = M}) self.class = "GroupJoinsView" self._close_destroy = true self._blur_view = blur_view self:init("ui://NewGroup/Win_GroupJoins") self.change = false return self end local function __fillJoins(self,curGroup,joins) local lst_joins = self._view:GetChild("lst_joins") lst_joins:RemoveChildrenToPool() local fgCtr = ControllerManager.GetController(FriendGroupController) for i=1,#joins do local rdata = joins[i] local item = lst_joins:AddItemFromPool() item:GetChild("tex_name").text = rdata.nick item:GetChild("tex_id").text = "ID:"..rdata.id local btn_yes = item:GetChild("btn_yes") btn_yes.data = rdata btn_yes.onClick:Set(function(context) local _rd = context.sender.data ViewUtil.ShowModalWait(self._root_view) fgCtr:FG_GroupVerifyJoin(curGroup.id,_rd.id,true,function(res1) if self._is_destroy then return end ViewUtil.CloseModalWait() if res1.ReturnCode == 0 then curGroup.joins = #res1.Data.joins self.change = true __fillJoins(self,curGroup,res1.Data.joins) else ViewUtil.ErrorTip(res.ReturnCode,"邀请失败!") end end) end) local btn_del = item:GetChild("btn_del") btn_del.data = rdata btn_del.onClick:Set(function(context) local _rd = context.sender.data ViewUtil.ShowModalWait(self._root_view) fgCtr:FG_GroupVerifyJoin(curGroup.id,_rd.id,false,function(res1) if self._is_destroy then return end ViewUtil.CloseModalWait() if res1.ReturnCode == 0 then curGroup.joins = #res1.Data.joins self.change = true __fillJoins(self,curGroup,res1.Data.joins) else ViewUtil.ErrorTip(res.ReturnCode,"邀请失败!") end end) end) local btn_head = item:GetChild("btn_head") ImageLoad.Load(rdata.portrait, btn_head._iconObject) end end function M:FillData(curGroup) local lst_joins = self._view:GetChild("lst_joins") lst_joins:RemoveChildrenToPool() local fgCtr = ControllerManager.GetController(FriendGroupController) fgCtr:FG_GroupJoins(curGroup.id,function( res) if self._is_destroy then return end if (res.ReturnCode == 0) then __fillJoins(self,curGroup,res.Data.joins) else ViewUtil.ErrorTip(res.ReturnCode,"获取邀请列表失败!") end end) end function M:SetCallback(callback) self.callback = callback end -- 销毁窗口 function M:Destroy(remove_map) if self.change and self.callback then self.callback() end BaseWindow.Destroy(self,remove_map) end return M