多语言

main
768863620@qq.com 2024-09-20 15:54:17 +08:00
parent 4442d15feb
commit efe3644f6a
6 changed files with 630 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 935 KiB

164
src/i18n/en.js 100644
View File

@ -0,0 +1,164 @@
export default {
el: {
colorpicker: {
confirm: 'OK',
clear: 'Clear'
},
datepicker: {
now: 'Now',
today: 'Today',
cancel: 'Cancel',
clear: 'Clear',
confirm: 'OK',
selectDate: 'Select date',
selectTime: 'Select time',
startDate: 'Start Date',
startTime: 'Start Time',
endDate: 'End Date',
endTime: 'End Time',
prevYear: 'Previous Year',
nextYear: 'Next Year',
prevMonth: 'Previous Month',
nextMonth: 'Next Month',
year: '',
month1: 'January',
month2: 'February',
month3: 'March',
month4: 'April',
month5: 'May',
month6: 'June',
month7: 'July',
month8: 'August',
month9: 'September',
month10: 'October',
month11: 'November',
month12: 'December',
week: 'week',
weeks: {
sun: 'Sun',
mon: 'Mon',
tue: 'Tue',
wed: 'Wed',
thu: 'Thu',
fri: 'Fri',
sat: 'Sat'
},
months: {
jan: 'Jan',
feb: 'Feb',
mar: 'Mar',
apr: 'Apr',
may: 'May',
jun: 'Jun',
jul: 'Jul',
aug: 'Aug',
sep: 'Sep',
oct: 'Oct',
nov: 'Nov',
dec: 'Dec'
}
},
select: {
loading: 'Loading',
noMatch: 'No matching data',
noData: 'No data',
placeholder: 'Select'
},
cascader: {
noMatch: 'No matching data',
loading: 'Loading',
placeholder: 'Select',
noData: 'No data'
},
pagination: {
goto: 'Go to',
pagesize: '/page',
total: 'Total {total}',
pageClassifier: ''
},
messagebox: {
title: 'Message',
confirm: 'OK',
cancel: 'Cancel',
error: 'Illegal input'
},
upload: {
deleteTip: 'press delete to remove',
delete: 'Delete',
preview: 'Preview',
continue: 'Continue'
},
table: {
emptyText: 'No Data',
confirmFilter: 'Confirm',
resetFilter: 'Reset',
clearFilter: 'All',
sumText: 'Sum'
},
tree: {
emptyText: 'No Data'
},
transfer: {
noMatch: 'No matching data',
noData: 'No data',
titles: ['List 1', 'List 2'], // to be translated
filterPlaceholder: 'Enter keyword', // to be translated
noCheckedFormat: '{total} items', // to be translated
hasCheckedFormat: '{checked}/{total} checked' // to be translated
},
image: {
error: 'FAILED'
},
pageHeader: {
title: 'Back' // to be translated
},
popconfirm: {
confirmButtonText: 'Yes',
cancelButtonText: 'No'
},
empty: {
description: 'No Data'
}
},
login: {
bt_login: 'LOGIN'
},
menu: {
BaseData: 'Basic data',
BaseData_BaseWare: 'Warehouse basic information',
BaseData_BaseWare_dept: 'Warehouse Management',
BaseData_BaseWare_area: 'Reservoi Management',
BaseData_BaseWare_point: 'Location Management',
BaseData_BaseWare_PlatformMaintenance: 'Platform maintenance',
BaseData_BaseWare_billType: 'Document type',
BaseData_item: 'Material Management',
BaseData_ruleConfigure: 'System rule configuration',
BaseData_timing: 'Scheduled task configuration',
Business_asn: 'Warehouse in management',
Business_asn_xppRecord: 'XPP Pick',
Business_asn_AsnDetail: 'XPP Grounding',
Business_asn_viewAsnDetail: 'Other inbound items',
Business_pick: 'Outbound management',
Business_pick_business_indicate: 'Outbound instruction',
Business_pick_business_bom: 'BOM Call',
Business_pick_pickTicket: 'Other outbound items',
business_inv: 'Inventory management',
business_inv_inventory: 'Total inventory inquiry',
business_inv_invXt: 'Collaborative inventory',
business_inv_invXb: 'Cache inventory',
business_inv_invZz: 'Manufacturing inventory',
business_inv_inventoryLog: 'Inventory Log',
system: 'system management',
system_job: 'Post Management',
system_user: 'User Management',
system_role: 'Job Management',
system_dict: 'Dict Management',
system_local: 'File Store',
system2: 'Develop backend configuration',
system2_menu: 'menu management',
system2_tool: 'System Tools',
system2_mnt: 'IT Operation Management',
system2_monitor: 'system monitor',
system2_report: 'Report Management'
}
};

