2
0

fix:用户信息界面中英适配

This commit is contained in:
zhongzm
2025-02-08 15:56:08 +08:00
parent 5eeaa824ff
commit 8546cfc615
4 changed files with 73 additions and 24 deletions

View File

@@ -738,7 +738,27 @@ const local: any = {
plemac:'Please enter MAC address', plemac:'Please enter MAC address',
search:'Search', search:'Search',
reset:'Reset', reset:'Reset',
} },
user:{
title:'User Information',
username:'User Name',
fullname:'Full Name',
sex:'Gender',
man:'Man',
woman:'Woman',
birthdate:'Birth Date',
age:'Age ',
email:'Email',
phone:'Phone',
kyc:'KYC',
ver:'Verified',
unver:'Unverified',
pleusername:'Please enter username',
pleemail:'Please enter email address',
search:'Search',
reset:'Reset',
},
}, },
form: { form: {
required: 'Cannot be empty', required: 'Cannot be empty',

View File

@@ -738,7 +738,27 @@ const local:any = {
plemac:'请输入MAC地址', plemac:'请输入MAC地址',
search:'搜索', search:'搜索',
reset:'重置', reset:'重置',
} },
user:{
title:'用户信息',
username:'用户名',
fullname:'姓名',
sex:'性别',
man:'男',
woman:'女',
birthdate:'出生日期',
age:'年龄',
email:'邮箱',
phone:'手机号',
kyc:'KYC验证',
ver:'已验证',
unver:'未验证',
pleusername:'请输入用户名',
pleemail:'请输入邮箱',
search:'搜索',
reset:'重置',
},
}, },
form: { form: {
required: '不能为空', required: '不能为空',

View File

@@ -7,7 +7,8 @@ import { computed, shallowRef } from 'vue';
import { useElementSize } from '@vueuse/core'; import { useElementSize } from '@vueuse/core';
import { doGetUserList } from '@/service/api/user'; import { doGetUserList } from '@/service/api/user';
import type { UserInfo, SearchModel } from '@/views/user-center/user/type'; import type { UserInfo, SearchModel } from '@/views/user-center/user/type';
import { useI18n } from 'vue-i18n';
const { t } = useI18n();
// 修改API函数实现 // 修改API函数实现
const doGetUserInfo = async (params: SearchModel) => { const doGetUserInfo = async (params: SearchModel) => {
try { try {
@@ -93,25 +94,25 @@ const {
{ {
key: 'username', key: 'username',
dataIndex: 'username', dataIndex: 'username',
title: '用户名', title: t('page.user.username'),
align: 'center' align: 'center'
}, },
{ {
key: 'fullname', key: 'fullname',
dataIndex: 'fullname', dataIndex: 'fullname',
title: '姓名', title: t('page.user.fullname'),
align: 'center' align: 'center'
}, },
{ {
key: 'sex', key: 'sex',
dataIndex: 'sex', dataIndex: 'sex',
title: '性别', title: t('page.user.sex'),
align: 'center', align: 'center',
width: 80, width: 80,
customRender: ({ record }: { record: UserInfo }) => { customRender: ({ record }: { record: UserInfo }) => {
const sexMap = { const sexMap = {
'M': '男', 'M': t('page.user.man'),
'F': '女' 'F': t('page.user.woman')
}; };
return sexMap[record.sex] || '-'; return sexMap[record.sex] || '-';
} }
@@ -119,37 +120,37 @@ const {
{ {
key: 'birthdate', key: 'birthdate',
dataIndex: 'birthdate', dataIndex: 'birthdate',
title: '出生日期', title: t('page.user.birthdate'),
align: 'center' align: 'center'
}, },
{ {
key: 'age', key: 'age',
dataIndex: 'age', dataIndex: 'age',
title: '年龄', title: t('page.user.age'),
align: 'center', align: 'center',
width: 80 width: 80
}, },
{ {
key: 'email', key: 'email',
dataIndex: 'email', dataIndex: 'email',
title: '邮箱', title: t('page.user.email'),
align: 'center' align: 'center'
}, },
{ {
key: 'phonenumber', key: 'phonenumber',
dataIndex: 'phonenumber', dataIndex: 'phonenumber',
title: '手机号', title: t('page.user.phone'),
align: 'center' align: 'center'
}, },
{ {
key: 'isKYC', key: 'isKYC',
dataIndex: 'isKYC', dataIndex: 'isKYC',
title: 'KYC验证', title: t('page.user.kyc'),
align: 'center', align: 'center',
customRender: ({ record }: { record: UserInfo }) => { customRender: ({ record }: { record: UserInfo }) => {
const KYC_STATUS = { const KYC_STATUS = {
verified: '已验证', verified: t('page.user.ver'),
unverified: '未验证' unverified: t('page.user.unver')
} as const; } as const;
return ( return (
<Tag color={record.isKYC ? 'success' : 'warning'}> <Tag color={record.isKYC ? 'success' : 'warning'}>
@@ -221,7 +222,7 @@ const calculateAge = (birthDate: string): number => {
@search="handleSearch" @search="handleSearch"
/> />
<ACard <ACard
title="个人信息" :title="t('page.user.title')"
:bordered="false" :bordered="false"
:body-style="{ flex: 1, overflow: 'hidden' }" :body-style="{ flex: 1, overflow: 'hidden' }"
class="flex-col-stretch sm:flex-1-hidden card-wrapper" class="flex-col-stretch sm:flex-1-hidden card-wrapper"
@@ -230,8 +231,9 @@ const calculateAge = (birthDate: string): number => {
<TableHeaderOperation <TableHeaderOperation
v-model:columns="columnChecks" v-model:columns="columnChecks"
:loading="loading" :loading="loading"
:show-delete="false" :not-show-add="true"
:show-add="false" :show-add="false"
:show-delete="false"
@refresh="getData" @refresh="getData"
/> />
</template> </template>

View File

@@ -2,7 +2,8 @@
import { ref, computed } from 'vue'; import { ref, computed } from 'vue';
import type { FormInstance } from 'ant-design-vue'; import type { FormInstance } from 'ant-design-vue';
import type { SearchModel } from '@/views/user-center/user/type'; import type { SearchModel } from '@/views/user-center/user/type';
import { useI18n } from 'vue-i18n';
const { t } = useI18n();
const props = defineProps<{ const props = defineProps<{
model: SearchModel; model: SearchModel;
}>(); }>();
@@ -83,24 +84,30 @@ const handleSearch = () => {
layout="inline" layout="inline"
class="flex flex-wrap gap-16px items-center" class="flex flex-wrap gap-16px items-center"
> >
<AFormItem label="用户名" name="username"> <AFormItem :label="t('page.user.username')" name="username">
<AInput <AInput
v-model:value="formModel.username" v-model:value="formModel.username"
placeholder="请输入用户名" :placeholder="t('page.user.pleusername')"
allow-clear allow-clear
/> />
</AFormItem> </AFormItem>
<AFormItem label="邮箱" name="email"> <AFormItem :label="t('page.user.email')" name="email">
<AInput <AInput
v-model:value="formModel.email" v-model:value="formModel.email"
placeholder="请输入邮箱" :placeholder="t('page.user.pleemail')"
allow-clear allow-clear
/> />
</AFormItem> </AFormItem>
<AFormItem class="flex-1 justify-end mb-0"> <AFormItem class="flex-1 justify-end mb-0">
<ASpace> <ASpace>
<AButton @click="handleReset">重置</AButton> <AButton type="primary" @click="handleSearch">
<AButton type="primary" @click="handleSearch">搜索</AButton> <template #icon>
<icon-mdi-search />
</template>{{ t('page.user.search') }}</AButton>
<AButton @click="handleReset">
<template #icon>
<icon-mdi-refresh />
</template>{{ t('page.user.reset') }}</AButton>
</ASpace> </ASpace>
</AFormItem> </AFormItem>
</AForm> </AForm>