forget-password.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <v-page>
  3. <v-header :title="$t('safe.b0')"></v-header>
  4. <main class="layout-main m-t-md">
  5. <view class="m-md bg-panel-3 rounded-sm overflow-hidden">
  6. <view class="form-item border-b p-md">
  7. <view class="label m-b-xs">{{$t('safe.b1')}}</view>
  8. <view class="input color-light">
  9. <v-input v-model="form.account" :placeholder="`${$t('safe.b2')}`" @blur="checkAccount"></v-input>
  10. </view>
  11. </view>
  12. <view class="form-item border-b p-md">
  13. <view class="label m-b-xs">{{$t('safe.b3')}}</view>
  14. <view class="input color-light">
  15. <v-input type="password" v-model="form.password" :placeholder="$t('safe.b4')"></v-input>
  16. </view>
  17. </view>
  18. <view class="form-item border-b p-md">
  19. <view class="label m-b-xs">{{$t('safe.b5')}}</view>
  20. <view class="input color-light">
  21. <v-input type="password" v-model="form.password_confirmation" :placeholder="$t('safe.b6')"></v-input>
  22. </view>
  23. </view>
  24. <view class="form-item border-b p-md" v-if="checkData.phone_status==1">
  25. <view class="label m-b-xs">SMS{{$t('safe.a7')}}</view>
  26. <view class="input color-light">
  27. <v-input v-model="form.sms_code" :placeholder="$t('safe.a6')">
  28. <template #right>
  29. <v-code
  30. url="/user/sendSmsCodeForgetPassword"
  31. :data="{country_code:checkData.country_code,phone:form.account}"
  32. ></v-code>
  33. </template>
  34. </v-input>
  35. </view>
  36. </view>
  37. </view>
  38. <view class="form-item border-b p-md" v-if="checkData.email_status==1">
  39. <view class="label m-b-xs">{{$t('safe.a5')}}</view>
  40. <view class="input color-light">
  41. <v-input v-model="form.email_code" :placeholder="$t('safe.a6')">
  42. <template #right>
  43. <v-code url="/user/sendEmailCodeForgetPassword" :data="{email:form.account}"></v-code>
  44. </template>
  45. </v-input>
  46. </view>
  47. </view>
  48. <view class="form-item border-b p-md" v-if="checkData.google_status==1">
  49. <view class="label m-b-xs">google{{$t('safe.a7')}}</view>
  50. <view class="input color-light">
  51. <v-input v-model="form.google_code" :placeholder="$t('safe.a6')"></v-input>
  52. </view>
  53. </view>
  54. </main>
  55. <view class="p-md">
  56. <v-button class="w-max rounded-lg" block ref="btn" type="green" @click="submit">{{$t('safe.b7')}}</v-button>
  57. </view>
  58. <van-toast id="van-toast" />
  59. </v-page>
  60. </template>
  61. <script>
  62. import Setting from "@/api/setting";
  63. export default {
  64. data() {
  65. return {
  66. country_id: 1,
  67. form: {
  68. account: "",
  69. sms_code: "",
  70. email_code: "",
  71. google_code: "",
  72. password: "",
  73. password_confirmation: "",
  74. },
  75. checkData: {},
  76. };
  77. },
  78. computed: {
  79. },
  80. methods: {
  81. checkAccount() {
  82. Setting.forgetPasswordAttempt({ account: this.form.account })
  83. .then((res) => {
  84. this.checkData = res.data;
  85. })
  86. .catch(() => {
  87. this.checkData = {};
  88. if (this.form.account) {
  89. this.$toast(this.$t('safe.b8'));
  90. }
  91. });
  92. },
  93. submit() {
  94. Setting.forgetPassword(this.form, { btn: this.$refs.btn })
  95. .then(() => {
  96. this.$back();
  97. })
  98. .catch(() => {});
  99. },
  100. },
  101. };
  102. </script>
  103. <style lang="scss" scoped>
  104. </style>