hengyang_client/lua_probject/base_project/Game/View/NewGroup/GroupJoinsView.lua

103 lines
3.2 KiB
Lua
Raw Normal View History

2025-04-01 10:48:36 +08:00
--进入牌友圈View对象
--author--
local GroupJoinsView = {}
local M = GroupJoinsView
function GroupJoinsView.new(blur_view)
2025-11-06 17:37:53 +08:00
setmetatable(M, { __index = BaseWindow })
local self = setmetatable({}, { __index = M })
2025-04-01 10:48:36 +08:00
self.class = "GroupJoinsView"
self._close_destroy = true
self._blur_view = blur_view
self:init("ui://NewGroup/Win_GroupJoins")
self.change = false
return self
end
2025-11-06 17:37:53 +08:00
local function __fillJoins(self, curGroup, joins)
2025-04-01 10:48:36 +08:00
local lst_joins = self._view:GetChild("lst_joins")
lst_joins:RemoveChildrenToPool()
local fgCtr = ControllerManager.GetController(FriendGroupController)
2025-11-06 17:37:53 +08:00
for i = 1, #joins do
2025-04-01 10:48:36 +08:00
local rdata = joins[i]
local item = lst_joins:AddItemFromPool()
item:GetChild("tex_name").text = rdata.nick
2025-11-06 17:37:53 +08:00
item:GetChild("tex_id").text = "ID:" .. rdata.id
2025-04-01 10:48:36 +08:00
local btn_yes = item:GetChild("btn_yes")
btn_yes.data = rdata
btn_yes.onClick:Set(function(context)
local _rd = context.sender.data
2025-11-06 17:37:53 +08:00
ViewUtil.ShowModalWait2(self._root_view)
fgCtr:FG_GroupVerifyJoin(curGroup.id, _rd.id, true, function(res1)
2025-04-01 10:48:36 +08:00
if self._is_destroy then
return
end
2025-11-06 17:37:53 +08:00
ViewUtil.CloseModalWait2()
2025-04-01 10:48:36 +08:00
if res1.ReturnCode == 0 then
curGroup.joins = #res1.Data.joins
self.change = true
2025-11-06 17:37:53 +08:00
__fillJoins(self, curGroup, res1.Data.joins)
2025-04-01 10:48:36 +08:00
else
2025-11-06 17:37:53 +08:00
ViewUtil.ErrorTip(res.ReturnCode, "邀请失败!")
2025-04-01 10:48:36 +08:00
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
2025-11-06 17:37:53 +08:00
ViewUtil.ShowModalWait2(self._root_view)
fgCtr:FG_GroupVerifyJoin(curGroup.id, _rd.id, false, function(res1)
2025-04-01 10:48:36 +08:00
if self._is_destroy then
return
end
2025-11-06 17:37:53 +08:00
ViewUtil.CloseModalWait2()
2025-04-01 10:48:36 +08:00
if res1.ReturnCode == 0 then
curGroup.joins = #res1.Data.joins
self.change = true
2025-11-06 17:37:53 +08:00
__fillJoins(self, curGroup, res1.Data.joins)
2025-04-01 10:48:36 +08:00
else
2025-11-06 17:37:53 +08:00
ViewUtil.ErrorTip(res.ReturnCode, "邀请失败!")
2025-04-01 10:48:36 +08:00
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)
2025-11-06 17:37:53 +08:00
fgCtr:FG_GroupJoins(curGroup.id, function(res)
2025-04-01 10:48:36 +08:00
if self._is_destroy then
return
end
if (res.ReturnCode == 0) then
2025-11-06 17:37:53 +08:00
__fillJoins(self, curGroup, res.Data.joins)
2025-04-01 10:48:36 +08:00
else
2025-11-06 17:37:53 +08:00
ViewUtil.ErrorTip(res.ReturnCode, "获取邀请列表失败!")
2025-04-01 10:48:36 +08:00
end
end)
end
function M:SetCallback(callback)
self.callback = callback
end
-- 销毁窗口
function M:Destroy(remove_map)
2025-11-06 17:37:53 +08:00
if self.change and self.callback then
2025-04-01 10:48:36 +08:00
self.callback()
end
2025-11-06 17:37:53 +08:00
BaseWindow.Destroy(self, remove_map)
2025-04-01 10:48:36 +08:00
end
2025-11-06 17:37:53 +08:00
return M