close #12 fix: phone validator error

pull/13/head
ROC 3 years ago
parent f87f99ea5e
commit 995e636ded

@ -94,7 +94,11 @@
</div> </div>
<div class="phone-bind-wrap" v-if="showPhoneBind"> <div class="phone-bind-wrap" v-if="showPhoneBind">
<n-form ref="phoneFormRef" :model="model" :rules="bindRules"> <n-form
ref="phoneFormRef"
:model="modelData"
:rules="bindRules"
>
<n-form-item path="phone" label="手机号"> <n-form-item path="phone" label="手机号">
<n-input <n-input
:value="modelData.phone" :value="modelData.phone"
@ -177,7 +181,7 @@
</n-button> </n-button>
<div class="phone-bind-wrap" v-if="showPasswordSetting"> <div class="phone-bind-wrap" v-if="showPasswordSetting">
<n-form ref="formRef" :model="model" :rules="passwordRules"> <n-form ref="formRef" :model="modelData" :rules="passwordRules">
<n-form-item path="old_password" label="旧密码"> <n-form-item path="old_password" label="旧密码">
<n-input <n-input
v-model:value="modelData.old_password" v-model:value="modelData.old_password"
@ -249,7 +253,13 @@ import {
changeNickname, changeNickname,
changeAvatar, changeAvatar,
} from '@/api/user'; } from '@/api/user';
import type { UploadInst, FormItemRule, FormItemInst, FormInst, InputInst } from "naive-ui" import type {
UploadInst,
FormItemRule,
FormItemInst,
FormInst,
InputInst,
} from 'naive-ui';
const uploadGateway = import.meta.env.VITE_HOST + '/attachment'; const uploadGateway = import.meta.env.VITE_HOST + '/attachment';
const uploadToken = 'Bearer ' + localStorage.getItem('PAOPAO_TOKEN'); const uploadToken = 'Bearer ' + localStorage.getItem('PAOPAO_TOKEN');
@ -280,8 +290,6 @@ const modelData = reactive({
reenteredPassword: null, reenteredPassword: null,
}); });
const model = ref<AnyObject>({})
const beforeUpload = async (data: any) => { const beforeUpload = async (data: any) => {
// 图片类型校验 // 图片类型校验
if ( if (
@ -391,13 +399,11 @@ const handlePhoneBind = (e: MouseEvent) => {
phone: modelData.phone, phone: modelData.phone,
}); });
model.value = { modelData.id = '';
id: '', modelData.b64s = '';
b64s: '', modelData.imgCaptcha = '';
imgCaptcha: '', modelData.phone = '';
phone: null, modelData.phone_captcha = '';
phone_captcha: null,
};
}) })
.catch((err) => { .catch((err) => {
binding.value = false; binding.value = false;

Loading…
Cancel
Save