|
|
@@ -4,23 +4,29 @@
|
|
|
<van-cell-group>
|
|
|
<van-field
|
|
|
v-model="state.form.oldPassword"
|
|
|
- type="password"
|
|
|
+ :type="state.showOldPassword ? 'text' : 'password'"
|
|
|
label="旧密码"
|
|
|
placeholder="旧密码"
|
|
|
+ :right-icon="state.showOldPassword ? 'eye-o' : 'closed-eye'"
|
|
|
+ @click-right-icon="state.showOldPassword = !state.showOldPassword"
|
|
|
:rules="[{ required: true, message: '请输入旧密码' }]"
|
|
|
/>
|
|
|
<van-field
|
|
|
v-model="state.form.newPassword"
|
|
|
- type="password"
|
|
|
+ :type="state.showNewPassword ? 'text' : 'password'"
|
|
|
label="新密码"
|
|
|
placeholder="新密码"
|
|
|
+ :right-icon="state.showNewPassword ? 'eye-o' : 'closed-eye'"
|
|
|
+ @click-right-icon="state.showNewPassword = !state.showNewPassword"
|
|
|
:rules="[{ required: true, message: '请输入新密码' }, {validator: checkPassword, message: '密码不合法'}]"
|
|
|
/>
|
|
|
<van-field
|
|
|
v-model="state.form.newPassword2"
|
|
|
- type="password"
|
|
|
+ :type="state.showNewPassword2 ? 'text' : 'password'"
|
|
|
label="确认密码"
|
|
|
placeholder="确认密码"
|
|
|
+ :right-icon="state.showNewPassword2 ? 'eye-o' : 'closed-eye'"
|
|
|
+ @click-right-icon="state.showNewPassword2 = !state.showNewPassword2"
|
|
|
:rules="[{ required: true, message: '请输入确认密码', validator: checkConfirmPassword }]"
|
|
|
/>
|
|
|
</van-cell-group>
|
|
|
@@ -56,6 +62,9 @@
|
|
|
const userSexList = ref(<RowDicDataType[]>[])
|
|
|
const loginApi = useLoginApi()
|
|
|
const state = reactive({
|
|
|
+ showOldPassword: false,
|
|
|
+ showNewPassword: false,
|
|
|
+ showNewPassword2: false,
|
|
|
form: {
|
|
|
oldPassword: '',
|
|
|
newPassword: '',
|
|
|
@@ -82,8 +91,8 @@
|
|
|
.then(res => {
|
|
|
return true
|
|
|
})
|
|
|
- .catch(() => {
|
|
|
- return "密码不合法"
|
|
|
+ .catch((err) => {
|
|
|
+ return err.message || "密码不合法"
|
|
|
})
|
|
|
}
|
|
|
const checkConfirmPassword = (value: string) => {
|