fix(core): 统一电话号码字段名称从 phonenumber 改为 phone

This commit is contained in:
dubai
2026-01-11 14:06:04 +08:00
parent d12769dd29
commit 1d78fec144
12 changed files with 27 additions and 27 deletions

View File

@@ -2,12 +2,12 @@ import { requestClient } from '#/api/request';
/** /**
* 发送短信验证码 * 发送短信验证码
* @param phonenumber 手机号 * @param phone 手机号
* @returns void * @returns void
*/ */
export function sendSmsCode(phonenumber: string) { export function sendSmsCode(phone: string) {
return requestClient.get<void>('/resource/sms/code', { return requestClient.get<void>('/resource/sms/code', {
params: { phonenumber }, params: { phone },
}); });
} }

View File

@@ -20,7 +20,7 @@ export interface User {
loginDate: string; loginDate: string;
loginIp: string; loginIp: string;
nick: string; nick: string;
phonenumber: string; phone: string;
remark: string; remark: string;
roles: Role[]; roles: Role[];
sex: string; sex: string;

View File

@@ -35,7 +35,7 @@ export interface User {
nick: string; nick: string;
userType: string; userType: string;
email: string; email: string;
phonenumber: string; phone: string;
sex: string; sex: string;
avatar: string; avatar: string;
status: string; status: string;

View File

@@ -65,7 +65,7 @@ const formSchema = computed((): VbenFormSchema[] => {
componentProps: { componentProps: {
placeholder: $t('authentication.mobile'), placeholder: $t('authentication.mobile'),
}, },
fieldName: 'phoneNumber', fieldName: 'phone',
label: $t('authentication.mobile'), label: $t('authentication.mobile'),
rules: z rules: z
.string() .string()
@@ -89,7 +89,7 @@ const formSchema = computed((): VbenFormSchema[] => {
codeLength: CODE_LENGTH, codeLength: CODE_LENGTH,
placeholder: $t('authentication.code'), placeholder: $t('authentication.code'),
handleSendCode: async () => { handleSendCode: async () => {
const { valid, value } = await form.validateField('phoneNumber'); const { valid, value } = await form.validateField('phone');
if (!valid) { if (!valid) {
// 必须抛异常 不能直接return // 必须抛异常 不能直接return
throw new Error('未填写手机号'); throw new Error('未填写手机号');
@@ -114,7 +114,7 @@ async function handleLogin(values: LoginCodeParams) {
try { try {
const requestParams: any = { const requestParams: any = {
tenantId: values.tenantId, tenantId: values.tenantId,
phonenumber: values.phoneNumber, phone: values.phone,
smsCode: values.code, smsCode: values.code,
grantType: 'sms', grantType: 'sms',
}; };

View File

@@ -68,7 +68,7 @@ const [BasicForm, formApi] = useVbenForm({
}, },
{ {
component: 'Input', component: 'Input',
fieldName: 'phonenumber', fieldName: 'phone',
label: '电话', label: '电话',
rules: z.string().regex(/^1[3-9]\d{9}$/, '请输入正确的电话'), rules: z.string().regex(/^1[3-9]\d{9}$/, '请输入正确的电话'),
}, },
@@ -106,7 +106,7 @@ onMounted(() => {
'userId', 'userId',
'nick', 'nick',
'email', 'email',
'phonenumber', 'phone',
'sex', 'sex',
]); ]);
formApi.setValues(data); formApi.setValues(data);

View File

@@ -61,7 +61,7 @@ const poetrySrc = computed(() => {
{{ profile.user.userName }} {{ profile.user.userName }}
</DescriptionsItem> </DescriptionsItem>
<DescriptionsItem label="手机号码"> <DescriptionsItem label="手机号码">
{{ profile.user.phonenumber || '未绑定手机号' }} {{ profile.user.phone || '未绑定手机号' }}
</DescriptionsItem> </DescriptionsItem>
<DescriptionsItem label="邮箱"> <DescriptionsItem label="邮箱">
{{ profile.user.email || '未绑定邮箱' }} {{ profile.user.email || '未绑定邮箱' }}

View File

@@ -9,7 +9,7 @@ export const querySchema: FormSchemaGetter = () => [
}, },
{ {
component: 'Input', component: 'Input',
fieldName: 'phonenumber', fieldName: 'phone',
label: '手机号码', label: '手机号码',
}, },
]; ];
@@ -30,7 +30,7 @@ export const columns: VxeGridProps['columns'] = [
}, },
{ {
title: '手机号', title: '手机号',
field: 'phonenumber', field: 'phone',
}, },
{ {
field: 'action', field: 'action',

View File

@@ -308,7 +308,7 @@ function handleSubmit() {
<div class="flex flex-col items-baseline text-[12px]"> <div class="flex flex-col items-baseline text-[12px]">
<div>{{ row.nick }}</div> <div>{{ row.nick }}</div>
<div class="opacity-50"> <div class="opacity-50">
{{ row.phonenumber || '暂无手机号' }} {{ row.phone || '暂无手机号' }}
</div> </div>
</div> </div>
</div> </div>
@@ -340,7 +340,7 @@ function handleSubmit() {
{{ row.nick }} {{ row.nick }}
</div> </div>
<div class="opacity-50"> <div class="opacity-50">
{{ row.phonenumber || '暂无手机号' }} {{ row.phone || '暂无手机号' }}
</div> </div>
</div> </div>
</div> </div>

View File

@@ -48,7 +48,7 @@ const props = withDefaults(defineProps<Props>(), {
}); });
const emit = defineEmits<{ const emit = defineEmits<{
submit: [{ code: string; phoneNumber: string; tenantId: string }]; submit: [{ code: string; phone: string; tenantId: string }];
}>(); }>();
const router = useRouter(); const router = useRouter();
@@ -71,7 +71,7 @@ async function handleSubmit() {
emit('submit', { emit('submit', {
tenantId: values?.tenantId, tenantId: values?.tenantId,
code: values?.code, code: values?.code,
phoneNumber: values?.phoneNumber, phone: values?.phone,
}); });
} }
} }

View File

@@ -91,7 +91,7 @@ interface LoginAndRegisterParams {
interface LoginCodeParams { interface LoginCodeParams {
tenantId: string; tenantId: string;
code: string; code: string;
phoneNumber: string; phone: string;
} }
interface LoginEmits { interface LoginEmits {

View File

@@ -15,7 +15,7 @@ const loading = ref(false);
const CODE_LENGTH = 6; const CODE_LENGTH = 6;
const loginRef = const loginRef =
useTemplateRef<InstanceType<typeof AuthenticationCodeLogin>>('loginRef'); useTemplateRef<InstanceType<typeof AuthenticationCodeLogin>>('loginRef');
function sendCodeApi(phoneNumber: string) { function sendCodeApi(phone: string) {
message.loading({ message.loading({
content: $t('page.auth.sendingCode'), content: $t('page.auth.sendingCode'),
duration: 0, duration: 0,
@@ -24,11 +24,11 @@ function sendCodeApi(phoneNumber: string) {
return new Promise((resolve) => { return new Promise((resolve) => {
setTimeout(() => { setTimeout(() => {
message.success({ message.success({
content: $t('page.auth.codeSentTo', [phoneNumber]), content: $t('page.auth.codeSentTo', [phone]),
duration: 3, duration: 3,
key: 'sending-code', key: 'sending-code',
}); });
resolve({ code: '123456', phoneNumber }); resolve({ code: '123456', phone });
}, 3000); }, 3000);
}); });
} }
@@ -39,7 +39,7 @@ const formSchema = computed((): VbenFormSchema[] => {
componentProps: { componentProps: {
placeholder: $t('authentication.mobile'), placeholder: $t('authentication.mobile'),
}, },
fieldName: 'phoneNumber', fieldName: 'phone',
label: $t('authentication.mobile'), label: $t('authentication.mobile'),
rules: z rules: z
.string() .string()
@@ -68,14 +68,14 @@ const formSchema = computed((): VbenFormSchema[] => {
loading.value = false; loading.value = false;
throw new Error('formApi is not ready'); throw new Error('formApi is not ready');
} }
await formApi.validateField('phoneNumber'); await formApi.validateField('phone');
const isPhoneReady = await formApi.isFieldValid('phoneNumber'); const isPhoneReady = await formApi.isFieldValid('phone');
if (!isPhoneReady) { if (!isPhoneReady) {
loading.value = false; loading.value = false;
throw new Error('Phone number is not Ready'); throw new Error('Phone number is not Ready');
} }
const { phoneNumber } = await formApi.getValues(); const { phone } = await formApi.getValues();
await sendCodeApi(phoneNumber); await sendCodeApi(phone);
loading.value = false; loading.value = false;
}, },
placeholder: $t('authentication.code'), placeholder: $t('authentication.code'),

View File

@@ -18,7 +18,7 @@ const [Form] = useVbenForm({
}, },
labelClass: 'w-2/6', labelClass: 'w-2/6',
}, },
fieldMappingTime: [['field4', ['phoneType', 'phoneNumber'], null]], fieldMappingTime: [['field4', ['phoneType', 'phone'], null]],
// 提交函数 // 提交函数
handleSubmit: onSubmit, handleSubmit: onSubmit,
// 垂直布局label和input在不同行值为vertical // 垂直布局label和input在不同行值为vertical