ForgetPasswordForm.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <template>
  2. <template v-if="getShow">
  3. <!--节点-->
  4. <a-steps style="margin-bottom: 20px" :current="currentTab">
  5. <a-step title="手机验证" />
  6. <a-step title="更改密码" />
  7. <a-step title="完成" />
  8. </a-steps>
  9. <!--组件-->
  10. <div>
  11. <step1 v-if="currentTab === 0" @nextStep="nextStep" />
  12. <step2 v-if="currentTab === 1" @nextStep="nextStep" @prevStep="prevStep" :accountInfo="accountInfo" />
  13. <step3 v-if="currentTab === 2" @prevStep="prevStep" @finish="finish" />
  14. </div>
  15. </template>
  16. </template>
  17. <script lang="ts" setup>
  18. import { reactive, ref, computed, unref } from 'vue';
  19. import { useLoginState, useFormRules, LoginStateEnum } from './useLogin';
  20. import step1 from '../forget-password/step1.vue';
  21. import step2 from '../forget-password/step2.vue';
  22. import step3 from '../forget-password/step3.vue';
  23. const { handleBackLogin, getLoginState } = useLoginState();
  24. const { getFormRules } = useFormRules();
  25. const formRef = ref();
  26. const loading = ref(false);
  27. const currentTab = ref(0);
  28. const formData = reactive({
  29. account: '',
  30. mobile: '',
  31. sms: '',
  32. });
  33. const getShow = computed(() => unref(getLoginState) === LoginStateEnum.RESET_PASSWORD);
  34. const accountInfo = reactive({
  35. obj: {
  36. username: '',
  37. phone: '',
  38. smscode: '',
  39. },
  40. });
  41. /**
  42. * 下一步
  43. * @param data
  44. */
  45. function nextStep(data) {
  46. accountInfo.obj = data;
  47. if (currentTab.value < 4) {
  48. currentTab.value += 1;
  49. }
  50. }
  51. /**
  52. * 上一步
  53. * @param data
  54. */
  55. function prevStep(data) {
  56. accountInfo.obj = data;
  57. if (currentTab.value > 0) {
  58. currentTab.value -= 1;
  59. }
  60. }
  61. /**
  62. * 结束
  63. */
  64. function finish() {
  65. currentTab.value = 0;
  66. }
  67. </script>