fix(core): 统一电话号码字段名称从 phonenumber 改为 phone
This commit is contained in:
@@ -15,7 +15,7 @@ const loading = ref(false);
|
||||
const CODE_LENGTH = 6;
|
||||
const loginRef =
|
||||
useTemplateRef<InstanceType<typeof AuthenticationCodeLogin>>('loginRef');
|
||||
function sendCodeApi(phoneNumber: string) {
|
||||
function sendCodeApi(phone: string) {
|
||||
message.loading({
|
||||
content: $t('page.auth.sendingCode'),
|
||||
duration: 0,
|
||||
@@ -24,11 +24,11 @@ function sendCodeApi(phoneNumber: string) {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
message.success({
|
||||
content: $t('page.auth.codeSentTo', [phoneNumber]),
|
||||
content: $t('page.auth.codeSentTo', [phone]),
|
||||
duration: 3,
|
||||
key: 'sending-code',
|
||||
});
|
||||
resolve({ code: '123456', phoneNumber });
|
||||
resolve({ code: '123456', phone });
|
||||
}, 3000);
|
||||
});
|
||||
}
|
||||
@@ -39,7 +39,7 @@ const formSchema = computed((): VbenFormSchema[] => {
|
||||
componentProps: {
|
||||
placeholder: $t('authentication.mobile'),
|
||||
},
|
||||
fieldName: 'phoneNumber',
|
||||
fieldName: 'phone',
|
||||
label: $t('authentication.mobile'),
|
||||
rules: z
|
||||
.string()
|
||||
@@ -68,14 +68,14 @@ const formSchema = computed((): VbenFormSchema[] => {
|
||||
loading.value = false;
|
||||
throw new Error('formApi is not ready');
|
||||
}
|
||||
await formApi.validateField('phoneNumber');
|
||||
const isPhoneReady = await formApi.isFieldValid('phoneNumber');
|
||||
await formApi.validateField('phone');
|
||||
const isPhoneReady = await formApi.isFieldValid('phone');
|
||||
if (!isPhoneReady) {
|
||||
loading.value = false;
|
||||
throw new Error('Phone number is not Ready');
|
||||
}
|
||||
const { phoneNumber } = await formApi.getValues();
|
||||
await sendCodeApi(phoneNumber);
|
||||
const { phone } = await formApi.getValues();
|
||||
await sendCodeApi(phone);
|
||||
loading.value = false;
|
||||
},
|
||||
placeholder: $t('authentication.code'),
|
||||
|
||||
@@ -18,7 +18,7 @@ const [Form] = useVbenForm({
|
||||
},
|
||||
labelClass: 'w-2/6',
|
||||
},
|
||||
fieldMappingTime: [['field4', ['phoneType', 'phoneNumber'], null]],
|
||||
fieldMappingTime: [['field4', ['phoneType', 'phone'], null]],
|
||||
// 提交函数
|
||||
handleSubmit: onSubmit,
|
||||
// 垂直布局,label和input在不同行,值为vertical
|
||||
|
||||
Reference in New Issue
Block a user