Commit 2a11f561 by zhanghui1

语言选择

parent df51965b
<template> <template>
<div id="app" :class="gradeClass"> <div id="app" :class="gradeClass">
<transition :name="'vux-pop-' + (direction === '' ? '' : (direction === 'forward' ? 'in' : 'out'))"> <transition :name="'vux-pop-' + (direction === '' ? '' : (direction === 'forward' ? 'in' : 'out'))">
<!-- <mr-navigation> <!-- <mr-navigation></mr-navigation>是否开启缓存 -->
</mr-navigation> -->
<router-view></router-view> <router-view></router-view>
</transition> </transition>
</div> </div>
......
...@@ -6,37 +6,18 @@ ...@@ -6,37 +6,18 @@
</div> </div>
<div class="page-content top"> <div class="page-content top">
<div class="language-content"> <div class="language-content">
<div class="language-item" @click="toggleClass(0)" :class="index==0?'active':''"> <!-- <div class="language-item" @click="toggleClass('auto')" :class="language=='auto'?'active':''">
<div class="language-title"> <div class="language-title">自动</div>
自动 <div :class="language=='auto'?'language-selected':''"> </div>
</div> </div> -->
<div :class="index==0?'language-selected':''"> <div class="language-item" @click="toggleClass('zh-cn')" :class="language=='zh-cn'?'active':''">
<div class="language-title">中文 <span class="language-img zh-cn"></span></div>
</div> <div :class="language=='zh-cn'?'language-selected':''"></div>
</div>
<div class="language-item" @click="toggleClass(1)" :class="index==1?'active':''">
<div class="language-title">
中文
<span class="language-img zh-cn">
</span>
</div>
<div :class="index==1?'language-selected':''">
</div>
</div>
<div class="language-item" @click="toggleClass(2)" :class="index==2?'active':''">
<div class="language-title">
英文
<span class="language-img en">
</span>
<!--<img src="../../assets/img/en.png" alt="">-->
</div>
<div :class="index==2?'language-selected':''">
</div>
</div> </div>
<!-- <div class="language-item" @click="toggleClass('en')" :class="language=='en'?'active':''">
<div class="language-title">英文 <span class="language-img en"></span></div>
<div :class="language=='en'?'language-selected':''"></div>
</div> -->
</div> </div>
</div> </div>
</div> </div>
...@@ -46,7 +27,11 @@ export default { ...@@ -46,7 +27,11 @@ export default {
name: 'language', name: 'language',
data() { data() {
return { return {
index: 0 }
},
computed: {
language: function() {
return this.$store.state.language
} }
}, },
mounted() { mounted() {
...@@ -56,8 +41,18 @@ export default { ...@@ -56,8 +41,18 @@ export default {
goBack() { goBack() {
this.$router.go(-1) this.$router.go(-1)
}, },
toggleClass(n){ toggleClass(language) {
this.index = n; switch (language) {
case 'auto':
this.$store.commit('setLanguage', this.$store.state.language)
break;
case 'zh-cn':
this.$store.commit('setLanguage', 'zh-cn')
break;
case 'en':
this.$store.commit('setLanguage', 'en')
break;
}
} }
} }
} }
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
<span class="fore-link-text">矿工必看</span> <span class="fore-link-text">矿工必看</span>
</mt-cell> </mt-cell>
<mt-cell title="语言设置" is-link to="/language"> <mt-cell title="语言设置" is-link to="/language">
<span class="language-img zh-cn"></span> <span class="language-img" :class="language"></span>
</mt-cell> </mt-cell>
</div> </div>
</div> </div>
...@@ -72,6 +72,9 @@ export default { ...@@ -72,6 +72,9 @@ export default {
}, },
region_id() { region_id() {
return this.$store.state.region_id || localStorage.getItem('region_id'); return this.$store.state.region_id || localStorage.getItem('region_id');
},
language() {
return this.$store.state.language || localStorage.getItem('language');
} }
}, },
mounted() { mounted() {
......
...@@ -48,7 +48,7 @@ axios.interceptors.request.use(config => { ...@@ -48,7 +48,7 @@ axios.interceptors.request.use(config => {
function checkToken() { function checkToken() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
resolve('eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IlEwTTBNRUl4UVRVME5qazJNa0ZFT0RCRk56WkJNVGc0TmtFd09UWkNOakZGTlRFMFEwVTJOdyJ9.eyJpc3MiOiJodHRwczovL2Jsb2NraW4uYXV0aDAuY29tLyIsInN1YiI6ImF1dGgwfDVhMzM4MWE2ZjczMzNjNjdkMzMxOWZiYyIsImF1ZCI6WyJodHRwczovL3d3dy5wb29saW4uY29tL2FwaSIsImh0dHBzOi8vYmxvY2tpbi5hdXRoMC5jb20vdXNlcmluZm8iXSwiaWF0IjoxNTE3MzAwNDc1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QDOlPxgNJVkcRaMo0t-M6OZUQpSoZe980OY4ugkqgpmaqzB07UT1HC7gFxZIF2Csf8FZcGylyYkryTPLaUvIMKSH7QIUnYChSKxaP2r-FAUu5C_ThTcjme8KhswQNwIowrcy82gwULlvN0ldUb4UlilwDSXPUlUkDC3LY7SXpiyfxbKrKejjJmDgvl2FSKiFjTbzvA7XIhCu8HuIXg');
}) })
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment