修改中英文切换

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