164
src/i18n/zh-CN.js 100644
View File

@ -0,0 +1,164 @@
export default {
el: {
colorpicker: {
confirm: '确定',
clear: '清空'
},
datepicker: {
now: '此刻',
today: '今天',
cancel: '取消',
clear: '清空',
confirm: '确定',
selectDate: '选择日期',
selectTime: '选择时间',
startDate: '开始日期',
startTime: '开始时间',
endDate: '结束日期',
endTime: '结束时间',
prevYear: '前一年',
nextYear: '后一年',
prevMonth: '上个月',
nextMonth: '下个月',
year: '年',
month1: '1 月',
month2: '2 月',
month3: '3 月',
month4: '4 月',
month5: '5 月',
month6: '6 月',
month7: '7 月',
month8: '8 月',
month9: '9 月',
month10: '10 月',
month11: '11 月',
month12: '12 月',
// week: '周次',
weeks: {
sun: '日',
mon: '一',
tue: '二',
wed: '三',
thu: '四',
fri: '五',
sat: '六'
},
months: {
jan: '一月',
feb: '二月',
mar: '三月',
apr: '四月',
may: '五月',
jun: '六月',
jul: '七月',
aug: '八月',
sep: '九月',
oct: '十月',
nov: '十一月',
dec: '十二月'
}
},
select: {
loading: '加载中',
noMatch: '无匹配数据',
noData: '无数据',
placeholder: '请选择'
},
cascader: {
noMatch: '无匹配数据',
loading: '加载中',
placeholder: '请选择',
noData: '暂无数据'
},
pagination: {
goto: '前往',
pagesize: '条/页',
total: '共 {total} 条',
pageClassifier: '页'
},
messagebox: {
title: '提示',
confirm: '确定',
cancel: '取消',
error: '输入的数据不合法!'
},
upload: {
deleteTip: '按 delete 键可删除',
delete: '删除',
preview: '查看图片',
continue: '继续上传'
},
table: {
emptyText: '暂无数据',
confirmFilter: '筛选',
resetFilter: '重置',
clearFilter: '全部',
sumText: '合计'
},
tree: {
emptyText: '暂无数据'
},
transfer: {
noMatch: '无匹配数据',
noData: '无数据',
titles: ['列表 1', '列表 2'],
filterPlaceholder: '请输入搜索内容',
noCheckedFormat: '共 {total} 项',
hasCheckedFormat: '已选 {checked}/{total} 项'
},
image: {
error: '加载失败'
},
pageHeader: {
title: '返回'
},
popconfirm: {
confirmButtonText: '确定',
cancelButtonText: '取消'
},
empty: {
description: '暂无数据'
}
},
login: {
bt_login: '登录'
},
menu: {
BaseData: '基础数据',
BaseData_BaseWare: '仓库基础资料',
BaseData_BaseWare_dept: '仓库管理',
BaseData_BaseWare_area: '库区管理',
BaseData_BaseWare_point: '库位管理',
BaseData_BaseWare_PlatformMaintenance: '月台维护',
BaseData_BaseWare_billType: '单据类型',
BaseData_item: '物料管理',
BaseData_ruleConfigure: '系统规则配置',
BaseData_timing: '定时任务配置',
Business_asn: '入库管理',
Business_asn_xppRecord: '现品票采集上架',
Business_asn_AsnDetail: '现品票上架',
Business_asn_viewAsnDetail: '其他入库',
Business_pick: '出库管理',
Business_pick_business_indicate: '出库指示',
Business_pick_business_bom: 'BOM叫料',
Business_pick_pickTicket: '其他出库',
business_inv: '库存管理',
business_inv_inventory: '总库存查询',
business_inv_invXt: '协同库存',
business_inv_invXb: '缓存库存',
business_inv_invZz: '制造库存',
business_inv_inventoryLog: '库存日志',
system: '系统管理',
system_job: '岗位管理',
system_user: '用户管理',
system_role: '角色管理',
system_dict: '字典管理',
system_local: '文件存储',
system2: '开发后台配置',
system2_menu: '菜单管理',
system2_tool: '系统工具',
system2_mnt: '运维管理',
system2_monitor: '系统监控',
system2_report: '报表配置'
}
};

