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 547087f commit 66ccdc4
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 10 deletions.
4 changes: 2 additions & 2 deletions hoj-vue/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,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">
<i class="fa fa-globe" aria-hidden="true">
{{ this.webLanguage == 'zh-CN' ? '简体中文' : 'English' }}</i
Expand Down Expand Up @@ -127,7 +127,7 @@ export default {
return str.toUpperCase();
}
},
changeLanguage(language) {
changeWebLanguage(language) {
this.$store.commit('changeWebLanguage', { language: language });
},
},
Expand Down
35 changes: 27 additions & 8 deletions hoj-vue/src/components/oj/common/NavBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,18 @@
text-color="#495060"
>
<div class="logo">
<el-image
style="width: 139px; height: 50px"
:src="imgUrl"
fit="scale-down"
></el-image>
<el-tooltip
:content="$t('m.Click_To_Change_Web_Language')"
placement="bottom"
effect="dark"
>
<el-image
style="width: 139px; height: 50px"
:src="imgUrl"
fit="scale-down"
@click="changeWebLanguage"
></el-image>
</el-tooltip>
</div>
<el-menu-item index="/home"
><i class="el-icon-s-home"></i>{{ $t('m.NavBar_Home') }}</el-menu-item
Expand Down Expand Up @@ -188,9 +195,17 @@
<mu-button icon slot="left" @click="opendrawer = !opendrawer">
<i class="el-icon-s-unfold"></i>
</mu-button>
{{
websiteConfig.shortName ? websiteConfig.shortName.toUpperCase() : 'OJ'
}}
<el-tooltip
:content="$t('m.Click_To_Change_Web_Language')"
placement="bottom"
effect="dark"
>
<span @click="changeWebLanguage">
{{
websiteConfig.shortName ? websiteConfig.shortName.toUpperCase() : 'OJ'
}}
</span>
</el-tooltip>
<mu-button
flat
slot="right"
Expand Down Expand Up @@ -658,6 +673,9 @@ export default {
}
});
},
changeWebLanguage() {
this.$store.commit('changeWebLanguage', { language: this.webLanguage == 'zh-CN' ? 'en-US' : 'zh-CN' });
},
},
computed: {
...mapGetters([
Expand Down Expand Up @@ -752,6 +770,7 @@ export default {
}
.logo {
cursor: pointer;
margin-left: 2%;
margin-right: 2%;
float: left;
Expand Down

0 comments on commit 66ccdc4

Please sign in to comment.