2727 type =" password"
2828 class =" input-item"
2929 v-model =" resetPasswordForm.re_password"
30- :placeholder =" $t('views.user.userForm.form.re_password.placeholder ')"
30+ :placeholder =" $t('views.login.enterPassword ')"
3131 show-password
3232 >
3333 </el-input >
3434 </el-form-item >
3535 </el-form >
36- <el-form
37- class =" reset-password-form mb-24"
38- ref =" resetPasswordFormRef2"
39- :model =" resetPasswordForm"
40- :rules =" rules2"
41- >
42- <p class =" mb-8 lighter" >{{ $t('views.login.useEmail') }}</p >
43- <el-form-item style =" margin-bottom : 8px " >
44- <el-input
45- class =" input-item"
46- :disabled =" true"
47- v-bind:modelValue =" user.userInfo?.email"
48- :placeholder =" t('views.user.userForm.form.email.placeholder')"
49- >
50- </el-input >
51- </el-form-item >
52- <el-form-item prop =" code" >
53- <div class =" flex-between w-full" >
54- <el-input
55- class =" code-input"
56- v-model =" resetPasswordForm.code"
57- :placeholder =" $t('views.login.verificationCode.placeholder')"
58- >
59- </el-input >
60- <el-button
61- :disabled =" isDisabled"
62- class =" send-email-button ml-8"
63- @click =" sendEmail"
64- :loading =" loading"
65- >
66- {{
67- isDisabled
68- ? `${$t('views.login.verificationCode.resend')}(${time}s)`
69- : $t('views.login.verificationCode.getVerificationCode')
70- }}
71- </el-button >
72- </div >
73- </el-form-item >
74- </el-form >
36+ <!-- < el-form-->
37+ <!-- class="reset-password-form mb-24"-->
38+ <!-- ref="resetPasswordFormRef2"-->
39+ <!-- :model="resetPasswordForm"-->
40+ <!-- :rules="rules2"-->
41+ <!-- > -- >
42+ <!-- <p class="mb-8 lighter">{{ $t('views.login.useEmail') }}</p> -- >
43+ <!-- <el-form-item style="margin-bottom: 8px"> -- >
44+ <!-- <el-input-->
45+ <!-- class="input-item"-->
46+ <!-- :disabled="true"-->
47+ <!-- v-bind:modelValue="user.userInfo?.email"-->
48+ <!-- :placeholder="t('views.user.userForm.form.email.placeholder')"-->
49+ <!-- > -- >
50+ <!-- </el-input> -- >
51+ <!-- </el-form-item> -- >
52+ <!-- <el-form-item prop="code"> -- >
53+ <!-- <div class="flex-between w-full"> -- >
54+ <!-- <el-input-->
55+ <!-- class="code-input"-->
56+ <!-- v-model="resetPasswordForm.code"-->
57+ <!-- :placeholder="$t('views.login.verificationCode.placeholder')"-->
58+ <!-- > -- >
59+ <!-- </el-input> -- >
60+ <!-- <el-button-->
61+ <!-- :disabled="isDisabled"-->
62+ <!-- class="send-email-button ml-8"-->
63+ <!-- @click="sendEmail"-->
64+ <!-- :loading="loading"-->
65+ <!-- > -- >
66+ <!-- {{ -->
67+ <!-- isDisabled-->
68+ <!-- ? `${$t('views.login.verificationCode.resend')}(${time}s)`-->
69+ <!-- : $t('views.login.verificationCode.getVerificationCode')-->
70+ <!-- }} -->
71+ <!-- </el-button> -- >
72+ <!-- </div> -- >
73+ <!-- </el-form-item> -- >
74+ <!-- < /el-form> -- >
7575 <template #footer >
7676 <div class =" dialog-footer" >
7777 <el-button @click =" resetPasswordDialog = false" >{{ $t('common.cancel') }}</el-button >
8383 </el-dialog >
8484</template >
8585<script setup lang="ts">
86- import { ref } from ' vue'
87- import type { ResetCurrentUserPasswordRequest } from ' @/api/type/user'
88- import type { FormInstance , FormRules } from ' element-plus'
89- import { MsgSuccess } from ' @/utils/message'
90- import UserApi from ' @/api/user/user'
86+ import {ref } from ' vue'
87+ import type {ResetCurrentUserPasswordRequest } from ' @/api/type/user'
88+ import type {FormInstance , FormRules } from ' element-plus'
89+ import UserApi from ' @/api/user/user-manage'
9190import useStore from ' @/stores'
92- import { useRouter } from ' vue-router'
93- import { t } from ' @/locales'
91+ import {useRouter } from ' vue-router'
92+ import {t } from ' @/locales'
93+
9494const router = useRouter ()
95- const { user } = useStore ()
95+ const {user} = useStore ()
9696
9797const resetPasswordDialog = ref <boolean >(false )
9898
@@ -147,28 +147,28 @@ const rules1 = ref<FormRules<ResetCurrentUserPasswordRequest>>({
147147 }
148148 ]
149149})
150- const rules2 = ref <FormRules <ResetCurrentUserPasswordRequest >>({
151- // @ts-ignore
152- code: [
153- {
154- required: true ,
155- message: t (' views.login.verificationCode.placeholder' ),
156- trigger: ' blur'
157- }
158- ]
159- })
160- /**
161- * 发送验证码
162- */
163- const sendEmail = () => {
164- resetPasswordFormRef1 .value ?.validate ().then (() => {
165- UserApi .sendEmailToCurrent (loading ).then (() => {
166- MsgSuccess (t (' views.login.verificationCode.successMessage' ))
167- isDisabled .value = true
168- handleTimeChange ()
169- })
170- })
171- }
150+ // const rules2 = ref<FormRules<ResetCurrentUserPasswordRequest>>({
151+ // // @ts-ignore
152+ // code: [
153+ // {
154+ // required: true,
155+ // message: t('views.login.verificationCode.placeholder'),
156+ // trigger: 'blur'
157+ // }
158+ // ]
159+ // })
160+ // / **
161+ // * 发送验证码
162+ // */
163+ // const sendEmail = () => {
164+ // resetPasswordFormRef1.value?.validate().then(() => {
165+ // UserApi.sendEmailToCurrent(loading).then(() => {
166+ // MsgSuccess(t('views.login.verificationCode.successMessage'))
167+ // isDisabled.value = true
168+ // handleTimeChange()
169+ // })
170+ // })
171+ // }
172172
173173const handleTimeChange = () => {
174174 if (time .value <= 0 ) {
@@ -184,7 +184,7 @@ const handleTimeChange = () => {
184184
185185const open = () => {
186186 resetPasswordForm .value = {
187- code: ' ' ,
187+ // code: '',
188188 password: ' ' ,
189189 re_password: ' '
190190 }
@@ -194,23 +194,17 @@ const open = () => {
194194}
195195const resetPassword = () => {
196196 resetPasswordFormRef1 .value ?.validate ().then (() => {
197- resetPasswordFormRef2 .value
198- ?.validate ()
199- .then (() => {
200- return UserApi .resetCurrentUserPassword (resetPasswordForm .value )
201- })
202- .then (() => {
203- return user .logout ()
204- })
197+ return UserApi .resetCurrentPassword (resetPasswordForm .value )
205198 .then (() => {
206- router .push ({ name: ' login' })
199+ user .logout ()
200+ router .push ({name: ' login' })
207201 })
208202 })
209203}
210204const close = () => {
211205 resetPasswordDialog .value = false
212206}
213207
214- defineExpose ({ open , close })
208+ defineExpose ({open , close })
215209 </script >
216210<style lang="scss" scope></style >
0 commit comments