hengyang_client/lua_probject/base_project/Game/View/Family/FamilyAuditNumber.lua

85 lines
2.4 KiB
Lua

--local NumberRemark = import(".FamilyNumberRemark")
local GroupSetTagView = import("..NewGroup.GroupSetTagView")
local FamilyAuditNumber = {}
local M = FamilyAuditNumber
local function AddItem(self, index, obj)
local info = self.data[index + 1]
obj:GetChild('text_name').text = info.nick
obj:GetChild('text_id').text = info.id
obj:GetChild('text_tag').text = "备注: " .. info.tag
obj:GetChild('text_time').text = os.date('%Y-%m-%d %H:%M', os.time())
ImageLoad.Load(info.portrait, obj:GetChild('btn_head')._iconObject)
obj:GetChild('btn_allow').onClick:Set(function()
self:ClickBtn(1, info.id)
end)
obj:GetChild('btn_unAllow').onClick:Set(function()
self:ClickBtn(0, info.id)
end)
end
function FamilyAuditNumber.new(root)
setmetatable(M, { __index = root })
local self = setmetatable({}, { __index = M })
--self:Show()
return self
end
function M:Show()
local fgCtr = ControllerManager.GetController(NewGroupController)
fgCtr:FG_GroupJoins(self._group.id, function(res)
if res.ReturnCode ~= 0 then
ViewUtil.ErrorTip(res.ReturnCode, "获取成员列表失败")
return
else
self.data = res.Data.joins
self.familyType.selectedIndex = 6
local list = self._view:GetChild('list_auditNumberList')
--list:RemoveChildrenToPool()
--list:SetVirtual()
list.itemRenderer = function(index, obj)
AddItem(self, index, obj)
end
list.numItems = #self.data
end
end)
end
function M:ClickBtn(isAllow, uid)
local fgCtr = ControllerManager.GetController(NewGroupController)
fgCtr:FG_GroupVerifyJoin(self._group.id, uid, isAllow == 1, function(res)
if res.ReturnCode ~= 0 then
ViewUtil.ErrorTip(res.ReturnCode, "获取成员列表失败")
else
if isAllow == 1 then
local tagView = GroupSetTagView.new(self._group.id, uid)
tagView:Show()
else
end
self:Show()
end
end)
end
function M:OnNewApply(arg)
arg = arg[1]
local msg = {}
msg.nick = arg.nick
msg.id = arg.uid
msg.portrait = arg.portrait
msg.tag = arg.remark
self.data[#self.data + 1] = msg
local list = self._view:GetChild('list_auditNumberList')
local obj = list:AddItemFromPool()
AddItem(self, #self.data - 1, obj)
end
return M