-- 成员列表Layout local TiantiBaomingInfo = class("TiantiBaomingInfo" , cc.UIView); function TiantiBaomingInfo:ctor() TiantiBaomingInfo.super.ctor(self) self:loadUI() end function TiantiBaomingInfo:loadUI() local ui = loadUI("res/ui/ui_tianti/ui_tianti_baoming_info.ui") self.ui = ui; self:addChild(ui); end function TiantiBaomingInfo:onEnter() TiantiBaomingInfo.super.onEnter(self) self:registerButton() self:initBindEvent() self:initView() end function TiantiBaomingInfo:initView() local userInfo = json.decode(app.user.userInfo); -- 游戏信息 local nickname = getSubStringNickname(userInfo.nickname) self.ui.Items.TextField_input_gameinfo:setText(string.format("%s(%s)", nickname, tostring(app.user.loginInfo.uid))) self.ui.Items.TextField_input_gameinfo:setEnabled(false) local realname = app.club_php.tiantiInfo.realname self.ui.Items.TextField_input_name:setText(realname) local phone = app.club_php.tiantiInfo.phone self.ui.Items.TextField_input_phone:setText(phone) end function TiantiBaomingInfo:registerButton() self.ui.Items.Button_Close:registerClick(handler(self,self.onClose)) self.ui.Items.Button_Sure:registerClick(handler(self, self.onClickOk)) end function TiantiBaomingInfo:onClickOk() playBtnEffect() self:doRequestBaoming(); end function TiantiBaomingInfo:doRequestBaoming() local name = self.ui.Items.TextField_input_name:getString() local phoneNum = self.ui.Items.TextField_input_phone:getString() -- 验证手机号码 if string.len(phoneNum) ~= 11 or not checkIsNumberString(phoneNum) then showTooltip("您输入的手机号码格式不正确") return end if name == app.club_php.tiantiInfo.realname and phoneNum == app.club_php.tiantiInfo.phone then showTooltip("信息未更改") return end if name == "" then showTooltip("真实姓名不能为空") return end if string.match(name, " ") then showTooltip("真实姓名不能有空格") return end if string.match(name, "%d") or string.match(name, "%a") then showTooltip("您输入真实姓名") return end local userInfo = json.decode(app.user.userInfo); -- 昵称 local nickname = getSubStringNickname(userInfo.nickname) local gamename = userInfo.nickname local phone = self.ui.Items.TextField_input_phone:getString() local realname = self.ui.Items.TextField_input_name:getString() local localData = { gamename = gamename, code = "", phone = phone, realname = realname, type = 2, } app.club_php:requestTiantiBaoming(localData,handler(self,self.afterBaoming)) playBtnCloseEffect() self:removeFromParent() end function TiantiBaomingInfo:afterBaoming(result) end function TiantiBaomingInfo:onClose() playBtnCloseEffect() self:removeFromParent() end function TiantiBaomingInfo:initBindEvent() end return TiantiBaomingInfo