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.

125 lines
2.8 KiB

  1. -- 成员列表Layout
  2. local TiantiBaomingInfo = class("TiantiBaomingInfo" , cc.UIView);
  3. function TiantiBaomingInfo:ctor()
  4. TiantiBaomingInfo.super.ctor(self)
  5. self:loadUI()
  6. end
  7. function TiantiBaomingInfo:loadUI()
  8. local ui = loadUI("res/ui/ui_tianti/ui_tianti_baoming_info.ui")
  9. self.ui = ui;
  10. self:addChild(ui);
  11. end
  12. function TiantiBaomingInfo:onEnter()
  13. TiantiBaomingInfo.super.onEnter(self)
  14. self:registerButton()
  15. self:initBindEvent()
  16. self:initView()
  17. end
  18. function TiantiBaomingInfo:initView()
  19. local userInfo = json.decode(app.user.userInfo);
  20. -- 游戏信息
  21. local nickname = getSubStringNickname(userInfo.nickname)
  22. self.ui.Items.TextField_input_gameinfo:setText(string.format("%s(%s)", nickname, tostring(app.user.loginInfo.uid)))
  23. self.ui.Items.TextField_input_gameinfo:setEnabled(false)
  24. local realname = app.club_php.tiantiInfo.realname
  25. self.ui.Items.TextField_input_name:setText(realname)
  26. local phone = app.club_php.tiantiInfo.phone
  27. self.ui.Items.TextField_input_phone:setText(phone)
  28. end
  29. function TiantiBaomingInfo:registerButton()
  30. self.ui.Items.Button_Close:registerClick(handler(self,self.onClose))
  31. self.ui.Items.Button_Sure:registerClick(handler(self, self.onClickOk))
  32. end
  33. function TiantiBaomingInfo:onClickOk()
  34. playBtnEffect()
  35. self:doRequestBaoming();
  36. end
  37. function TiantiBaomingInfo:doRequestBaoming()
  38. local name = self.ui.Items.TextField_input_name:getString()
  39. local phoneNum = self.ui.Items.TextField_input_phone:getString()
  40. -- 验证手机号码
  41. if string.len(phoneNum) ~= 11 or not checkIsNumberString(phoneNum) then
  42. showTooltip("您输入的手机号码格式不正确")
  43. return
  44. end
  45. if name == app.club_php.tiantiInfo.realname and phoneNum == app.club_php.tiantiInfo.phone then
  46. showTooltip("信息未更改")
  47. return
  48. end
  49. if name == "" then
  50. showTooltip("真实姓名不能为空")
  51. return
  52. end
  53. if string.match(name, " ") then
  54. showTooltip("真实姓名不能有空格")
  55. return
  56. end
  57. if string.match(name, "%d") or string.match(name, "%a") then
  58. showTooltip("您输入真实姓名")
  59. return
  60. end
  61. local userInfo = json.decode(app.user.userInfo);
  62. -- 昵称
  63. local nickname = getSubStringNickname(userInfo.nickname)
  64. local gamename = userInfo.nickname
  65. local phone = self.ui.Items.TextField_input_phone:getString()
  66. local realname = self.ui.Items.TextField_input_name:getString()
  67. local localData =
  68. {
  69. gamename = gamename,
  70. code = "",
  71. phone = phone,
  72. realname = realname,
  73. type = 2,
  74. }
  75. app.club_php:requestTiantiBaoming(localData,handler(self,self.afterBaoming))
  76. playBtnCloseEffect()
  77. self:removeFromParent()
  78. end
  79. function TiantiBaomingInfo:afterBaoming(result)
  80. end
  81. function TiantiBaomingInfo:onClose()
  82. playBtnCloseEffect()
  83. self:removeFromParent()
  84. end
  85. function TiantiBaomingInfo:initBindEvent()
  86. end
  87. return TiantiBaomingInfo