View File

@ -0,0 +1,4 @@
{
"message": "Hello, World!",
"welcome": "Welcome to my app."
}

View File

@ -0,0 +1,4 @@
{
"message": "你好,世界!",
"welcome": "欢迎来到我的应用。"
}

View File

@ -0,0 +1,294 @@
<template>
<div class="main_div" :style="'background-image:url('+ Background +');'">
<BindLicense ref="BindLicense"/>
<el-row type="flex" style="width: 100%;height: 100%">
<!-- 底部 -->
<!-- <el-col :span="12" ><div class="main_left" ></div></el-col> -->
<el-col :span="24"><div class="login">
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" label-position="left" label-width="0px" class="login-form">
<div style="margin-top: 20px;margin-right: auto;margin-left: auto;width: 100px;height: 100px">
<el-avatar src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png" style="height: 100px;width: 100px" fit="fill"></el-avatar>
</div>
<h2 class="title" @click="bingLicense">
WelCome to YouChain Plus! 👋
</h2>
<el-form-item prop="username">
<el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="account number">
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
</el-input>
</el-form-item>
<el-form-item prop="password">
<el-input v-model="loginForm.password" type="password" auto-complete="off" placeholder="password" @keyup.enter.native="handleLogin">
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
</el-input>
</el-form-item>
<el-form-item prop="code">
<el-input v-model="loginForm.code" auto-complete="off" placeholder="Verification code" style="width: 63%" @keyup.enter.native="handleLogin">
<svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />
</el-input>
<div class="login-code">
<img :src="codeUrl" @click="getCode">
</div>
</el-form-item>
<el-checkbox v-model="loginForm.rememberMe" style="margin:0 0 25px 0;">
remember me
</el-checkbox>
<el-dropdown style="margin-left: 100px;color: #00a0e9" :trigger="hover" @command="handleCommand">
<span class="el-dropdown-link">
Language switching<i class="el-icon-arrow-down el-icon--right"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="zh">Chinese</el-dropdown-item>
<el-dropdown-item command="en">English</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-form-item style="width:100%;">
<el-button :loading="loading" size="medium" type="primary" style="width:100%;" @click.native.prevent="handleLogin">
<span v-if="!loading">Login</span>
<span v-else>Logging in...</span>
</el-button>
</el-form-item>
<h5 class="zhuce" @click="bingLicense">
If you don't have an account yet<span style="color: #00a0e9;margin-left: 5px" href="">Please contact the administrator</span>
</h5>
</el-form>
</div></el-col>
</el-row>
<!-- 底部 -->
<div v-if="$store.state.settings.showFooter" id="el-login-footer">
<span v-html="$store.state.settings.footerTxt" />
<span v-if="$store.state.settings.caseNumber"> </span>
<a href="https://beian.miit.gov.cn/#/Integrated/index" target="_blank">{{ $store.state.settings.caseNumber }}</a>
</div>
</div>
</template>
<script>
import { encrypt } from '@/utils/rsaEncrypt'
import Config from '@/settings'
import { getCodeImg, getDeviceInfo } from '@/api/login'
import Cookies from 'js-cookie'
import qs from 'qs'
import Background from '@/assets/images/background3.png'
import BindLicense from '@/views/licenseBind.vue'
export default {
name: 'Login',
components: { BindLicense },
data() {
return {
click_count: 0,
Background: Background,
codeUrl: '',
cookiePass: '',
loginForm: {
username: 'admin',
password: '123456',
rememberMe: false,
code: '',
uuid: ''
},
loginRules: {
username: [{ required: true, trigger: 'blur', message: 'username cannot be empty' }],
password: [{ required: true, trigger: 'blur', message: 'password cannot be empty' }],
code: [{ required: true, trigger: 'change', message: 'verification code cannot be empty' }]
},
loading: false,
redirect: undefined
}
},
watch: {
$route: {
handler: function(route) {
const data = route.query
if (data && data.redirect) {
this.redirect = data.redirect
delete data.redirect
if (JSON.stringify(data) !== '{}') {
this.redirect = this.redirect + '&' + qs.stringify(data, { indices: false })
}
}
},
immediate: true
}
},
created() {
//
this.getCode()
// Cookie
this.getCookie()
// token
this.point()
this.getDevice()
},
methods: {
handleCommand(command) {
// eslint-disable-next-line no-empty
if (command === 'zh') {
this.$message('click on item ' + command)
this.$router.push('/login')
}
},
getCode() {
getCodeImg().then(res => {
this.codeUrl = res.img
this.loginForm.uuid = res.uuid
})
},
getDevice() {
getDeviceInfo().then(res => {
this.$refs.BindLicense.form.deviceCode = res
})
},
getCookie() {
const username = Cookies.get('username')
let password = Cookies.get('password')
const rememberMe = Cookies.get('rememberMe')
// cookie
this.cookiePass = password === undefined ? '' : password
password = password === undefined ? this.loginForm.password : password
this.loginForm = {
username: username === undefined ? this.loginForm.username : username,
password: password,
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe),
code: ''
}
},
handleLogin() {
this.$i18n.locale = 'en'
this.$refs.loginForm.validate(valid => {
const user = {
username: this.loginForm.username,
password: this.loginForm.password,
rememberMe: this.loginForm.rememberMe,
code: this.loginForm.code,
uuid: this.loginForm.uuid
}
if (user.password !== this.cookiePass) {
user.password = encrypt(user.password)
}
if (valid) {
this.loading = true
if (user.rememberMe) {
Cookies.set('username', user.username, { expires: Config.passCookieExpires })
Cookies.set('password', user.password, { expires: Config.passCookieExpires })
Cookies.set('rememberMe', user.rememberMe, { expires: Config.passCookieExpires })
} else {
Cookies.remove('username')
Cookies.remove('password')
Cookies.remove('rememberMe')
}
this.$store.dispatch('Login', user).then(() => {
this.loading = false
this.$router.push({ path: this.redirect || '/' })
}).catch(() => {
this.loading = false
this.getCode()
})
} else {
console.log('error submit!!')
return false
}
})
},
point() {
const point = Cookies.get('point') !== undefined
if (point) {
this.$notify({
title: 'prompt',
message: 'The current login status has expired, please log in again!',
type: 'warning',
duration: 5000
})
Cookies.remove('point')
}
},
bingLicense() {
this.click_count = this.click_count + 1
if (this.click_count % 3 === 0) {
this.$refs.BindLicense.dialogVisible = true
}
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss">
.main_div {
background: #f7f7f7;
display: flex;
justify-content: center;
align-items: center;
height: 100%;
width: 100%;
background-size: cover;
}
.main_left {
background: #fffffff5;
display: flex;
justify-content: center;
align-items: center;
height: 100%;
width: 100%;
background-size: cover;
}
.login {
background: #00000045;
display: flex;
justify-content: center;
align-items: center;
height: 100%;
width: 100%;
background-size: cover;
}
.title {
margin: 30px auto 30px 0px;
text-align: left;
color: #707070;
}
.zhuce {
margin: 30px auto 30px 0px;
text-align: center;
color: #707070;
}
.login-form {
border-radius: 6px;
background: #fffffff0;
width: 520px;
height: 620px;
padding: 40px 80px 40px 80px;
.el-input {
height: 40px;
input {
height: 40px;
}
}
.input-icon{
height: 39px;width: 14px;margin-left: 2px;
}
}
.login-tip {
font-size: 13px;
text-align: center;
color: #bfbfbf;
}
.login-code {
width: 33%;
display: inline-block;
height: 38px;
float: right;
img{
cursor: pointer;
vertical-align:middle
}
}
</style>