修改中英文切换
This commit is contained in:
@@ -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();
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user