You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

180 lines
4.5 KiB

  1. -- 成员列表Layout
  2. local TiantiBaoming = class("TiantiBaoming" , cc.UIView);
  3. function TiantiBaoming:ctor()
  4. TiantiBaoming.super.ctor(self)
  5. self:loadUI()
  6. end
  7. function TiantiBaoming:loadUI()
  8. local ui = loadUI("res/ui/ui_tianti/ui_tianti_baoming.ui")
  9. self.ui = ui;
  10. self:addChild(ui);
  11. end
  12. function TiantiBaoming:onEnter()
  13. TiantiBaoming.super.onEnter(self)
  14. self:initView()
  15. self:registerButton()
  16. self:initBindEvent()
  17. end
  18. function TiantiBaoming:registerButton()
  19. self.ui.Items.Button_Close:registerClick(handler(self,self.onClose))
  20. --获取验证码
  21. self.ui.Items.Button_Code:registerClick(handler(self, self.onClickGetcode));
  22. self.ui.Items.Button_Sure:registerClick(handler(self, self.onClickOk))
  23. end
  24. function TiantiBaoming:onClickOk()
  25. playBtnEffect()
  26. self:doRequestBaoming();
  27. end
  28. function TiantiBaoming:doRequestBaoming()
  29. local name = self.ui.Items.TextField_input_name:getString()
  30. local phoneNum = self.ui.Items.TextField_input_phone:getString()
  31. local password = self.ui.Items.TextField_input_code:getString()
  32. -- 验证手机号码
  33. if string.len(phoneNum) ~= 11 or not checkIsNumberString(phoneNum) then
  34. showTooltip("您输入的手机号码格式不正确")
  35. return
  36. end
  37. if name == app.club_php.tiantiInfo.realname and phoneNum == app.club_php.tiantiInfo.phone then
  38. showTooltip("信息未更改")
  39. return
  40. end
  41. if name == "" then
  42. showTooltip("真实姓名不能为空")
  43. return
  44. end
  45. if string.match(name, " ") then
  46. showTooltip("真实姓名不能有空格")
  47. return
  48. end
  49. if string.match(name, "%d") or string.match(name, "%a") then
  50. showTooltip("您输入真实姓名")
  51. return
  52. end
  53. local userInfo = json.decode(app.user.userInfo);
  54. -- 昵称
  55. local nickname = getSubStringNickname(userInfo.nickname)
  56. local gamename = userInfo.nickname
  57. local code = self.ui.Items.TextField_input_code:getString()
  58. local phone = self.ui.Items.TextField_input_phone:getString()
  59. local realname = self.ui.Items.TextField_input_name:getString()
  60. local localData =
  61. {
  62. gamename = gamename,
  63. code = code,
  64. phone = phone,
  65. realname = realname,
  66. type = 1,
  67. }
  68. app.club_php:requestTiantiBaoming(localData,handler(self,self.afterBaoming))
  69. playBtnCloseEffect()
  70. self:removeFromParent()
  71. end
  72. function TiantiBaoming:afterBaoming(result)
  73. end
  74. function TiantiBaoming:onClickGetcode()
  75. playBtnEffect()
  76. local phoneNum = self.ui.Items.TextField_input_phone:getString()
  77. if string.len(phoneNum) ~= 11 or not checkIsNumberString(phoneNum) then
  78. showTooltip("您输入的手机号码格式不正确")
  79. return
  80. end
  81. self.ui.Items.Button_Code:setVisible(false)
  82. self:showTimeDown(60)
  83. self.phoneNum = phoneNum
  84. -- app.php:requestBindPhoneProvingCode(self.phoneNum)
  85. app.club_php:requestTiantiSms(self.phoneNum,handler(self,self.afterGetCode))
  86. end
  87. function TiantiBaoming:afterGetCode(result)
  88. -- logD("lwq_result_baoming_"..table.tostring(result))
  89. end
  90. function TiantiBaoming:showTimeDown(timeLeft)
  91. self.ui.Items.Text_TimeDown:setVisible(true)
  92. self.ui.Items.Text_TimeDown:startRemainTime(tonumber(timeLeft) or 0, function(obj, value)
  93. value = math.floor(value + 0.5)
  94. self.ui.Items.Text_TimeDown:setText(value.."秒后重试")
  95. self.ui.Items.Button_Code:setVisible(value <= 0)
  96. end)
  97. end
  98. function TiantiBaoming:onClose()
  99. playBtnCloseEffect()
  100. self:removeFromParent()
  101. end
  102. function TiantiBaoming:onRank()
  103. -- local view = import("luaScript.Views.Tianti.ClubTable"):new(app.club_php.clubID)
  104. -- view:setAnchorPoint(cc.p(0.5, 0.5))
  105. -- app:showWaitDialog(view)
  106. end
  107. function TiantiBaoming:onShangcheng()
  108. end
  109. function TiantiBaoming:onBaomingcanjia()
  110. end
  111. function TiantiBaoming:onBaomingxinxi()
  112. end
  113. function TiantiBaoming:initBindEvent()
  114. --权限发生改变
  115. -- self:bindEvent(app.club_php , GAME_EVENT.CLUB_CHANGE_ROLE , handler(self , self.onChangeRole));
  116. -- --绑定比赛开关回调
  117. -- self:bindEvent(app.club_php , GAME_EVENT.CLUB_SET , handler(self , self.onSetSuccess));
  118. -- --解散茶馆
  119. -- self:bindEvent(app.club_php , GAME_EVENT.CLUB_JIE_SAN , handler(self , self.onClubJieSanEvent))
  120. -- --打开下级
  121. -- self:bindEvent(app.club_php , GAME_EVENT.CLUB_TEAM_VIEW , handler(self , self.openClubTeamView))
  122. end
  123. function TiantiBaoming:initView()
  124. local userInfo = json.decode(app.user.userInfo);
  125. -- 游戏信息
  126. local nickname = getSubStringNickname(userInfo.nickname)
  127. self.ui.Items.TextField_input_gameinfo:setText(string.format("%s(%s)", nickname, tostring(app.user.loginInfo.uid)))
  128. self.ui.Items.TextField_input_gameinfo:setEnabled(false)
  129. end
  130. return TiantiBaoming