--设置窗口对象 local LobbyAuthenticateView = {} local M = LobbyAuthenticateView setmetatable(M, { __index = BaseWindow }) function LobbyAuthenticateView.new() local self = setmetatable({}, { __index = M }) self.class = 'AuthenticateView' self._close_destroy = true --假效果 self.authenticate = 0 self.authenticateName = "" self.authenticateId = "" self:init('ui://Lobby/Authentication') return self end function M:init(url) BaseWindow.init(self, url) ViewUtil.ShowModalWait2() local view = self._view local input_name = view:GetChild('input_name'); input_name.onChanged:Set(function() input_name.alpha = 1 end) input_name.onFocusOut:Set(function() if #input_name.text > 0 then input_name.alpha = 1 else input_name.alpha = 0.5 end end) local input_idInfo = view:GetChild('input_idInfo'); input_idInfo.onChanged:Set(function() input_idInfo.alpha = 1 end) input_idInfo.onFocusOut:Set(function() if #input_idInfo.text > 0 then input_idInfo.alpha = 1 else input_idInfo.alpha = 0.5 end end) local btn_send = view:GetChild('btn_send') btn_send.onClick:Set(function() local name = input_name.text local id = input_idInfo.text if string.utf8len(name) < 2 or string.utf8len(name) > 6 then ViewUtil.ErrorTip(-1, "您输入的名字过长或过短") return end if #name < 17 or #name > 18 then ViewUtil.ErrorTip(-1, "您输入的身份证不合法") return end local _data = {} _data.type = 1 _data.real_info = {} _data.real_info.name = name _data.real_info.ID = id local loddyctr = ControllerManager.GetController(LoddyController) loddyctr:UpdateUserInfo(_data, function(res) if res.ReturnCode ~= 0 then ViewUtil.ErrorTip(res.ReturnCode, "实名认证失败") else ViewUtil.ErrorTip(res.ReturnCode, "实名认证成功") self:Destroy() end end) end) local loddyCtr1 = ControllerManager.GetController(LoddyController) loddyCtr1:GetUserInfo(function(res) ViewUtil.CloseModalWait2() if res.ReturnCode == 0 then if res.Data.real_info and res.Data.real_info then input_name.text = res.Data.real_info.name or "" input_idInfo.text = res.Data.real_info.ID or "" btn_send.visible = false end self:Show() else ViewUtil.ErrorTip(res.ReturnCode, "获取认证信息失败") end end) end return M