This commit is contained in:
hzz 2024-03-26 17:02:42 +08:00
parent 121f4d415c
commit d3153c4bc2
8 changed files with 120 additions and 57 deletions

52
src/lang/i18n-en-US.js Normal file
View File

@ -0,0 +1,52 @@
export default {
"common": {
"add": "Add",
"edit": "Edit",
"delete": "Delete",
"search": "Search",
"reset": "Reset",
"import": "Import",
"export": "Export",
"confirm": "Confirm",
"cancel": "Cancel",
"success": "Success",
"error": "Error",
"operation": "Operation",
"status": "Status",
"id": "ID",
"create_time": "Create Time",
"update_time": "Update Time"
},
"validate": {
"required": "Can not be empty",
"format": "Format is incorrect",
"length": "Length is incorrect",
"range": "Range is incorrect",
"max": "Maximum value is",
"min": "Minimum value is"
},
"login": {
"title": "CASM",
"user_login": "User Login",
"logIn": "Login in",
"username": "Username",
"password": "Password",
"code": "Code",
"rememberMe": "Remember Me",
"logging_in": "Logging in",
"register_now": "Register Now"
},
"tagsView": {
"refresh": "Refresh",
"close": "Close",
"closeOthers": "Close Others",
"closeAll": "Close All"
},
"settings": {
"title": "Page style setting",
"theme": "Theme Color",
"tagsView": "Open Tags-View",
"fixedHeader": "Fixed Header",
"sidebarLogo": "Sidebar Logo"
}
}

View File

@ -1,25 +0,0 @@
{
"login": {
"title": "CASM",
"logIn": "Login in",
"username": "Username",
"password": "Password",
"code": "Code",
"rememberMe": "Remember Me",
"logging_in": "Logging in",
"register_now": "Register Now"
},
"tagsView": {
"refresh": "Refresh",
"close": "Close",
"closeOthers": "Close Others",
"closeAll": "Close All"
},
"settings": {
"title": "Page style setting",
"theme": "Theme Color",
"tagsView": "Open Tags-View",
"fixedHeader": "Fixed Header",
"sidebarLogo": "Sidebar Logo"
}
}

53
src/lang/i18n-zh-CN.js Normal file
View File

@ -0,0 +1,53 @@
export default {
"common":{
"add": "新增",
"edit": "修改",
"delete": "删除",
"search": "搜索",
"reset": "重置",
"import": "导入",
"export": "导出",
"confirm": "确定",
"cancel": "取消",
"success": "成功",
"error": "失败",
"operation": "操作",
"status": "状态",
"id": "序号",
"create_time": "创建时间",
"update_time": "更新时间",
},
"validate":{
"required": "不能为空",
"format": "格式不正确",
"length": "长度不正确",
"range": "范围不正确",
"max": "最大值为",
"min": "最小值为",
},
"login": {
"title": "智能缝纫管理系统",
"user_login": "用户登录",
"logIn": "登录",
"username": "账号",
"password": "密码",
"code": "验证码",
"rememberMe": "记住密码",
"logging_in": "登录中...",
"register_now": "立即注册"
},
"tagsView": {
"refresh": "刷新",
"close": "关闭",
"closeOthers": "关闭其它",
"closeAll": "关闭所有"
},
"settings": {
"title": "系统布局配置",
"theme": "主题色",
"tagsView": "开启 Tags-View",
"fixedHeader": "固定 Header",
"sidebarLogo": "侧边栏 Logo"
}
}

View File

@ -1,25 +0,0 @@
{
"login": {
"title": "智能缝纫管理系统",
"logIn": "登录",
"username": "账号",
"password": "密码",
"code": "验证码",
"rememberMe": "记住密码",
"logging_in": "登录中...",
"register_now": "立即注册"
},
"tagsView": {
"refresh": "刷新",
"close": "关闭",
"closeOthers": "关闭其它",
"closeAll": "关闭所有"
},
"settings": {
"title": "系统布局配置",
"theme": "主题色",
"tagsView": "开启 Tags-View",
"fixedHeader": "固定 Header",
"sidebarLogo": "侧边栏 Logo"
}
}

