style: 系统设置多语言
This commit is contained in:
@@ -36,11 +36,14 @@ function fnBeforeUpload(file: FileType) {
|
||||
'image/webp',
|
||||
].includes(file.type);
|
||||
if (!isJpgOrPng) {
|
||||
message.error('只支持上传图片格式(jpg、png、svg、webp)', 3);
|
||||
message.error(
|
||||
t('views.system.setting.uploadFormat', { format: 'jpg、png、svg、webp' }),
|
||||
3
|
||||
);
|
||||
}
|
||||
const isLt10M = file.size / 1024 / 1024 < 10;
|
||||
if (!isLt10M) {
|
||||
message.error('图片文件大小必须小于 10MB', 3);
|
||||
message.error(t('views.system.setting.uploadSize', { size: 10 }), 3);
|
||||
}
|
||||
return isJpgOrPng && isLt10M;
|
||||
}
|
||||
@@ -49,7 +52,7 @@ function fnBeforeUpload(file: FileType) {
|
||||
function fnUpload(up: UploadRequestOption) {
|
||||
Modal.confirm({
|
||||
title: t('common.tipTitle'),
|
||||
content: `确认要上传登录界面背景文件吗?`,
|
||||
content: t('views.system.setting.sysLoginBgTipContentUpload'),
|
||||
onOk() {
|
||||
// 发送请求
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
@@ -61,7 +64,7 @@ function fnUpload(up: UploadRequestOption) {
|
||||
state.loading = false;
|
||||
hide();
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success('文件上传成功,提交保存生效', 3);
|
||||
message.success(t('views.system.setting.uploadSuccess'), 3);
|
||||
state.filePath = res.data.fileName;
|
||||
// 兼容旧前端可改配置文件
|
||||
const baseUrl = import.meta.env.PROD
|
||||
@@ -89,7 +92,7 @@ function fnEdit(v: boolean) {
|
||||
function fnSave() {
|
||||
Modal.confirm({
|
||||
title: t('common.tipTitle'),
|
||||
content: `确认要提交当前变更的登录界面背景吗?`,
|
||||
content: t('views.system.setting.sysLoginBgTipContent'),
|
||||
onOk() {
|
||||
// 发送请求
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
@@ -99,7 +102,7 @@ function fnSave() {
|
||||
state.loading = false;
|
||||
hide();
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success('提交保存成功', 3);
|
||||
message.success(t('views.system.setting.saveSuccess'), 3);
|
||||
appStore.loginBackground = state.filePath;
|
||||
fnEdit(false);
|
||||
} else {
|
||||
@@ -115,7 +118,7 @@ function fnSave() {
|
||||
function fnRevert() {
|
||||
Modal.confirm({
|
||||
title: t('common.tipTitle'),
|
||||
content: `确认要将背景图还原到系统初始默认的背景吗?`,
|
||||
content: t('views.system.setting.sysLoginBgTipContentRevert'),
|
||||
onOk() {
|
||||
// 发送请求
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
@@ -126,7 +129,7 @@ function fnRevert() {
|
||||
state.loading = false;
|
||||
hide();
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success('还原成功', 3);
|
||||
message.success(t('views.system.setting.revertSuccess'), 3);
|
||||
appStore.loginBackground = state.filePath;
|
||||
fnEdit(false);
|
||||
} else {
|
||||
@@ -148,7 +151,9 @@ onMounted(() => {
|
||||
<a-row :gutter="16">
|
||||
<a-col :lg="12" :md="12" :xs="24" style="margin-bottom: 30px">
|
||||
<div class="sys-login-bg">
|
||||
<span v-if="state.flag === '#'">暂无背景图</span>
|
||||
<span v-if="state.flag === '#'">
|
||||
{{ t('views.system.setting.sysLoginBgNone') }}
|
||||
</span>
|
||||
<a-image :src="state.flag" v-else />
|
||||
</div>
|
||||
|
||||
@@ -164,7 +169,7 @@ onMounted(() => {
|
||||
:custom-request="fnUpload"
|
||||
>
|
||||
<a-button type="link" :disabled="state.loading">
|
||||
上传背景
|
||||
{{ t('views.system.setting.sysLoginBgUpload') }}
|
||||
</a-button>
|
||||
</a-upload>
|
||||
</a-form-item>
|
||||
@@ -175,7 +180,7 @@ onMounted(() => {
|
||||
:disabled="state.filePath === state.flag"
|
||||
@click="fnSave"
|
||||
>
|
||||
提交保存
|
||||
{{ t('views.system.setting.saveSubmit') }}
|
||||
</a-button>
|
||||
<a-button style="margin-left: 10px" @click="fnEdit(false)">
|
||||
{{ t('common.cancel') }}
|
||||
@@ -184,23 +189,25 @@ onMounted(() => {
|
||||
</a-form>
|
||||
|
||||
<template v-else>
|
||||
<a-button type="default" @click="fnEdit(true)"> 编辑 </a-button>
|
||||
<a-button type="default" @click="fnEdit(true)">
|
||||
{{ t('common.editText') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
type="text"
|
||||
danger
|
||||
style="margin-left: 10px"
|
||||
@click="fnRevert"
|
||||
>
|
||||
还原
|
||||
{{ t('views.system.setting.revert') }}
|
||||
</a-button>
|
||||
</template>
|
||||
</a-col>
|
||||
<a-col :lg="12" :md="12" :xs="24">
|
||||
<a-typography>
|
||||
<a-typography-paragraph>
|
||||
系统登录界面背景样式如预览区域所示,请以实际显示为准<br />
|
||||
请将选择合适的图片进行进行上传。<br />
|
||||
通过点击《还原》按钮,将背景图还原到系统初始默认的背景。
|
||||
{{ t('views.system.setting.sysLoginBgInstruction') }}<br />
|
||||
{{ t('views.system.setting.sysLoginBgInstruction1') }}<br />
|
||||
{{ t('views.system.setting.sysLoginBgInstruction2') }}
|
||||
</a-typography-paragraph>
|
||||
</a-typography>
|
||||
</a-col>
|
||||
|
||||
Reference in New Issue
Block a user