hengyang_client/lua_probject/base_project/Game/View/Lobby/LobbyAuthenticateView.lua

95 lines
2.7 KiB
Lua
Raw Normal View History

2025-04-01 10:48:36 +08:00
--设置窗口对象
local LobbyAuthenticateView = {}
local M = LobbyAuthenticateView
2025-05-22 18:14:21 +08:00
setmetatable(M, { __index = BaseWindow })
2025-04-01 10:48:36 +08:00
function LobbyAuthenticateView.new()
2025-05-22 18:14:21 +08:00
local self = setmetatable({}, { __index = M })
2025-04-01 10:48:36 +08:00
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()
2025-04-01 10:48:36 +08:00
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
2025-05-22 18:14:21 +08:00
local _data = {}
2025-05-22 18:32:34 +08:00
_data.type = 1
2025-05-22 18:14:21 +08:00
_data.real_info = {}
_data.real_info.name = name
_data.real_info.ID = id
2025-05-22 18:14:21 +08:00
local loddyctr = ControllerManager.GetController(LoddyController)
loddyctr:UpdateUserInfo(_data, function(res)
if res.ReturnCode ~= 0 then
ViewUtil.ErrorTip(res.ReturnCode, "实名认证失败")
else
2025-09-05 16:23:34 +08:00
ViewUtil.ErrorTip(res.ReturnCode, "实名认证成功")
2025-05-22 18:14:21 +08:00
self:Destroy()
end
end)
2025-04-01 10:48:36 +08:00
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)
2025-04-01 10:48:36 +08:00
end
return M