|
- -- 成员列表Layout
- local TiantiBaoming = class("TiantiBaoming" , cc.UIView);
-
-
- function TiantiBaoming:ctor()
- TiantiBaoming.super.ctor(self)
-
-
-
- self:loadUI()
- end
-
- function TiantiBaoming:loadUI()
- local ui = loadUI("res/ui/ui_tianti/ui_tianti_baoming.ui")
-
- self.ui = ui;
- self:addChild(ui);
- end
-
- function TiantiBaoming:onEnter()
- TiantiBaoming.super.onEnter(self)
-
- self:initView()
- self:registerButton()
- self:initBindEvent()
- end
-
-
- function TiantiBaoming:registerButton()
- self.ui.Items.Button_Close:registerClick(handler(self,self.onClose))
- --获取验证码
- self.ui.Items.Button_Code:registerClick(handler(self, self.onClickGetcode));
-
- self.ui.Items.Button_Sure:registerClick(handler(self, self.onClickOk))
- end
-
- function TiantiBaoming:onClickOk()
- playBtnEffect()
- self:doRequestBaoming();
-
- end
-
-
- function TiantiBaoming:doRequestBaoming()
-
- local name = self.ui.Items.TextField_input_name:getString()
- local phoneNum = self.ui.Items.TextField_input_phone:getString()
- local password = self.ui.Items.TextField_input_code: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 code = self.ui.Items.TextField_input_code:getString()
- local phone = self.ui.Items.TextField_input_phone:getString()
- local realname = self.ui.Items.TextField_input_name:getString()
-
-
- local localData =
- {
- gamename = gamename,
- code = code,
- phone = phone,
- realname = realname,
- type = 1,
- }
- app.club_php:requestTiantiBaoming(localData,handler(self,self.afterBaoming))
-
- playBtnCloseEffect()
- self:removeFromParent()
- end
-
- function TiantiBaoming:afterBaoming(result)
-
-
-
- end
-
- function TiantiBaoming:onClickGetcode()
- playBtnEffect()
-
- local phoneNum = self.ui.Items.TextField_input_phone:getString()
- if string.len(phoneNum) ~= 11 or not checkIsNumberString(phoneNum) then
- showTooltip("您输入的手机号码格式不正确")
- return
- end
-
- self.ui.Items.Button_Code:setVisible(false)
- self:showTimeDown(60)
-
- self.phoneNum = phoneNum
- -- app.php:requestBindPhoneProvingCode(self.phoneNum)
-
- app.club_php:requestTiantiSms(self.phoneNum,handler(self,self.afterGetCode))
- end
-
- function TiantiBaoming:afterGetCode(result)
- -- logD("lwq_result_baoming_"..table.tostring(result))
-
- end
-
-
- function TiantiBaoming:showTimeDown(timeLeft)
- self.ui.Items.Text_TimeDown:setVisible(true)
- self.ui.Items.Text_TimeDown:startRemainTime(tonumber(timeLeft) or 0, function(obj, value)
- value = math.floor(value + 0.5)
- self.ui.Items.Text_TimeDown:setText(value.."秒后重试")
- self.ui.Items.Button_Code:setVisible(value <= 0)
- end)
- end
-
- function TiantiBaoming:onClose()
- playBtnCloseEffect()
- self:removeFromParent()
- end
-
- function TiantiBaoming:onRank()
- -- local view = import("luaScript.Views.Tianti.ClubTable"):new(app.club_php.clubID)
- -- view:setAnchorPoint(cc.p(0.5, 0.5))
- -- app:showWaitDialog(view)
-
- end
-
- function TiantiBaoming:onShangcheng()
-
- end
- function TiantiBaoming:onBaomingcanjia()
-
- end
- function TiantiBaoming:onBaomingxinxi()
-
- end
-
- function TiantiBaoming:initBindEvent()
- --权限发生改变
- -- self:bindEvent(app.club_php , GAME_EVENT.CLUB_CHANGE_ROLE , handler(self , self.onChangeRole));
-
- -- --绑定比赛开关回调
- -- self:bindEvent(app.club_php , GAME_EVENT.CLUB_SET , handler(self , self.onSetSuccess));
-
- -- --解散茶馆
- -- self:bindEvent(app.club_php , GAME_EVENT.CLUB_JIE_SAN , handler(self , self.onClubJieSanEvent))
- -- --打开下级
- -- self:bindEvent(app.club_php , GAME_EVENT.CLUB_TEAM_VIEW , handler(self , self.openClubTeamView))
- end
-
- function TiantiBaoming: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)
- end
-
- return TiantiBaoming
|