Skip to content

Commit

Permalink
add click logo to change web language
Browse files Browse the repository at this point in the history
  • Loading branch information
HimitZH committed Apr 18, 2022
1 parent 66ccdc4 commit a63533f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion hoj-vue/src/components/oj/common/NavBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@
placement="bottom"
effect="dark"
>
<span @click="changeWebLanguage">
<span @click="changeWebLanguage">
{{
websiteConfig.shortName ? websiteConfig.shortName.toUpperCase() : 'OJ'
}}
Expand Down
17 changes: 12 additions & 5 deletions hoj-vue/src/views/admin/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@
:router="true"
:default-active="currentPath"
>
<div class="logo">
<img :src="imgUrl" alt="oj admin" />
</div>
<el-tooltip
:content="$t('m.Click_To_Change_Web_Language')"
placement="bottom"
effect="dark"
>
<div class="logo" @click="changeWebLanguage(webLanguage == 'zh-CN' ? 'en-US' : 'zh-CN')">
<img :src="imgUrl" alt="Online Judge Admin" />
</div>
</el-tooltip>
<el-menu-item index="/admin/">
<i class="fa fa-tachometer fa-size" aria-hidden="true"></i
>{{ $t('m.Dashboard') }}
Expand Down Expand Up @@ -491,7 +497,7 @@
>{{ websiteConfig.projectName }}</a
>
<span style="margin-left:10px">
<el-dropdown @command="changeLanguage" placement="top">
<el-dropdown @command="changeWebLanguage" placement="top">
<span class="el-dropdown-link" style="font-size:14px">
<i class="fa fa-globe" aria-hidden="true">
{{ this.webLanguage == 'zh-CN' ? '简体中文' : 'English' }}</i
Expand Down Expand Up @@ -566,7 +572,7 @@ export default {
let matched = this.$route.matched.filter((item) => item.meta.title); //获取路由信息,并过滤保留路由标题信息存入数组
this.routeList = matched;
},
changeLanguage(language) {
changeWebLanguage(language) {
this.$store.commit('changeWebLanguage', { language: language });
},
},
Expand Down Expand Up @@ -609,6 +615,7 @@ export default {
.vertical_menu .logo {
margin: 20px 0;
text-align: center;
cursor: pointer;
}
.vertical_menu .logo img {
background-color: #fff;
Expand Down

0 comments on commit a63533f

Please sign in to comment.