ResetPsd.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import { _decorator, Button, Color, EditBox, instantiate, Label, Node, RichText, Sprite, SpriteFrame, UITransform } from 'cc';
  2. import { UIViewID } from '@scripts/define/UIDefine';
  3. import { UICloseReason } from '@scripts/framework/ui/UILayer';
  4. import { addBtnClick } from '@scripts/utils/UIHelper';
  5. import { AppKernel } from '@scripts/app/AppKernel';
  6. import { UIPopup } from '@scripts/framework/ui/UIPopup';
  7. const { ccclass, property } = _decorator;
  8. @ccclass('ResetPsd')
  9. export class ResetPsd extends UIPopup {
  10. readonly viewId = UIViewID.ResetPsd;
  11. @property(Node)
  12. private btnClose: Node = null;
  13. @property(Node)
  14. private btnReset: Node = null;
  15. @property(EditBox)
  16. account: EditBox;
  17. @property(EditBox)
  18. code: EditBox;
  19. @property(EditBox)
  20. psd: EditBox;
  21. protected onCreate(): void | Promise<void> {
  22. addBtnClick(this.btnClose, this.onBtnCloseClick, this);
  23. addBtnClick(this.btnReset, this.onBtnResetClick, this);
  24. }
  25. private onBtnCloseClick() {
  26. AppKernel.ui.close(UIViewID.ResetPsd);
  27. const loginView = AppKernel.ui.get(UIViewID.LoginView) as any;
  28. if (loginView && loginView?.enabled) {
  29. loginView?._googleWebBtn?.setActive(true);
  30. }
  31. }
  32. private onBtnResetClick() {
  33. const account = this.account.string;
  34. const code = this.code.string;
  35. const password = this.psd.string;
  36. AppKernel.stores.mainStore.reqForgetPass({
  37. phone: account,
  38. code,
  39. newpassword: password,
  40. })
  41. }
  42. }