local FamilyCreateView = {} local M = FamilyCreateView function FamilyCreateView.new(data, callback) setmetatable(M, { __index = BaseWindow }) local self = setmetatable({}, { __index = M }) self.class = "FamilyCreateView" self._data = data self._callback = callback self._close_destroy = true self:init("ui://Family/FamilyCreate") return self end function M:init(url) getmetatable(M).__index.init(self, url) local view = self._view view:GetChild('btn_confirm').onClick:Set(function() local groupName = view:GetChild('input_familyName').text if #groupName == 0 then ViewUtil:ErrorTip("亲友圈名称不能为空") return end local fgCtr = ControllerManager.GetController(NewGroupController) ViewUtil.ShowModalWait2() fgCtr:FG_CreateGroup(groupName, 1, 1, function(res) ViewUtil.CloseModalWait2() if self._is_destroy then return end if res.ReturnCode == 0 then self._callback() self:Destroy() else ViewUtil.ErrorTip(res.ReturnCode, '创建大联盟失败!') end end) end) view:GetChild('btn_close').onClick:Set(function() local ctr_tip = view:GetController('tip') if ctr_tip.selectedIndex == 0 then self:Destroy() else ctr_tip.selectedIndex = ctr_tip.selectedIndex - 1 end end) self:Show() end 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