ResetPsdView.ts 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import { _decorator, Button, Color, EditBox, instantiate, Label, Node, RichText, Sprite, SpriteFrame, UITransform } from 'cc';
  2. import { UIView } from '@scripts/framework/ui/UIView';
  3. import { UIViewID } from '@scripts/define/UIDefine';
  4. import { UICloseReason } from '@scripts/framework/ui/UILayer';
  5. import { addBtnClick } from '@scripts/utils/UIHelper';
  6. import { AppKernel } from '@scripts/app/AppKernel';
  7. const { ccclass, property } = _decorator;
  8. @ccclass('ResetPsdView')
  9. export class ResetPsdView extends UIView {
  10. readonly viewId = UIViewID.ResetPsdView;
  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.ResetPsdView);
  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. protected onOpen(_params: unknown): void | Promise<void> {
  43. }
  44. protected onClose(_reason: UICloseReason): void | Promise<void> {
  45. }
  46. protected onDestroy(): void {
  47. }
  48. }