2025-12-20 21:48:58 +08:00
|
|
|
local FamilyUtilInput = import(".FamilyUtilInput")
|
|
|
|
|
|
2025-12-18 20:23:31 +08:00
|
|
|
local FamilyJoinView = {}
|
|
|
|
|
|
|
|
|
|
local M = FamilyJoinView
|
|
|
|
|
|
|
|
|
|
function FamilyJoinView.new(data, callback)
|
|
|
|
|
setmetatable(M, { __index = BaseWindow })
|
|
|
|
|
local self = setmetatable({}, { __index = M })
|
|
|
|
|
self.class = "FamilyJoinView"
|
|
|
|
|
self._data = data
|
|
|
|
|
self._callback = callback
|
|
|
|
|
self._close_destroy = true
|
|
|
|
|
self:init("ui://Family/FamilyJoin")
|
|
|
|
|
return self
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:init(url)
|
|
|
|
|
getmetatable(M).__index.init(self, url)
|
|
|
|
|
|
|
|
|
|
local view = self._view
|
2025-12-20 21:48:58 +08:00
|
|
|
self._input = view:GetChild('input_familyName')
|
|
|
|
|
|
2025-12-18 20:23:31 +08:00
|
|
|
view:GetChild('btn_confirm').onClick:Set(function()
|
2025-12-20 21:48:58 +08:00
|
|
|
local gid = self._input.text
|
2025-12-18 20:23:31 +08:00
|
|
|
if #gid == 0 then
|
|
|
|
|
ViewUtil:ErrorTip("输入的亲友圈id不能为空")
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
ViewUtil.ShowModalWait2()
|
|
|
|
|
local fgCtr = ControllerManager.GetController(NewGroupController)
|
|
|
|
|
fgCtr:FG_JoinGroup(tonumber(gid), function(res)
|
2025-12-20 21:48:58 +08:00
|
|
|
ViewUtil.CloseModalWait2()
|
|
|
|
|
if res.ReturnCode ~= 0 then
|
|
|
|
|
ViewUtil.ErrorTip(res.ReturnCode)
|
|
|
|
|
end
|
|
|
|
|
end, "")
|
2025-12-18 20:23:31 +08:00
|
|
|
end)
|
|
|
|
|
|
2025-12-20 21:48:58 +08:00
|
|
|
FamilyUtilInput:init(self._input, view:GetChild('comp_input'))
|
|
|
|
|
|
|
|
|
|
view:GetChild('list_record').itemRenderer = handler(self, self.RecordItemRenderer)
|
|
|
|
|
|
|
|
|
|
view:GetController('page').onChanged:Set(function(context)
|
|
|
|
|
-- if context.sender.selectedIndex == 1 then
|
|
|
|
|
-- ViewUtil:ShowModalWait2()
|
|
|
|
|
-- local fgCtr = ControllerManager.GetController(NewGroupController)
|
|
|
|
|
-- fgCtr:FG_Get_Msg(DataManager.CurrenGroup.id, function(res)
|
|
|
|
|
-- ViewUtil.CloseModalWait2()
|
|
|
|
|
-- if res.ReturnCode ~= 0 then
|
|
|
|
|
-- ViewUtil.ErrorTip(res.ReturnCode)
|
|
|
|
|
-- return
|
|
|
|
|
-- end
|
|
|
|
|
|
|
|
|
|
-- self.resData = res.Data.messages
|
|
|
|
|
-- view:GetChild('list_record').numItems = #self.resData
|
|
|
|
|
-- end)
|
|
|
|
|
-- end
|
2025-12-18 20:23:31 +08:00
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
self:Show()
|
|
|
|
|
end
|
|
|
|
|
|
2025-12-20 21:48:58 +08:00
|
|
|
function M:RecordItemRenderer(index, obj)
|
|
|
|
|
index = index + 1
|
|
|
|
|
if self.resData[index].m_state == 0 or self.resData[index].m_state == 3 then
|
|
|
|
|
obj:GetChild('text_name').text = self.resData[index].tag_name
|
|
|
|
|
obj:GetChild('text_id').text = string.format("标识:%s", self.resData[index].tag_id)
|
|
|
|
|
obj:GetChild('text_type').text = self.resData[index].m_state == 0 and "已进驻" or "已退出"
|
|
|
|
|
elseif self.resData[index].m_state == 2 then
|
|
|
|
|
obj:GetChild('text_name').text = self.resData[index].group_name
|
|
|
|
|
obj:GetChild('text_id').text = ""
|
|
|
|
|
obj:GetChild('text_type').text = "亲友圈已创建"
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2025-12-18 20:23:31 +08:00
|
|
|
function M:FillData()
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 打开窗口
|
|
|
|
|
function M:Show()
|
|
|
|
|
getmetatable(M).__index.Show(self)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 关闭窗口
|
|
|
|
|
function M:Close()
|
|
|
|
|
getmetatable(M).__index.Close(self)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 销毁窗口
|
|
|
|
|
function M:Destroy()
|
|
|
|
|
getmetatable(M).__index.Destroy(self)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return M
|