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.

87 lines
2.1 KiB

  1. -- 实名认证
  2. local ShiMingView = class("ShiMingView", cc.UIView)
  3. function ShiMingView:ctor(ShiMingRenZhengData,parent)
  4. ShiMingView.super.ctor(self);
  5. local ui = loadUI("res/ui/ui_dating/ui_shiming.ui")
  6. self.ui = ui
  7. self:addChild(ui)
  8. app.php.inShiMingView = true
  9. end
  10. function ShiMingView:onEnter()
  11. ShiMingView.super.onEnter(self)
  12. self.ui.Items.Button_Close:registerClick(handler(self , self.onClickClose))
  13. -- self.ui.Items.Button_Done:registerClick(handler(self , self.onClickClose))
  14. self.ui.Items.Button_Commit:registerClick(handler(self , self.onClickSubmit))
  15. self:bindEvent(app, "onGetShiMingInfoResponse", handler(self, self.updateView))
  16. self:bindEvent(app, "onBindShiMingResponse", handler(self, self.updateView))
  17. self:updateView();
  18. -- 请求实名认证数据
  19. app.php:requestGetShiMingInfo()
  20. end
  21. function ShiMingView:updateView()
  22. local shimingData = app.php.shimingData;
  23. if not shimingData then
  24. return
  25. end
  26. if shimingData.card == "" then
  27. self.ui.Items.Button_Close:setVisible(app.php.curTimeElapse < app.php.online.fiveHour)
  28. else
  29. self.ui.Items.Button_Close:setVisible(true)
  30. end
  31. --姓名更新
  32. if shimingData.name and shimingData.name ~= "" then
  33. self.ui.Items.TextField_Name:setText(tostring(shimingData.name))
  34. self.ui.Items.TextField_ID:setText(tostring(shimingData.card or ""))
  35. self.ui.Items.TextField_Name:setTouchEnabled(false)
  36. self.ui.Items.TextField_ID:setTouchEnabled(false)
  37. self.ui.Items.Button_Commit:setVisible(false)
  38. self.ui.Items.Text_Tip:setVisible(true)
  39. end
  40. end
  41. -- 提交数据
  42. function ShiMingView:onClickSubmit()
  43. playBtnEffect()
  44. --姓名
  45. local name = self.ui.Items.TextField_Name:getText()
  46. --身份证
  47. local identity = self.ui.Items.TextField_ID:getText()
  48. if name == "" then
  49. showTooltip("请输入姓名!")
  50. return
  51. end
  52. if identity == "" then
  53. showTooltip("请输入身份证!")
  54. return
  55. end
  56. app.php:requestBindShiMing(name, identity)
  57. end
  58. -- 关闭
  59. function ShiMingView:onClickClose()
  60. playBtnCloseEffect()
  61. app.php.inShiMingView = false
  62. self:removeFromParent()
  63. end
  64. return ShiMingView;