change constant name

pull/8/head
ROC 3 years ago
parent 043cc79853
commit 1018de002a

@ -97,8 +97,8 @@
<n-form ref="phoneFormRef" :model="model" :rules="bindRules"> <n-form ref="phoneFormRef" :model="model" :rules="bindRules">
<n-form-item path="phone" label="手机号"> <n-form-item path="phone" label="手机号">
<n-input <n-input
:value="model.phone" :value="modelData.phone"
@update:value="(v) => (model.phone = v.trim())" @update:value="(v) => (modelData.phone = v.trim())"
placeholder="请输入中国大陆手机号" placeholder="请输入中国大陆手机号"
@keydown.enter.prevent @keydown.enter.prevent
/> />
@ -106,13 +106,13 @@
<n-form-item path="img_captcha" label="图形验证码"> <n-form-item path="img_captcha" label="图形验证码">
<div class="captcha-img-wrap"> <div class="captcha-img-wrap">
<n-input <n-input
v-model:value="model.imgCaptcha" v-model:value="modelData.imgCaptcha"
placeholder="请输入图形验证码后获取验证码" placeholder="请输入图形验证码后获取验证码"
/> />
<div class="captcha-img"> <div class="captcha-img">
<img <img
v-if="model.b64s" v-if="modelData.b64s"
:src="model.b64s" :src="modelData.b64s"
@click="loadCaptcha" @click="loadCaptcha"
/> />
</div> </div>
@ -121,7 +121,7 @@
<n-form-item path="phone_captcha" label="短信验证码"> <n-form-item path="phone_captcha" label="短信验证码">
<n-input-group> <n-input-group>
<n-input <n-input
v-model:value="model.phone_captcha" v-model:value="modelData.phone_captcha"
placeholder="请输入收到的短信验证码" placeholder="请输入收到的短信验证码"
/> />
<n-button <n-button
@ -180,7 +180,7 @@
<n-form ref="formRef" :model="model" :rules="passwordRules"> <n-form ref="formRef" :model="model" :rules="passwordRules">
<n-form-item path="old_password" label="旧密码"> <n-form-item path="old_password" label="旧密码">
<n-input <n-input
v-model:value="model.old_password" v-model:value="modelData.old_password"
type="password" type="password"
placeholder="请输入当前密码" placeholder="请输入当前密码"
@keydown.enter.prevent @keydown.enter.prevent
@ -188,7 +188,7 @@
</n-form-item> </n-form-item>
<n-form-item path="password" label="新密码"> <n-form-item path="password" label="新密码">
<n-input <n-input
v-model:value="model.password" v-model:value="modelData.password"
type="password" type="password"
placeholder="请输入新密码" placeholder="请输入新密码"
@input="handlePasswordInput" @input="handlePasswordInput"
@ -202,8 +202,8 @@
label="重复密码" label="重复密码"
> >
<n-input <n-input
v-model:value="model.reenteredPassword" v-model:value="modelData.reenteredPassword"
:disabled="!model.password" :disabled="!modelData.password"
type="password" type="password"
placeholder="请再次输入密码" placeholder="请再次输入密码"
@keydown.enter.prevent @keydown.enter.prevent
@ -268,7 +268,7 @@ const showPhoneBind = ref(false);
const phoneFormRef = ref(null); const phoneFormRef = ref(null);
const formRef = ref(null); const formRef = ref(null);
const rPasswordFormItemRef = ref(null); const rPasswordFormItemRef = ref(null);
const model = reactive({ const modelData = reactive({
id: '', id: '',
b64s: '', b64s: '',
imgCaptcha: '', imgCaptcha: '',
@ -327,18 +327,18 @@ const finishUpload = ({ file, event }) => {
const validatePasswordStartWith = (rule, value) => { const validatePasswordStartWith = (rule, value) => {
return ( return (
!!model.password && !!modelData.password &&
model.password.startsWith(value) && modelData.password.startsWith(value) &&
model.password.length >= value.length modelData.password.length >= value.length
); );
}; };
const validatePasswordSame = (rule, value) => { const validatePasswordSame = (rule, value) => {
return value === model.password; return value === modelData.password;
}; };
const handlePasswordInput = () => { const handlePasswordInput = () => {
if (model.reenteredPassword) { if (modelData.reenteredPassword) {
rPasswordFormItemRef.value?.validate({ trigger: 'password-input' }); rPasswordFormItemRef.value?.validate({ trigger: 'password-input' });
} }
}; };
@ -349,8 +349,8 @@ const handleValidateButtonClick = (e) => {
if (!errors) { if (!errors) {
passwordSetting.value = true; passwordSetting.value = true;
changePassword({ changePassword({
password: model.password, password: modelData.password,
old_password: model.old_password, old_password: modelData.old_password,
}) })
.then((res) => { .then((res) => {
passwordSetting.value = false; passwordSetting.value = false;
@ -375,8 +375,8 @@ const handlePhoneBind = (e) => {
if (!errors) { if (!errors) {
binding.value = true; binding.value = true;
bindUserPhone({ bindUserPhone({
phone: model.phone, phone: modelData.phone,
captcha: model.phone_captcha, captcha: modelData.phone_captcha,
}) })
.then((res) => { .then((res) => {
binding.value = false; binding.value = false;
@ -385,7 +385,7 @@ const handlePhoneBind = (e) => {
store.commit('updateUserinfo', { store.commit('updateUserinfo', {
...store.state.userInfo, ...store.state.userInfo,
phone: model.phone, phone: modelData.phone,
}); });
model = { model = {
@ -406,8 +406,8 @@ const handlePhoneBind = (e) => {
const loadCaptcha = () => { const loadCaptcha = () => {
getCaptcha() getCaptcha()
.then((res) => { .then((res) => {
model.id = res.id; modelData.id = res.id;
model.b64s = res.b64s; modelData.b64s = res.b64s;
}) })
.catch((err) => { .catch((err) => {
console.log(err); console.log(err);
@ -431,15 +431,15 @@ const sendPhoneCaptcha = () => {
if (smsCounter.value > 0 && smsDisabled.value) { if (smsCounter.value > 0 && smsDisabled.value) {
return; return;
} }
if (model.imgCaptcha === '') { if (modelData.imgCaptcha === '') {
window.$message.warning(''); window.$message.warning('');
return; return;
} }
sending.value = true; sending.value = true;
sendCaptcha({ sendCaptcha({
phone: model.phone, phone: modelData.phone,
img_captcha: model.imgCaptcha, img_captcha: modelData.imgCaptcha,
img_captcha_id: model.id, img_captcha_id: modelData.id,
}) })
.then((res) => { .then((res) => {
smsDisabled.value = true; smsDisabled.value = true;

Loading…
Cancel
Save