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',
search:'Search',
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: {
required: 'Cannot be empty',

View File

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

View File

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

View File

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