xuruiqian
2025-06-04 17ce21955b4e3402d3d5868b52e50bfdd55bc572
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
<template>
    <el-container id="portal-layout">
        <el-header class="portal-layout-header" style="height: 100px;">
            <div class="portal-layout-header-title">
                <el-row>
                    <el-col :span="8">
                        <el-image class="portal-layout-header-title-logo" fit="fill" src="/favicon.ico"></el-image>
                    </el-col>
                    <el-col :span="2">
                    </el-col>
                    <el-col :span="14">
                        <p class="portal-layout-header-title-text">
                            {{ $t('message.title') }} | {{ $t('message.retrievepassword') }}
                        </p>
                    </el-col>
                </el-row>
            </div>
            <div class="portal-layout-header-controls">
 
            </div>
        </el-header>
        <el-divider :style="{'background-color':'#eceef9', 'margin':'1px 0px'}"></el-divider>
        <el-main style="padding: 0px;overflow-y: scroll;">
            <el-row>
                <el-col :span="2" align="left"></el-col>
                <el-col :span="20" align="left">
                    <el-card style="margin: 100px; padding: 50px; background-color: white">
                        <el-steps :active="activestep" finish-status="success">
                            <el-step :title="$t('label.Account')" :icon="icon.User"/>
                            <el-step :title="$t('label.SecurityVerification')" :icon="icon.Lock"/>
                            <el-step :title="$t('label.NewPassword')" :icon="icon.Key"/>
                            <el-step :title="$t('label.Done')" :icon="icon.Finished"/>
                        </el-steps>
                        <div style="padding: 40px;">
                            <el-row v-if="activestep===0">
                                <el-col :span="24" align="center">
                                    <el-form size="default" :rules="rules" ref="oneStepForm" v-loading="loading"
                                             :model="model">
                                        <el-form-item prop="username" :label="$t('label.username')" label-width="135px">
                                            <el-input size="default" link maxlength="64"
                                                      :prefix-icon="icon.User"
                                                      v-model="model.username" auto-complete="off"
                                                      style="width: calc(100% - 150px); "
                                                      :placeholder="`${$t('message.pleaseinput')}${$t('label.username')}!`"></el-input>
                                        </el-form-item>
                                        <el-form-item prop="verifycode" :label="$t('label.verifycode')"
                                                      label-width="135px">
                                            <el-input size="default" link v-model="model.verifycode" maxlength="64"
                                                      auto-complete="off"
                                                      style="width: calc(100% - 150px); "
                                                      :placeholder="`${$t('message.pleaseinput')}${$t('label.verifycode')}!`"></el-input>
                                            <el-image :src="vcUrl" size="default" @click="updateVerifyCode"
                                                      fit="fill"
                                                      style="width: 120px; height: 32px;"/>
                                        </el-form-item>
                                        <el-button type="primary" @click="accountVerify" :icon="icon.CircleCheck"
                                                   size="default">
                                            {{ $t('label.Verify')}}
                                        </el-button>
                                    </el-form>
                                </el-col>
                            </el-row>
                            <el-row v-else-if="activestep===1">
                                <el-col :span="24" align="center">
                                    <el-form size="default" :rules="rules" ref="towStepForm" v-loading="loading"
                                             :model="model">
                                        <el-form-item prop="username" :label="$t('label.username')" label-width="135px">
                                            <el-input size="default" link maxlength="64"
                                                      :prefix-icon="icon.User"
                                                      v-model="model.username" auto-complete="off"
                                                      style="width: calc(100% - 150px); "
                                                      :placeholder="`${$t('message.pleaseinput')}${$t('label.username')}!`"></el-input>
                                        </el-form-item>
                                        <el-form-item prop="verifycode" :label="$t('label.verifycode')"
                                                      label-width="135px">
                                            <el-input size="default" link v-model="model.verifycode" maxlength="64"
                                                      auto-complete="off"
                                                      style="width: calc(100% - 150px); "
                                                      :placeholder="`${$t('message.pleaseinput')}${$t('label.verifycode')}!`"></el-input>
                                            <el-image :src="vcUrl" size="default" @click="updateVerifyCode"
                                                      fit="fill"
                                                      style="width: 120px; height: 32px;"/>
                                        </el-form-item>
                                        <el-button type="primary" @click="securityVerify" :icon="icon.CircleCheck"
                                                   size="default">
                                            {{ $t('label.Verify')}}
                                        </el-button>
                                    </el-form>
                                </el-col>
                            </el-row>
                            <el-row v-else-if="activestep===2">
                                <el-col :span="24" align="center">
                                    <el-form :rules="rules" ref="threeStepForm" v-loading="loading"
                                             :model="model" size="default">
                                        <el-form-item prop="newpassword" :label="$t('label.newpassword')"
                                                      label-width="135px">
                                            <el-input size="default" type="password" maxlength="64"
                                                      :prefix-icon="icon.Key"
                                                      v-model="model.newpassword" auto-complete="off"
                                                      style="width: calc(100% - 150px); "
                                                      :placeholder="`${$t('message.pleaseinput')}${$t('label.newpassword')}!`"></el-input>
                                        </el-form-item>
                                        <el-form-item prop="confirmpassword" :label="$t('label.confirmpassword')"
                                                      label-width="135px">
                                            <el-input size="default" type="password" maxlength="64"
                                                      :prefix-icon="icon.Key"
                                                      v-model="model.confirmpassword" auto-complete="off"
                                                      style="width: calc(100% - 150px); "
                                                      :placeholder="`${$t('message.pleaseinput')}${$t('label.confirmpassword')}!`"></el-input>
                                        </el-form-item>
                                        <el-button type="primary" @click="resetPassword" :icon="icon.CircleCheck"
                                                   size="default">
                                            {{$t('label.Verify')}}
                                        </el-button>
                                    </el-form>
                                </el-col>
                            </el-row>
                            <el-row v-else-if="activestep===3">
                                <el-col :span="24" align="center">
                                    <svg-icon width="100" height="100" name="done"></svg-icon>
                                    <br/>
                                    <br/>
                                    <br/>
                                    <el-link type="success" @click="finishRetrievePassword"
                                             :icon="icon.CircleCheck"
                                             size="default" link>
                                        {{$t('button.ReLogin')}}
                                    </el-link>
                                </el-col>
                            </el-row>
                        </div>
                    </el-card>
                </el-col>
                <el-col :span="2" align="left"></el-col>
            </el-row>
        </el-main>
        <el-footer class="portal-layout-footer" style="height: 40px; bottom: 0px">
            <div class="portal-layout-footer-context">
                <p>Copyright © 2021 www.wisdomdeliver.com {{ $t('message.AllRightReserved')}} | 津ICP备2021008314号-1 </p>
            </div>
        </el-footer>
    </el-container>
