ChangePsw.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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("2次密碼輸入不一致")
  43. return
  44. }
  45. if (this.m_EdPSW.string != this.m_EdPSW2.string) {
  46. this.ShowTips("")
  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}/UserFunc.php?&GetMark=31&strPsw=${hex_md5(this.m_EdPSW.string)}&PhoneNum=${res.PhoneNum}&Code=${res.PhoneCode}`;
  56. WebCenter.GetData(webUrl, null, function (data) {
  57. if (this.m_Hook) this.m_Hook.StopLoading();
  58. var res = JSON.parse(data);
  59. if (res.Res == 0) this.m_VeriCtrl.Clear();
  60. this.ShowAlert(res.Describe, Alert_Yes, function (Res) {
  61. this.HideView();
  62. }.bind(this));
  63. }.bind(this));
  64. //重置界面
  65. this.m_EdPSW.string = '';
  66. this.m_EdPSW2.string = '';
  67. },
  68. });