View File

@ -8,8 +8,8 @@ import enLocale from 'element-plus/dist/locale/en.mjs'
// 如果还有新的语言在下面继续添加 // 如果还有新的语言在下面继续添加
// 引入自己定义的 I18n 文件 // 引入自己定义的 I18n 文件
import myI18nEn from './i18n-en-US.json' import myI18nEn from './i18n-en-US'
import myI18nZh from './i18n-zh-CN.json' import myI18nZh from './i18n-zh-CN'
// 如果还有新的语言在下面继续添加 // 如果还有新的语言在下面继续添加
// 默认中文 // 默认中文

View File

@ -4,8 +4,9 @@ import Cookies from 'js-cookie'
import ElementPlus from 'element-plus' import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css' import 'element-plus/dist/index.css'
import locale from 'element-plus/es/locale/lang/zh-cn' import zhLocale from 'element-plus/es/locale/lang/zh-cn'
import enLocale from 'element-plus/es/locale/lang/en'
// 引入 elementui 的多语言
import '@/assets/styles/index.scss' // global css import '@/assets/styles/index.scss' // global css
import App from './App' import App from './App'
@ -46,7 +47,8 @@ import TreeSelect from '@/components/TreeSelect'
// 字典标签组件 // 字典标签组件
import DictTag from '@/components/DictTag' import DictTag from '@/components/DictTag'
import { getStoredLanguage, saveStoredLanguage } from "@/utils/languageStorage";
let locale = getStoredLanguage() === 'en-US' ? enLocale : zhLocale
const app = createApp(App) const app = createApp(App)
// 全局方法挂载 // 全局方法挂载
@ -60,7 +62,6 @@ app.config.globalProperties.selectDictLabel = selectDictLabel
app.config.globalProperties.selectDictLabels = selectDictLabels app.config.globalProperties.selectDictLabels = selectDictLabels
// 此段代码写入main.js中 // 此段代码写入main.js中
app.config.globalProperties.$t = i18n.global.t app.config.globalProperties.$t = i18n.global.t
console.log(i18n.global,'-----');
// 全局组件挂载 // 全局组件挂载
app.component('DictTag', DictTag) app.component('DictTag', DictTag)
app.component('Pagination', Pagination) app.component('Pagination', Pagination)

View File

@ -3,7 +3,7 @@
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :sm="24" :lg="24"> <el-col :sm="24" :lg="24">
<blockquote class="text-warning" style="font-size: 14px"> <blockquote class="text-warning" style="font-size: 14px">
领取阿里云通用云产品1888优惠券 领取阿里云通用云产品1888优惠券{{ $t("el.error") }}
<br /> <br />
<el-link <el-link
href="https://www.aliyun.com/minisite/goods?userCode=brki8iof" href="https://www.aliyun.com/minisite/goods?userCode=brki8iof"

View File

@ -6,6 +6,7 @@
<div class="main-left"></div> <div class="main-left"></div>
<div class="main-right"> <div class="main-right">
<el-form ref="loginRef" :model="loginForm" :rules="loginRules" class="login-form"> <el-form ref="loginRef" :model="loginForm" :rules="loginRules" class="login-form">
<h3 class="form-title">{{ $t("login.user_login") }}</h3>
<el-form-item prop="username"> <el-form-item prop="username">
<el-input v-model="loginForm.username" type="text" size="large" auto-complete="off" <el-input v-model="loginForm.username" type="text" size="large" auto-complete="off"
:placeholder="$t('login.username')"> :placeholder="$t('login.username')">
@ -197,6 +198,12 @@ getCookie();
border-bottom-right-radius: 6px; border-bottom-right-radius: 6px;
box-sizing: border-box; box-sizing: border-box;
.form-title {
margin: 0px auto 30px auto;
text-align: center;
color: #707070;
}
.el-input { .el-input {
height: 40px; height: 40px;