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