[update 系统] i18n抽离单独js文件
This commit is contained in:
@@ -208,6 +208,15 @@ module.exports = {
|
|||||||
support: 'You can upload files in ',
|
support: 'You can upload files in ',
|
||||||
formatUpload: ' formats. ',
|
formatUpload: ' formats. ',
|
||||||
theSizeIs: 'The size is ',
|
theSizeIs: 'The size is ',
|
||||||
|
loginExpired: 'Login has expired',
|
||||||
|
loginExpiredMessage: 'Sorry, the login has expired. Please log in again',
|
||||||
|
logInAgain: 'Log in again',
|
||||||
|
loggingBackIn: 'Login has expired, logging in again',
|
||||||
|
prompted: 'prompted',
|
||||||
|
noAccess: 'no access',
|
||||||
|
resourceNotFound: 'Sorry, the resource was not found!',
|
||||||
|
networkTimeout: 'Network Timeout',
|
||||||
|
unauthorized: 'Unauthorized, please log in again',
|
||||||
// 树右键
|
// 树右键
|
||||||
treeRight: {
|
treeRight: {
|
||||||
addFolder: 'Create New Folder',
|
addFolder: 'Create New Folder',
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import VueI18n from 'vue-i18n'
|
||||||
|
import LangENUS from '@/common/lang/en-us'
|
||||||
|
import LangZHCN from '@/common/lang/zh-cn'
|
||||||
|
import Vue from 'vue'
|
||||||
|
|
||||||
|
Vue.use(VueI18n)
|
||||||
|
|
||||||
|
const i18n = new VueI18n({
|
||||||
|
locale: 'zh-cn',
|
||||||
|
messages: {
|
||||||
|
'en-us': LangENUS,
|
||||||
|
'zh-cn': LangZHCN
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
export default i18n
|
||||||
@@ -225,6 +225,15 @@ module.exports = {
|
|||||||
support: '支持',
|
support: '支持',
|
||||||
formatUpload: '格式上传,',
|
formatUpload: '格式上传,',
|
||||||
theSizeIs: '大小为',
|
theSizeIs: '大小为',
|
||||||
|
loginExpired: '登录已过期',
|
||||||
|
loginExpiredMessage: '很抱歉,登录已过期,请重新登录',
|
||||||
|
logInAgain: '重新登录',
|
||||||
|
loggingBackIn: '登录已过期,正在重新登陆',
|
||||||
|
prompted: '系统提示',
|
||||||
|
noAccess: '拒绝访问',
|
||||||
|
resourceNotFound: '很抱歉,资源未找到!',
|
||||||
|
networkTimeout: '网络超时',
|
||||||
|
unauthorized: '未授权,请重新登录',
|
||||||
// 标准字段
|
// 标准字段
|
||||||
standardField: {
|
standardField: {
|
||||||
standardEnglishName: '标准英文名称',
|
standardEnglishName: '标准英文名称',
|
||||||
|
|||||||
+3
-13
@@ -15,16 +15,13 @@ import Antd, { version } from 'ant-design-vue'
|
|||||||
// import Viser from 'viser-vue'
|
// import Viser from 'viser-vue'
|
||||||
import 'ant-design-vue/dist/antd.less' // or 'ant-design-vue/dist/antd.less'
|
import 'ant-design-vue/dist/antd.less' // or 'ant-design-vue/dist/antd.less'
|
||||||
|
|
||||||
import VueI18n from 'vue-i18n'
|
|
||||||
import LangENUS from './common/lang/en-us'
|
|
||||||
import LangZHCN from './common/lang/zh-cn'
|
|
||||||
|
|
||||||
import '@/permission' // permission control
|
import '@/permission' // permission control
|
||||||
|
|
||||||
// import '@/utils/filter' // base filtermybatis-plus
|
// import '@/utils/filter' // base filtermybatis-plus
|
||||||
// TODO 为什么要用2个图片预览的工具?
|
// TODO 为什么要用2个图片预览的工具?
|
||||||
// import preview from 'vue-photo-preview'
|
// import preview from 'vue-photo-preview'
|
||||||
// import 'vue-photo-preview/dist/skin.css'
|
// import 'vue-photo-preview/dist/skin.css'
|
||||||
|
// import 'vue-photo-preview/dist/skin.css'
|
||||||
|
|
||||||
import Viewer from 'v-viewer'
|
import Viewer from 'v-viewer'
|
||||||
import 'viewerjs/dist/viewer.css'
|
import 'viewerjs/dist/viewer.css'
|
||||||
@@ -51,6 +48,8 @@ import JeroComponents from '@/components/jero/index'
|
|||||||
import JDictComponenets from '@comp/dict/index.js'
|
import JDictComponenets from '@comp/dict/index.js'
|
||||||
|
|
||||||
import JTable from '@comp/jero/JTable.vue'
|
import JTable from '@comp/jero/JTable.vue'
|
||||||
|
import i18n from '@/common/lang'
|
||||||
|
|
||||||
// Vue.prototype.rules = rules
|
// Vue.prototype.rules = rules
|
||||||
Vue.config.productionTip = false
|
Vue.config.productionTip = false
|
||||||
Vue.use(Storage, config.storageOptions)
|
Vue.use(Storage, config.storageOptions)
|
||||||
@@ -58,7 +57,6 @@ Vue.use(Antd)
|
|||||||
Vue.use(VueAxios, router)
|
Vue.use(VueAxios, router)
|
||||||
|
|
||||||
Vue.use(hasPermission)
|
Vue.use(hasPermission)
|
||||||
Vue.use(VueI18n)
|
|
||||||
Vue.use(Viewer)
|
Vue.use(Viewer)
|
||||||
Vue.use(JeroComponents)
|
Vue.use(JeroComponents)
|
||||||
Vue.use(JDictComponenets)
|
Vue.use(JDictComponenets)
|
||||||
@@ -69,14 +67,6 @@ Viewer.setDefaults({
|
|||||||
toolbar: false
|
toolbar: false
|
||||||
})
|
})
|
||||||
|
|
||||||
const i18n = new VueI18n({
|
|
||||||
locale: 'zh-cn',
|
|
||||||
messages: {
|
|
||||||
'en-us': LangENUS,
|
|
||||||
'zh-cn': LangZHCN
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
SSO.init(() => {
|
SSO.init(() => {
|
||||||
main()
|
main()
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ export const ConfigurableTableMixin = {
|
|||||||
if (this.operationList && this.operationList.length > this.operateMaxNum + 1) {
|
if (this.operationList && this.operationList.length > this.operateMaxNum + 1) {
|
||||||
width += this.getTextWith(this.operationList[0].text) + this.getTextWith(this.$t('more'))
|
width += this.getTextWith(this.operationList[0].text) + this.getTextWith(this.$t('more'))
|
||||||
} else if (this.operationList && this.operationList.length > 1) {
|
} else if (this.operationList && this.operationList.length > 1) {
|
||||||
width += this.getTextWith(this.operationList[0].text) + this.getTextWith(this.operationList[1].text)
|
width += this.getTextWith(this.operationList[0].text) + this.getTextWith(this.operationList[1].text)
|
||||||
console.log(width)
|
console.log(width)
|
||||||
}
|
}
|
||||||
const operateColumn = JSON.parse(JSON.stringify(this.operateColumn))
|
const operateColumn = JSON.parse(JSON.stringify(this.operateColumn))
|
||||||
@@ -322,9 +322,9 @@ export const ConfigurableTableMixin = {
|
|||||||
const token = Vue.ls.get(ACCESS_TOKEN)
|
const token = Vue.ls.get(ACCESS_TOKEN)
|
||||||
if (token && data.message.includes('Token失效')) {
|
if (token && data.message.includes('Token失效')) {
|
||||||
this.error({
|
this.error({
|
||||||
title: '登录已过期',
|
title: this.$t('loginExpired'),
|
||||||
content: '很抱歉,登录已过期,请重新登录',
|
content: this.$t('loginExpiredMessage'),
|
||||||
okText: '重新登录',
|
okText: this.$t('logInAgain'),
|
||||||
mask: false,
|
mask: false,
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
store.dispatch('Logout').then(() => {
|
store.dispatch('Logout').then(() => {
|
||||||
|
|||||||
@@ -456,9 +456,9 @@ export const JeroListMixin = {
|
|||||||
const token = Vue.ls.get(ACCESS_TOKEN)
|
const token = Vue.ls.get(ACCESS_TOKEN)
|
||||||
if (token && data.message.includes('Token失效')) {
|
if (token && data.message.includes('Token失效')) {
|
||||||
this.error({
|
this.error({
|
||||||
title: '登录已过期',
|
title: this.$t('loginExpired'),
|
||||||
content: '很抱歉,登录已过期,请重新登录',
|
content: this.$t('loginExpiredMessage'),
|
||||||
okText: '重新登录',
|
okText: this.$t('logInAgain'),
|
||||||
mask: false,
|
mask: false,
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
store.dispatch('Logout').then(() => {
|
store.dispatch('Logout').then(() => {
|
||||||
|
|||||||
+15
-14
@@ -5,6 +5,7 @@ import { VueAxios } from './axios'
|
|||||||
import router from '@/router/index'
|
import router from '@/router/index'
|
||||||
import { ACCESS_TOKEN, TENANT_ID } from '@/store/mutation-types'
|
import { ACCESS_TOKEN, TENANT_ID } from '@/store/mutation-types'
|
||||||
import { Modal } from 'ant-design-vue'
|
import { Modal } from 'ant-design-vue'
|
||||||
|
import i18n from '@/common/lang'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 【指定 axios的 baseURL】
|
* 【指定 axios的 baseURL】
|
||||||
@@ -29,7 +30,7 @@ const err = (error) => {
|
|||||||
console.log('------异常响应------', error.response.status)
|
console.log('------异常响应------', error.response.status)
|
||||||
switch (error.response.status) {
|
switch (error.response.status) {
|
||||||
case 403:
|
case 403:
|
||||||
Vue.prototype.$Jnotification.error({ message: '系统提示', description: '拒绝访问', duration: 4 })
|
Vue.prototype.$Jnotification.error({ message: i18n.t('prompted'), description: i18n.t('noAccess'), duration: 4 })
|
||||||
break
|
break
|
||||||
case 500:
|
case 500:
|
||||||
console.log('------error.response------', error.response)
|
console.log('------error.response------', error.response)
|
||||||
@@ -42,12 +43,12 @@ const err = (error) => {
|
|||||||
if (typeof data === 'string' ? data.includes('Token失效') : data.message.includes('Token失效')) {
|
if (typeof data === 'string' ? data.includes('Token失效') : data.message.includes('Token失效')) {
|
||||||
// update-begin- --- author:scott ------ date:20190225 ---- for:Token失效采用弹框模式,不直接跳转----
|
// update-begin- --- author:scott ------ date:20190225 ---- for:Token失效采用弹框模式,不直接跳转----
|
||||||
if (/wxwork|dingtalk/i.test(navigator.userAgent)) {
|
if (/wxwork|dingtalk/i.test(navigator.userAgent)) {
|
||||||
Vue.prototype.$Jmessage.loading('登录已过期,正在重新登陆', 0)
|
Vue.prototype.$Jmessage.loading(i18n.t('loggingBackIn'), 0)
|
||||||
} else {
|
} else {
|
||||||
Vue.prototype.$Jmodal.error({
|
Vue.prototype.$Jmodal.error({
|
||||||
title: '登录已过期',
|
title: i18n.t('loginExpired'),
|
||||||
content: '很抱歉,登录已过期,请重新登录',
|
content: i18n.t('loginExpiredMessage'),
|
||||||
okText: '重新登录',
|
okText: i18n.t('logInAgain'),
|
||||||
mask: false,
|
mask: false,
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
store.dispatch('Logout')
|
store.dispatch('Logout')
|
||||||
@@ -58,13 +59,13 @@ const err = (error) => {
|
|||||||
}
|
}
|
||||||
break
|
break
|
||||||
case 404:
|
case 404:
|
||||||
Vue.prototype.$Jnotification.error({ message: '系统提示', description: '很抱歉,资源未找到!', duration: 4 })
|
Vue.prototype.$Jnotification.error({ message: i18n.t('prompted'), description: i18n.t('resourceNotFound'), duration: 4 })
|
||||||
break
|
break
|
||||||
case 504:
|
case 504:
|
||||||
Vue.prototype.$Jnotification.error({ message: '系统提示', description: '网络超时' })
|
Vue.prototype.$Jnotification.error({ message: i18n.t('prompted'), description: i18n.t('networkTimeout') })
|
||||||
break
|
break
|
||||||
case 401:
|
case 401:
|
||||||
Vue.prototype.$Jnotification.error({ message: '系统提示', description: '未授权,请重新登录', duration: 4 })
|
Vue.prototype.$Jnotification.error({ message: i18n.t('prompted'), description: i18n.t('unauthorized'), duration: 4 })
|
||||||
if (token) {
|
if (token) {
|
||||||
store.dispatch('Logout').then(() => {
|
store.dispatch('Logout').then(() => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -75,7 +76,7 @@ const err = (error) => {
|
|||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
Vue.prototype.$Jnotification.error({
|
Vue.prototype.$Jnotification.error({
|
||||||
message: '系统提示',
|
message: i18n.t('prompted'),
|
||||||
description: data.message,
|
description: data.message,
|
||||||
duration: 4
|
duration: 4
|
||||||
})
|
})
|
||||||
@@ -83,9 +84,9 @@ const err = (error) => {
|
|||||||
}
|
}
|
||||||
} else if (error.message) {
|
} else if (error.message) {
|
||||||
if (error.message.includes('timeout')) {
|
if (error.message.includes('timeout')) {
|
||||||
Vue.prototype.$Jnotification.error({ message: '系统提示', description: '网络超时' })
|
Vue.prototype.$Jnotification.error({ message: i18n.t('prompted'), description: i18n.t('networkTimeout') })
|
||||||
} else {
|
} else {
|
||||||
Vue.prototype.$Jnotification.error({ message: '系统提示', description: error.message })
|
Vue.prototype.$Jnotification.error({ message: i18n.t('prompted'), description: error.message })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Promise.reject(error)
|
return Promise.reject(error)
|
||||||
@@ -157,9 +158,9 @@ function blobToJson (data) {
|
|||||||
console.log('token----------》', token)
|
console.log('token----------》', token)
|
||||||
if (token && jsonData.message.includes('Token失效')) {
|
if (token && jsonData.message.includes('Token失效')) {
|
||||||
Modal.error({
|
Modal.error({
|
||||||
title: '登录已过期',
|
title: i18n.t('loginExpired'),
|
||||||
content: '很抱歉,登录已过期,请重新登录',
|
content: i18n.t('loginExpiredMessage'),
|
||||||
okText: '重新登录',
|
okText: i18n.t('logInAgain'),
|
||||||
mask: false,
|
mask: false,
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
store.dispatch('Logout').then(() => {
|
store.dispatch('Logout').then(() => {
|
||||||
|
|||||||
+3
-3
@@ -637,9 +637,9 @@ export default {
|
|||||||
const token = Vue.ls.get(ACCESS_TOKEN)
|
const token = Vue.ls.get(ACCESS_TOKEN)
|
||||||
if (token && data.message.includes('Token失效')) {
|
if (token && data.message.includes('Token失效')) {
|
||||||
this.error({
|
this.error({
|
||||||
title: '登录已过期',
|
title: this.$t('loginExpired'),
|
||||||
content: '很抱歉,登录已过期,请重新登录',
|
content: this.$t('loginExpiredMessage'),
|
||||||
okText: '重新登录',
|
okText: this.$t('logInAgain'),
|
||||||
mask: false,
|
mask: false,
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
store.dispatch('Logout').then(() => {
|
store.dispatch('Logout').then(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user