style: 个人中心多语言
This commit is contained in:
@@ -43,7 +43,7 @@ function fnInitstateForm() {
|
||||
function fnFinish() {
|
||||
Modal.confirm({
|
||||
title: t('common.tipTitle'),
|
||||
content: `确认要提交修改用户基本信息吗?`,
|
||||
content: t('views.account.settings.profileTip'),
|
||||
onOk() {
|
||||
stateForm.formClick = true;
|
||||
// 发送请求
|
||||
@@ -55,8 +55,8 @@ function fnFinish() {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
Modal.success({
|
||||
title: t('common.tipTitle'),
|
||||
content: `用户基本信息修改成功!`,
|
||||
okText: '我知道了',
|
||||
content: t('views.account.settings.profileOk'),
|
||||
okText: t('views.account.settings.know'),
|
||||
onOk() {
|
||||
uerStore.setBaseInfo(form);
|
||||
},
|
||||
@@ -77,11 +77,14 @@ function fnBeforeUpload(file: FileType) {
|
||||
if (upState.value) return false;
|
||||
const isJpgOrPng = ['image/jpeg', 'image/png'].includes(file.type);
|
||||
if (!isJpgOrPng) {
|
||||
message.error('只支持上传图片格式(jpg、png)', 3);
|
||||
message.error(
|
||||
t('views.account.settings.uploadFormat', { format: 'jpg、png' }),
|
||||
3
|
||||
);
|
||||
}
|
||||
const isLt2M = file.size / 1024 / 1024 < 2;
|
||||
if (!isLt2M) {
|
||||
message.error('图片文件大小必须小于 2MB', 3);
|
||||
message.error(t('views.account.settings.uploadSize', { size: '2' }), 3);
|
||||
}
|
||||
return isJpgOrPng && isLt2M;
|
||||
}
|
||||
@@ -90,7 +93,7 @@ function fnBeforeUpload(file: FileType) {
|
||||
function fnUpload(up: UploadRequestOption) {
|
||||
Modal.confirm({
|
||||
title: t('common.tipTitle'),
|
||||
content: `确认要上传/变更用户头像吗?`,
|
||||
content: t('views.account.settings.uploadTip'),
|
||||
onOk() {
|
||||
// 发送请求
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
@@ -101,7 +104,7 @@ function fnUpload(up: UploadRequestOption) {
|
||||
upState.value = false;
|
||||
hide();
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success('头像上传/变更成功', 3);
|
||||
message.success(t('views.account.settings.uploadOk'), 3);
|
||||
uerStore.setAvatar(res.data);
|
||||
} else {
|
||||
message.error(res.msg, 3);
|
||||
@@ -134,13 +137,13 @@ onMounted(() => {
|
||||
<a-row :gutter="16">
|
||||
<a-col :lg="12" :md="12" :xs="24" style="margin-bottom: 30px">
|
||||
<a-form-item
|
||||
label="用户昵称"
|
||||
:label="t('views.account.settings.nick')"
|
||||
name="nickName"
|
||||
:rules="[
|
||||
{
|
||||
required: true,
|
||||
pattern: regExpNick,
|
||||
message: '昵称只能包含字母、数字、中文和下划线,且不少于2位',
|
||||
message: t('views.account.settings.nickTip'),
|
||||
},
|
||||
]"
|
||||
>
|
||||
@@ -148,18 +151,18 @@ onMounted(() => {
|
||||
v-model:value="stateForm.form.nickName"
|
||||
allow-clear
|
||||
:maxlength="26"
|
||||
placeholder="请输入用户昵称"
|
||||
:placeholder="t('views.account.settings.nickPleace')"
|
||||
></a-input>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item
|
||||
label="手机号码"
|
||||
:label="t('views.account.settings.phonenumber')"
|
||||
name="phonenumber"
|
||||
:rules="[
|
||||
{
|
||||
required: false,
|
||||
pattern: regExpMobile,
|
||||
message: '请输入正确手机号码',
|
||||
message: t('views.account.settings.phonenumberPleace'),
|
||||
},
|
||||
]"
|
||||
>
|
||||
@@ -167,18 +170,18 @@ onMounted(() => {
|
||||
v-model:value="stateForm.form.phonenumber"
|
||||
allow-clear
|
||||
:maxlength="11"
|
||||
placeholder="请输入手机号码"
|
||||
:placeholder="t('views.account.settings.phonenumberPleace')"
|
||||
></a-input>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item
|
||||
label="电子邮箱"
|
||||
:label="t('views.account.settings.email')"
|
||||
name="email"
|
||||
:rules="[
|
||||
{
|
||||
required: false,
|
||||
pattern: regExpEmail,
|
||||
message: '请输入正确电子邮箱',
|
||||
message: t('views.account.settings.emailPleace'),
|
||||
},
|
||||
]"
|
||||
>
|
||||
@@ -186,25 +189,21 @@ onMounted(() => {
|
||||
v-model:value="stateForm.form.email"
|
||||
allow-clear
|
||||
:maxlength="40"
|
||||
placeholder="请输入电子邮箱"
|
||||
:placeholder="t('views.account.settings.emailPleace')"
|
||||
></a-input>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item
|
||||
label="用户性别"
|
||||
:label="t('views.account.settings.sex')"
|
||||
name="sex"
|
||||
:rules="[
|
||||
{
|
||||
required: true,
|
||||
message: '请选择用户性别',
|
||||
message: t('views.account.settings.sexPleace'),
|
||||
},
|
||||
]"
|
||||
>
|
||||
<a-select
|
||||
v-model:value="stateForm.form.sex"
|
||||
placeholder="用户性别"
|
||||
:options="sysUserSex"
|
||||
>
|
||||
<a-select v-model:value="stateForm.form.sex" :options="sysUserSex">
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
|
||||
@@ -215,21 +214,27 @@ onMounted(() => {
|
||||
html-type="submit"
|
||||
:loading="stateForm.formClick"
|
||||
>
|
||||
确认修改
|
||||
{{ t('views.account.settings.submit') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
type="default"
|
||||
@click="fnInitstateForm"
|
||||
:disabled="stateForm.formClick"
|
||||
>
|
||||
重置
|
||||
{{ t('views.account.settings.reset') }}
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-col>
|
||||
<a-col :lg="12" :md="12" :xs="24">
|
||||
<a-space direction="vertical" :size="16">
|
||||
<a-image :width="128" :height="128" :src="uerStore.getAvatar" />
|
||||
<span>请选择等比大小图片作为头像,如200x200、400x400</span>
|
||||
<span>
|
||||
{{
|
||||
t('views.account.settings.uploadPleace', {
|
||||
txt: '200x200、400x400',
|
||||
})
|
||||
}}
|
||||
</span>
|
||||
<a-upload
|
||||
name="file"
|
||||
list-type="picture"
|
||||
@@ -239,7 +244,7 @@ onMounted(() => {
|
||||
:custom-request="fnUpload"
|
||||
>
|
||||
<a-button type="default" :loading="upState">
|
||||
上传/变更图片
|
||||
{{ t('views.account.settings.upload') }}
|
||||
</a-button>
|
||||
</a-upload>
|
||||
</a-space>
|
||||
|
||||
Reference in New Issue
Block a user