style: 快速开站多语言翻译

This commit is contained in:
TsMask
2024-05-21 17:10:45 +08:00
parent 814b7b0058
commit 7c78eab431
5 changed files with 111 additions and 41 deletions

View File

@@ -67,14 +67,11 @@ function fnBeforeUpload(file: FileType) {
if (state.confirmLoading) return false;
const isJpgOrPng = ['image/jpeg', 'image/png'].includes(file.type);
if (!isJpgOrPng) {
message.error(
t('views.system.setting.uploadFormat', { format: 'jpg、png' }),
3
);
message.error(`${t('components.UploadModal.onlyAllow')} jpg、png`, 3);
}
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isLt2M) {
message.error(t('views.system.setting.uploadSize', { size: 2 }), 3);
message.error(`${t('components.UploadModal.allowFilter')} 2MB`, 3);
}
return isJpgOrPng && isLt2M;
}
@@ -83,7 +80,7 @@ function fnBeforeUpload(file: FileType) {
function fnUpload(up: UploadRequestOption) {
Modal.confirm({
title: t('common.tipTitle'),
content: t('views.system.setting.sysLogoTipContentUpload'),
content: t('views.system.quickStart.sysUploadLogo'),
onOk() {
// 发送请求
const hide = message.loading(t('common.loading'), 0);
@@ -95,7 +92,7 @@ function fnUpload(up: UploadRequestOption) {
state.confirmLoading = false;
hide();
if (res.code === RESULT_CODE_SUCCESS) {
message.success(t('views.system.setting.uploadSuccess'), 3);
message.success(t('views.system.quickStart.sysUploadOk'), 3);
state.filePath = res.data.fileName;
// 兼容旧前端可改配置文件
const baseUrl = import.meta.env.PROD
@@ -122,7 +119,7 @@ function fnSaveAcount() {
bootloaderAccount(state.username, state.password).then(res => {
console.log(res);
if (res.code === RESULT_CODE_SUCCESS) {
message.success('保存成功!');
message.success(t('common.operateOk'));
} else {
message.warning(res.msg);
}
@@ -162,7 +159,7 @@ function fnSaveSystem() {
state.confirmLoading = true;
Promise.all(reqArr).then(resArr => {
console.log(resArr);
message.success('保存成功!');
message.success(t('views.system.quickStart.sysSaveOk'));
state.confirmLoading = false;
});
}
@@ -171,7 +168,7 @@ function fnSaveSystem() {
function fnStepPrev() {
Modal.confirm({
title: t('common.tipTitle'),
content: '确认要返回上一步吗?',
content: t('views.system.quickStart.sysPrevTip'),
onOk() {
fnToStepName('Start');
},
@@ -183,7 +180,7 @@ function fnStepNext(stepName: 'NeInfoConfig' | 'Done') {
if (stepName === 'NeInfoConfig') {
Modal.confirm({
title: t('common.tipTitle'),
content: '确认要进行网元快速安装吗?',
content: t('views.system.quickStart.sysNextNe'),
onOk() {
fnToStepName('NeInfoConfig');
},
@@ -192,7 +189,7 @@ function fnStepNext(stepName: 'NeInfoConfig' | 'Done') {
if (stepName === 'Done') {
Modal.confirm({
title: t('common.tipTitle'),
content: '确认要直接使用核心网管理平台吗?',
content: t('views.system.quickStart.sysNextDone'),
onOk() {
stepState.setupNE = false;
fnToStepName('Done');
@@ -204,7 +201,7 @@ function fnStepNext(stepName: 'NeInfoConfig' | 'Done') {
<template>
<div class="ne">
<h2>系统配置</h2>
<h2>{{ t('views.system.quickStart.sysTitle') }}</h2>
<a-form
:label-col="{ span: 4 }"
@@ -212,7 +209,9 @@ function fnStepNext(stepName: 'NeInfoConfig' | 'Done') {
:wrapper-col="{ span: 10 }"
style="flex: 1"
>
<a-divider orientation="left">管理员账号</a-divider>
<a-divider orientation="left">
{{ t('views.system.quickStart.sysAdmin') }}
</a-divider>
<a-form-item :label="t('views.system.user.account')" name="username">
<a-input v-model:value="state.username" :maxlength="30">
<template #prefix>
@@ -233,14 +232,16 @@ function fnStepNext(stepName: 'NeInfoConfig' | 'Done') {
:loading="state.confirmLoading"
@click="fnSaveAcount()"
>
保存
{{ t('views.system.quickStart.sysSave') }}
</a-button>
</a-form-item>
<a-divider orientation="left">系统信息</a-divider>
<a-divider orientation="left">
{{ t('views.system.quickStart.sysInfo') }}
</a-divider>
<a-form-item
label="系统LOGO"
help="将整张图片展示到系统LOGO区域请使用透明背景尺寸比例适应区域大小"
:label="t('views.system.quickStart.sysLogo')"
:help="t('views.system.quickStart.sysLogoTip')"
:wrapper-col="{ span: 18 }"
>
<a-space direction="horizontal" :size="18">
@@ -282,7 +283,10 @@ function fnStepNext(stepName: 'NeInfoConfig' | 'Done') {
</div>
</div>
</a-form-item>
<a-form-item label="系统名称" help="系统名称限制20个字符长度">
<a-form-item
:label="t('views.system.quickStart.sysName')"
:help="t('views.system.quickStart.sysNameTip')"
>
<a-input
v-model:value="state.title"
allow-clear
@@ -307,19 +311,23 @@ function fnStepNext(stepName: 'NeInfoConfig' | 'Done') {
:loading="state.confirmLoading"
@click="fnSaveSystem()"
>
保存
{{ t('views.system.quickStart.sysSave') }}
</a-button>
</a-form-item>
</a-form>
<div class="ne-oper">
<a-space direction="horizontal" :size="18">
<a-button @click="fnStepPrev()"> 上一步 </a-button>
<a-button type="dashed" @click="fnStepNext('NeInfoConfig')">
下一步
<a-button @click="fnStepPrev()">
{{ t('views.system.quickStart.stepPrev') }}
</a-button>
<a-button type="primary" @click="fnStepNext('NeInfoConfig')">
{{ t('views.system.quickStart.stepNext') }}
</a-button>
<a-button type="dashed" @click="fnStepNext('Done')">
{{ t('views.system.quickStart.skip') }}
</a-button>
<a-button type="ghost" @click="fnStepNext('Done')"> 跳过 </a-button>
</a-space>
</div>
</div>