修改中英文切换
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
import enquireScreen from '@/utils/device'
|
import enquireScreen from '@/utils/device'
|
||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
import 'moment/locale/zh-cn'
|
import 'moment/locale/zh-cn'
|
||||||
|
import store from './store'
|
||||||
|
|
||||||
moment.locale('zh-cn')
|
moment.locale('zh-cn')
|
||||||
|
|
||||||
@@ -65,11 +66,12 @@
|
|||||||
localStorage.setItem('language', 'en-us')
|
localStorage.setItem('language', 'en-us')
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
// 刷新页面
|
|
||||||
this.isRouterAlive = false //先关闭,
|
this.isRouterAlive = false //先关闭,
|
||||||
|
// 刷新页面
|
||||||
this.$nextTick(function() {
|
this.$nextTick(function() {
|
||||||
this.isRouterAlive = true //再打开
|
this.isRouterAlive = true //再打开
|
||||||
})
|
})
|
||||||
|
|
||||||
// 系统组件适配
|
// 系统组件适配
|
||||||
let lang = localStorage.language
|
let lang = localStorage.language
|
||||||
if (lang == 'zh-cn') {
|
if (lang == 'zh-cn') {
|
||||||
|
|||||||
@@ -9,11 +9,12 @@
|
|||||||
@change="onChange"
|
@change="onChange"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
mode="multiple"
|
mode="multiple"
|
||||||
|
:maxTagCount="1"
|
||||||
|
:maxTagTextLength="2"
|
||||||
:placeholder="placeholder"
|
:placeholder="placeholder"
|
||||||
:getPopupContainer="getParentContainer"
|
:getPopupContainer="getParentContainer"
|
||||||
optionFilterProp="children"
|
optionFilterProp="children"
|
||||||
:filterOption="filterOption"
|
:filterOption="filterOption">
|
||||||
allowClear>
|
|
||||||
<a-select-option
|
<a-select-option
|
||||||
v-for="(item,index) in dictOptions"
|
v-for="(item,index) in dictOptions"
|
||||||
:key="index"
|
:key="index"
|
||||||
@@ -130,3 +131,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<style>
|
||||||
|
.ant-select-selection__choice{
|
||||||
|
max-width: 50% !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<a-drawer
|
<a-drawer
|
||||||
:title="'推送'"
|
:title="$t('Push')"
|
||||||
:maskClosable="false"
|
:maskClosable="false"
|
||||||
:width="600"
|
:width="600"
|
||||||
placement="right"
|
placement="right"
|
||||||
@@ -17,7 +17,6 @@
|
|||||||
:loading="loading"
|
:loading="loading"
|
||||||
:tree-data="gData"
|
:tree-data="gData"
|
||||||
@select="onSelect"
|
@select="onSelect"
|
||||||
@check="onCheck"
|
|
||||||
>
|
>
|
||||||
</a-tree>
|
</a-tree>
|
||||||
</div>
|
</div>
|
||||||
@@ -32,10 +31,12 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getAction, postAction } from '@/api/manage'
|
import { getAction, postAction } from '@/api/manage'
|
||||||
|
import eventBUs from '../../common/event'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'index',
|
name: 'index',
|
||||||
props: {
|
props: {
|
||||||
url:{
|
url: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: {}
|
default: {}
|
||||||
}
|
}
|
||||||
@@ -60,121 +61,9 @@
|
|||||||
{
|
{
|
||||||
title: 'parent 1-1',
|
title: 'parent 1-1',
|
||||||
key: '0-0-1',
|
key: '0-0-1',
|
||||||
children: [{ key: '0-0-1-0', title: 'zcvc' }]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}, {
|
|
||||||
title: 'parent 1',
|
|
||||||
key: '0-0',
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
title: '张晨成',
|
|
||||||
key: '0-0-0',
|
|
||||||
disabled: true,
|
|
||||||
children: [
|
children: [
|
||||||
{ title: 'leaf', key: '0-0-0-0' },
|
{ key: '0-0-1-0', title: 'zcvc' }
|
||||||
{ title: 'leaf', key: '0-0-0-1' }
|
|
||||||
]
|
]
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'parent 1-1',
|
|
||||||
key: '0-0-1',
|
|
||||||
children: [{ key: '0-0-1-0', title: 'zcvc' }]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}, {
|
|
||||||
title: 'parent 1',
|
|
||||||
key: '0-0',
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
title: '张晨成',
|
|
||||||
key: '0-0-0',
|
|
||||||
disabled: true,
|
|
||||||
children: [
|
|
||||||
{ title: 'leaf', key: '0-0-0-0' },
|
|
||||||
{ title: 'leaf', key: '0-0-0-1' }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'parent 1-1',
|
|
||||||
key: '0-0-1',
|
|
||||||
children: [{ key: '0-0-1-0', title: 'zcvc' }]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}, {
|
|
||||||
title: 'parent 1',
|
|
||||||
key: '0-0',
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
title: '张晨成',
|
|
||||||
key: '0-0-0',
|
|
||||||
disabled: true,
|
|
||||||
children: [
|
|
||||||
{ title: 'leaf', key: '0-0-0-0' },
|
|
||||||
{ title: 'leaf', key: '0-0-0-1' }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'parent 1-1',
|
|
||||||
key: '0-0-1',
|
|
||||||
children: [{ key: '0-0-1-0', title: 'zcvc' }]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}, {
|
|
||||||
title: 'parent 1',
|
|
||||||
key: '0-0',
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
title: '张晨成',
|
|
||||||
key: '0-0-0',
|
|
||||||
disabled: true,
|
|
||||||
children: [
|
|
||||||
{ title: 'leaf', key: '0-0-0-0' },
|
|
||||||
{ title: 'leaf', key: '0-0-0-1' }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'parent 1-1',
|
|
||||||
key: '0-0-1',
|
|
||||||
children: [{ key: '0-0-1-0', title: 'zcvc' }]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}, {
|
|
||||||
title: 'parent 1',
|
|
||||||
key: '0-0',
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
title: '张晨成',
|
|
||||||
key: '0-0-0',
|
|
||||||
disabled: true,
|
|
||||||
children: [
|
|
||||||
{ title: 'leaf', key: '0-0-0-0' },
|
|
||||||
{ title: 'leaf', key: '0-0-0-1' }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'parent 1-1',
|
|
||||||
key: '0-0-1',
|
|
||||||
children: [{ key: '0-0-1-0', title: 'zcvc' }]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}, {
|
|
||||||
title: 'parent 1',
|
|
||||||
key: '0-0',
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
title: '张晨成',
|
|
||||||
key: '0-0-0',
|
|
||||||
disabled: true,
|
|
||||||
children: [
|
|
||||||
{ title: 'leaf', key: '0-0-0-0' },
|
|
||||||
{ title: 'leaf', key: '0-0-0-1' }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'parent 1-1',
|
|
||||||
key: '0-0-1',
|
|
||||||
children: [{ key: '0-0-1-0', title: 'zcvc' }]
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -182,33 +71,32 @@
|
|||||||
autoExpandParent: true,
|
autoExpandParent: true,
|
||||||
expandedKeys: [],
|
expandedKeys: [],
|
||||||
visible: false,
|
visible: false,
|
||||||
confirmLoading: false
|
confirmLoading: false,
|
||||||
|
selectedKey: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onSelect(selectedKeys, info) {
|
onSelect(selectedKeys) {
|
||||||
console.log('selected', selectedKeys, info)
|
this.selectedKey = selectedKeys
|
||||||
},
|
|
||||||
onCheck(checkedKeys, info) {
|
|
||||||
console.log('onCheck', checkedKeys, info)
|
|
||||||
},
|
},
|
||||||
handleCancel() {
|
handleCancel() {
|
||||||
this.visible = false
|
this.visible = false
|
||||||
},
|
},
|
||||||
handleSubmit() {
|
handleSubmit() {
|
||||||
getAction(this.url.pullMessage,{}).then((res)=>{
|
getAction(this.url.pullMessage, {}).then((res) => {
|
||||||
if (res.success){
|
if (res.success) {
|
||||||
this.$message.success(res.message)
|
this.$message.success(res.message)
|
||||||
this.visible = false
|
this.visible = false
|
||||||
}else{
|
eventBUs.$emit('searchReset')
|
||||||
|
} else {
|
||||||
this.$message.warning(res.message)
|
this.$message.warning(res.message)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
onChange() {
|
onChange(e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -141,6 +141,9 @@
|
|||||||
//console.log(this.permissionMenuList)
|
//console.log(this.permissionMenuList)
|
||||||
//console.log('----navTheme------'+this.navTheme)
|
//console.log('----navTheme------'+this.navTheme)
|
||||||
//--update-end----author:scott---date:20190320------for:根据后台菜单配置,判断是否路由菜单字段,动态选择是否生成路由(为了支持参数URL菜单)------
|
//--update-end----author:scott---date:20190320------for:根据后台菜单配置,判断是否路由菜单字段,动态选择是否生成路由(为了支持参数URL菜单)------
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(['setSidebar']),
|
...mapActions(['setSidebar']),
|
||||||
|
|||||||
@@ -33,8 +33,14 @@
|
|||||||
<!-- </span>-->
|
<!-- </span>-->
|
||||||
<header-notice class="action"/>
|
<header-notice class="action"/>
|
||||||
<div class="action">
|
<div class="action">
|
||||||
<span @click="changeLocale('en-us')" v-show="localeval=='zh-cn'">English</span>
|
<span v-show="localeval=='zh-cn'">
|
||||||
<span @click="changeLocale('zh-cn')" v-show="localeval=='en-us'">中文</span>
|
<span @click="changeLocale('en-us')" v-if="!isLoading">English</span>
|
||||||
|
<a-icon v-else type="sync" spin/>
|
||||||
|
</span>
|
||||||
|
<span v-show="localeval=='en-us'">
|
||||||
|
<span @click="changeLocale('zh-cn')" v-if="!isLoading">中文</span>
|
||||||
|
<a-icon v-else type="sync" spin/>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<a-dropdown>
|
<a-dropdown>
|
||||||
<span class="action action-full ant-dropdown-link user-dropdown-menu">
|
<span class="action action-full ant-dropdown-link user-dropdown-menu">
|
||||||
@@ -42,34 +48,34 @@
|
|||||||
<!-- <span v-if="isDesktop()">欢迎您,{{ nickname() }}</span>-->
|
<!-- <span v-if="isDesktop()">欢迎您,{{ nickname() }}</span>-->
|
||||||
</span>
|
</span>
|
||||||
<a-menu slot="overlay" class="user-dropdown-menu-wrapper">
|
<a-menu slot="overlay" class="user-dropdown-menu-wrapper">
|
||||||
<a-menu-item key="0">
|
<!-- <a-menu-item key="0">-->
|
||||||
<router-link :to="{ name: 'account-center' }">
|
<!-- <router-link :to="{ name: 'account-center' }">-->
|
||||||
<a-icon type="user"/>
|
<!-- <a-icon type="user"/>-->
|
||||||
<span>个人中心</span>
|
<!-- <span>个人中心</span>-->
|
||||||
</router-link>
|
<!-- </router-link>-->
|
||||||
</a-menu-item>
|
<!-- </a-menu-item>-->
|
||||||
<a-menu-item key="1">
|
<!-- <a-menu-item key="1">-->
|
||||||
<router-link :to="{ name: 'account-settings-base' }">
|
<!-- <router-link :to="{ name: 'account-settings-base' }">-->
|
||||||
<a-icon type="setting"/>
|
<!-- <a-icon type="setting"/>-->
|
||||||
<span>账户设置</span>
|
<!-- <span>账户设置</span>-->
|
||||||
</router-link>
|
<!-- </router-link>-->
|
||||||
</a-menu-item>
|
<!-- </a-menu-item>-->
|
||||||
<a-menu-item key="3" @click="systemSetting">
|
<!-- <a-menu-item key="3" @click="systemSetting">-->
|
||||||
<a-icon type="tool"/>
|
<!-- <a-icon type="tool"/>-->
|
||||||
<span>系统设置</span>
|
<!-- <span>系统设置</span>-->
|
||||||
</a-menu-item>
|
<!-- </a-menu-item>-->
|
||||||
<a-menu-item key="4" @click="updatePassword">
|
<!-- <a-menu-item key="4" @click="updatePassword">-->
|
||||||
<a-icon type="setting"/>
|
<!-- <a-icon type="setting"/>-->
|
||||||
<span>密码修改</span>
|
<!-- <span>密码修改</span>-->
|
||||||
</a-menu-item>
|
<!-- </a-menu-item>-->
|
||||||
<a-menu-item key="5" @click="updateCurrentDepart">
|
<!-- <a-menu-item key="5" @click="updateCurrentDepart">-->
|
||||||
<a-icon type="cluster"/>
|
<!-- <a-icon type="cluster"/>-->
|
||||||
<span>切换部门</span>
|
<!-- <span>切换部门</span>-->
|
||||||
</a-menu-item>
|
<!-- </a-menu-item>-->
|
||||||
<a-menu-item key="6" @click="clearCache">
|
<!-- <a-menu-item key="6" @click="clearCache">-->
|
||||||
<a-icon type="sync"/>
|
<!-- <a-icon type="sync"/>-->
|
||||||
<span>清理缓存</span>
|
<!-- <span>清理缓存</span>-->
|
||||||
</a-menu-item>
|
<!-- </a-menu-item>-->
|
||||||
<a-menu-item key="6" @click="handleLogout">
|
<a-menu-item key="6" @click="handleLogout">
|
||||||
<a-icon type="logout"/>
|
<a-icon type="logout"/>
|
||||||
<span>退出登录</span>
|
<span>退出登录</span>
|
||||||
@@ -113,6 +119,8 @@
|
|||||||
import zhCN from 'ant-design-vue/lib/locale-provider/zh_CN'
|
import zhCN from 'ant-design-vue/lib/locale-provider/zh_CN'
|
||||||
import enUS from 'ant-design-vue/es/locale/en_US'
|
import enUS from 'ant-design-vue/es/locale/en_US'
|
||||||
import 'moment/locale/zh-cn'
|
import 'moment/locale/zh-cn'
|
||||||
|
import store from '../../store'
|
||||||
|
import router from '../../router'
|
||||||
|
|
||||||
moment.locale('zh-cn')
|
moment.locale('zh-cn')
|
||||||
const EN = 'en-us'
|
const EN = 'en-us'
|
||||||
@@ -127,6 +135,7 @@
|
|||||||
searchMenuOptions: [],
|
searchMenuOptions: [],
|
||||||
searchMenuComp: 'span',
|
searchMenuComp: 'span',
|
||||||
searchMenuVisible: false,
|
searchMenuVisible: false,
|
||||||
|
isLoading: false,
|
||||||
locale: zhCN,
|
locale: zhCN,
|
||||||
localeval: 'zh-cn'
|
localeval: 'zh-cn'
|
||||||
// update-begin author:sunjianlei date:20200219 for: 头部菜单搜索规范命名 --------------
|
// update-begin author:sunjianlei date:20200219 for: 头部菜单搜索规范命名 --------------
|
||||||
@@ -282,23 +291,29 @@
|
|||||||
/*update_end author:liushaoqian date:20200507 for: 刷新缓存*/
|
/*update_end author:liushaoqian date:20200507 for: 刷新缓存*/
|
||||||
moment,
|
moment,
|
||||||
changeLocale(localeval) {
|
changeLocale(localeval) {
|
||||||
this.$root.Bus.$emit('switchLanguage', localeval)
|
this.isLoading = true
|
||||||
this.localeval = localeval
|
store.dispatch('GetPermissionList').then(res => {
|
||||||
if (localeval === EN) {
|
this.$root.Bus.$emit('switchLanguage', localeval)
|
||||||
moment.locale(EN)
|
this.isLoading = false
|
||||||
this.$i18n.locale = EN
|
this.localeval = localeval
|
||||||
this.locale = enUS
|
if (localeval === EN) {
|
||||||
this.queryAllDictItemsByCut()
|
moment.locale(EN)
|
||||||
// localStorage.setItem('language', EN)
|
this.$i18n.locale = EN
|
||||||
// location.reload();
|
this.locale = enUS
|
||||||
} else {
|
this.queryAllDictItemsByCut()
|
||||||
moment.locale(ZH)
|
this.GetPermissionList()
|
||||||
this.$i18n.locale = ZH
|
// localStorage.setItem('language', EN)
|
||||||
this.locale = zhCN
|
// location.reload();
|
||||||
this.queryAllDictItemsByCut()
|
} else {
|
||||||
// localStorage.setItem('language', ZH)
|
moment.locale(ZH)
|
||||||
// location.reload();
|
this.$i18n.locale = ZH
|
||||||
}
|
this.locale = zhCN
|
||||||
|
this.queryAllDictItemsByCut()
|
||||||
|
this.GetPermissionList()
|
||||||
|
// localStorage.setItem('language', ZH)
|
||||||
|
// location.reload();
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -329,6 +329,11 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
loginSuccess () {
|
loginSuccess () {
|
||||||
|
let langCn = localStorage.language
|
||||||
|
// 默认中文
|
||||||
|
if (!langCn) {
|
||||||
|
localStorage.setItem('language', 'zh-cn')
|
||||||
|
}
|
||||||
this.$router.push({ path: "/dashboard/analysis" }).catch((res)=>{})
|
this.$router.push({ path: "/dashboard/analysis" }).catch((res)=>{})
|
||||||
this.$notification.success({
|
this.$notification.success({
|
||||||
message: '欢迎',
|
message: '欢迎',
|
||||||
|
|||||||
Reference in New Issue
Block a user