fix:注册界面传递参数格式修改
This commit is contained in:
@@ -232,7 +232,7 @@ async function handleSubmit() {
|
|||||||
try {
|
try {
|
||||||
await securityFormRef.value?.validate();
|
await securityFormRef.value?.validate();
|
||||||
|
|
||||||
// 整合表单数据
|
// 整合表单数据,去除手机号中的空格
|
||||||
const baseData = {
|
const baseData = {
|
||||||
username: basicModel.username,
|
username: basicModel.username,
|
||||||
password: securityModel.password,
|
password: securityModel.password,
|
||||||
@@ -240,27 +240,19 @@ async function handleSubmit() {
|
|||||||
fullName: basicModel.fullName,
|
fullName: basicModel.fullName,
|
||||||
gender: basicModel.gender,
|
gender: basicModel.gender,
|
||||||
address: basicModel.address,
|
address: basicModel.address,
|
||||||
|
phonenumber: basicModel.phone?.replace(/\s/g, ''), // 去除所有空格
|
||||||
|
birthDate: basicModel.birthDate ? dayjs(basicModel.birthDate).format('YYYY-MM-DD') : undefined,
|
||||||
|
age: basicModel.birthDate ? dayjs().diff(dayjs(basicModel.birthDate), 'year') : 0,
|
||||||
|
authType: 'u',
|
||||||
code: securityModel.code,
|
code: securityModel.code,
|
||||||
uuid: securityModel.uuid,
|
uuid: securityModel.uuid
|
||||||
age: dayjs().diff(dayjs(basicModel.birthDate), 'year'),
|
|
||||||
sex: basicModel.gender,
|
|
||||||
authType: 'u'
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 创建最终的提交数据,只在有手机号时添加
|
await authStore.register(baseData);
|
||||||
const submitData = {
|
window.$message?.success(t('page.login.common.registerSuccess'));
|
||||||
...baseData,
|
toggleLoginModule('pwd-login');
|
||||||
...(basicModel.phone ? { phonenumber: basicModel.phone } : {})
|
|
||||||
};
|
|
||||||
|
|
||||||
const success = await authStore.register(submitData);
|
|
||||||
|
|
||||||
if (success) {
|
|
||||||
window.$message?.success(t('page.login.register.registerSuccess'));
|
|
||||||
toggleLoginModule('pwd-login');
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Form validation failed:', error);
|
console.error('Register failed:', error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user