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