feat: acs国际化

This commit is contained in:
2023-11-27 15:17:01 +08:00
parent ce4f06a789
commit c46e41f3e8
46 changed files with 959 additions and 332 deletions

View File

@@ -9,18 +9,18 @@
<search id="header-search" class="right-menu-item" />
<!-- <el-tooltip content="项目文档" effect="dark" placement="bottom">
<Doc class="right-menu-item hover-effect" />
</el-tooltip>-->
<Doc class="right-menu-item hover-effect" />
</el-tooltip>-->
<el-tooltip content="全屏缩放" effect="dark" placement="bottom">
<el-tooltip :content="$t('common.fz')" effect="dark" placement="bottom">
<screenfull id="screenfull" class="right-menu-item hover-effect" />
</el-tooltip>
<notice-icon class="right-menu-item" />
<notice-icon-reader ref="noticeIconReader" />
<!-- <el-tooltip content="布局设置" effect="dark" placement="bottom">
<size-select id="size-select" class="right-menu-item hover-effect" />
</el-tooltip>-->
<size-select id="size-select" class="right-menu-item hover-effect" />
</el-tooltip>-->
</template>
<img :src="Avatar" class="user-avatar">
@@ -31,21 +31,31 @@
<el-dropdown-menu slot="dropdown">
<span style="display:block;" @click="show = true">
<el-dropdown-item>
布局设置
{{ $t('common.Layout_setting') }}
</el-dropdown-item>
</span>
<router-link to="/user/center">
<el-dropdown-item>
个人中心
{{ $t('common.Personal_center') }}
</el-dropdown-item>
</router-link>
<span style="display:block;" @click="open">
<el-dropdown-item divided>
退出登录
{{ $t('common.Log_out') }}
</el-dropdown-item>
</span>
</el-dropdown-menu>
</el-dropdown>
<el-dropdown class="right-menu-item" style="font-size: 14px" trigger="click" @command="langChange">
<span class="el-dropdown-link">
{{ language }} <i class="el-icon-caret-bottom" />
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item divided command="zh">简体中文</el-dropdown-item>
<el-dropdown-item divided command="en">English</el-dropdown-item>
<el-dropdown-item divided command="in">Indonesian</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
</div>
</template>
@@ -79,10 +89,12 @@ export default {
data() {
return {
Avatar: Avatar,
dialogVisible: false
dialogVisible: false,
language: '简体中文'
}
},
created() {
this.setLang(localStorage.getItem('lang'))
this.initWebSocket()
},
computed: {
@@ -110,13 +122,29 @@ export default {
}
},
methods: {
// 中英文切换
langChange(command) {
this.$i18n.locale = command
localStorage.setItem('lang', command)
this.setLang(command)
location.reload()
},
setLang(command) {
if (command === 'en') {
this.language = 'English'
} else if (command === 'zh') {
this.language = '简体中文'
} else if (command === 'in') {
this.language = 'Indonesian'
}
},
toggleSideBar() {
this.$store.dispatch('app/toggleSideBar')
},
open() {
this.$confirm('确定注销并退出系统吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
this.$confirm(this.$t('common.Tip13'), this.$t('common.Tips'), {
confirmButtonText: this.$t('common.Confirm'),
cancelButtonText: this.$t('common.Cancel'),
type: 'warning'
}).then(() => {
this.logout()
@@ -128,6 +156,7 @@ export default {
})
},
initWebSocket() {
// const wsUri = (process.env.VUE_APP_WS_API === '/' ? '/' : (process.env.VUE_APP_WS_API + '/')) + 'messageInfo'
const wsUri = window.g.prod.VUE_APP_BASE_API.replace('http', 'ws') + '/webSocket/' + 'messageInfo'
this.websock = new WebSocket(wsUri)
this.websock.onerror = this.webSocketOnError
@@ -135,7 +164,7 @@ export default {
},
webSocketOnError(e) {
this.$notify({
title: 'WebSocket连接发生错误',
title: this.$t('common.Tip14'),
type: 'error',
duration: 0
})