</template>
 
<script>
    import * as icon from '@element-plus/icons-vue'
    import {getCurrentInstance, onBeforeUnmount, onMounted, reactive, toRefs} from "vue";
    import {getVerifyCodeUrl} from "@/api/admin/security";
 
    export default {
        name: "RetrievePassword",
        setup() {
            let {proxy} = getCurrentInstance();
            const state = reactive({
                loading: false,
                activestep: 0,
                vcUrl: "",
                model: {
                    username: '',
                    password: '',
                    newpassword: '',
                    confirmpassword: '',
                    verifycode: ''
                },
                rules: {
                    username: [{
                        required: true,
                        message: `${proxy.$t('message.isrequirded', {name: proxy.$t('label.username')})}`,
                        trigger: 'blur'
                    }],
                    newpassword: [{
                        required: true,
                        message: `${proxy.$t('message.isrequirded', {name: proxy.$t('label.newpassword')})}`,
                        trigger: 'blur'
                    }],
                    confirmpassword: [{
                        required: true,
                        message: `${proxy.$t('message.isrequirded', {name: proxy.$t('label.confirmpassword')})}`,
                        trigger: 'blur'
                    }],
                    verifycode: [{
                        required: true,
                        message: `${proxy.$t('message.isrequirded', {name: proxy.$t('label.verifycode')})}`,
                        trigger: 'blur'
                    }]
                }
            });
 
            onMounted(() => {
                Init();
                LoadData();
            });
            onBeforeUnmount(() => {
 
            });
 
            const Init = () => {
                updateVerifyCode();
            };
            const LoadData = () => {
 
            };
            const key = () => {
                return Math.random();
            };
            const updateVerifyCode = () => {
                state.vcUrl = getVerifyCodeUrl();
                state.model.verifycode = '';
            };
            const accountVerify = () => {
                proxy.$refs.oneStepForm.validate((valid) => {
                    if (valid) {
                        state.loading = true;
                        state.activestep++;
                        state.loading = false;
                    } else {
                        return false;
                    }
                });
            }
            const securityVerify = () => {
                proxy.$refs.towStepForm.validate((valid) => {
                    if (valid) {
                        state.loading = true;
                        state.activestep++;
                        state.loading = false;
                    } else {
                        return false;
                    }
                });
            }
            const resetPassword = () => {
                proxy.$refs.threeStepForm.validate((valid) => {
                    if (valid) {
                        state.loading = true;
                        state.activestep++;
                        state.loading = false;
                    } else {
                        return false;
                    }
                });
            }
            const finishRetrievePassword = () => {
                proxy.$router.replace("/admin/login");
            }
 
            return {
                ...toRefs(state), key, icon,
                updateVerifyCode,
                accountVerify,
                securityVerify,
                resetPassword,
                finishRetrievePassword,
            }
        },
    }
</script>
 
<style scoped>
 
</style>