ClubChangeInSurePsw.js 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. cc.Class({
  2. extends: cc.BaseClass,
  3. properties: {
  4. m_EdPSW: cc.EditBox,
  5. m_EdPSW2: cc.EditBox,
  6. },
  7. ctor: function () {
  8. },
  9. OnShowView: function (kind) {
  10. this.$('NdPhone').active = true;
  11. //this.$('NdPsw').active = false;
  12. this.m_EdPSW.string = '';
  13. this.m_EdPSW2.string = '';
  14. if (!this.m_VeriCtrl) {
  15. this.m_VeriCtrl = this.$('NdPhone@VerificationCtrl');
  16. this.m_VeriCtrl.SetHook(this, null);
  17. this.m_VeriCtrl.SetKey('ChangePsw');
  18. this.m_VeriCtrl.SetCheckState(2);
  19. }
  20. if(kind == 0){
  21. this.$('BGM/BGT/TChangePSW').active = true;
  22. this.$('BGM/BGT/TReSetPsw').active = false;
  23. }else{
  24. this.$('BGM/BGT/TChangePSW').active = false;
  25. this.$('BGM/BGT/TReSetPsw').active = true;
  26. }
  27. },
  28. OnClicked_Next: function () {
  29. cc.gSoundRes.PlaySound('Button');
  30. if (this.m_VeriCtrl) {
  31. var res = this.m_VeriCtrl.Check();
  32. if (res.code != 0) return;
  33. this.$('NdPhone').active = false;
  34. this.$('NdPsw').active = true;
  35. return;
  36. }
  37. },
  38. OnClicked_Submit: function () {
  39. cc.gSoundRes.PlaySound('Button');
  40. //验证
  41. if (this.m_EdPSW.string.length < 6) {
  42. this.ShowTips("請填寫6-8位密碼")
  43. return
  44. }
  45. if (this.m_EdPSW.string != this.m_EdPSW2.string) {
  46. this.ShowTips("2次密碼輸入不一致")
  47. return
  48. }
  49. if (this.m_VeriCtrl) {
  50. var res = this.m_VeriCtrl.Check();
  51. if (res.code != 0) {
  52. return;
  53. }
  54. }
  55. var webUrl = `${window.PHP_HOME}/League.php?&GetMark=139&strPsw=${hex_md5(this.m_EdPSW.string)}&PhoneNum=${res.PhoneNum}&Code=${res.PhoneCode}&dwClubID=${g_ShowClubInfo.dwClubID}`;
  56. WebCenter.GetData(webUrl, null, function (data) {
  57. var res = JSON.parse(data);
  58. if (res.Res == 0) this.m_VeriCtrl.Clear();
  59. this.ShowAlert(res.Describe, Alert_Yes, function (Res) {
  60. this.HideView();
  61. }.bind(this));
  62. }.bind(this));
  63. //重置界面
  64. this.m_EdPSW.string = '';
  65. this.m_EdPSW2.string = '';
  66. },
  67. });