Commit f35559d4 by 林家欣

fix: 修改中英文切换后当前语言显示问题

parent 976eed23
...@@ -7,6 +7,10 @@ ...@@ -7,6 +7,10 @@
<span class="el-dropdown-link"> <span class="el-dropdown-link">
{{ languageTxt }}<i class="el-icon-arrow-down el-icon--right"></i> {{ languageTxt }}<i class="el-icon-arrow-down el-icon--right"></i>
</span> </span>
<!-- <select name="" id="">
<option value="中文">中文</option>
<option value="英文">英文</option>
</select> -->
<el-dropdown-menu slot="dropdown" class="language-dropdown-menu"> <el-dropdown-menu slot="dropdown" class="language-dropdown-menu">
<el-dropdown-item command="中文">中文</el-dropdown-item> <el-dropdown-item command="中文">中文</el-dropdown-item>
<el-dropdown-item command="英文">英文</el-dropdown-item> <el-dropdown-item command="英文">英文</el-dropdown-item>
...@@ -15,56 +19,97 @@ ...@@ -15,56 +19,97 @@
</div> </div>
<div class="top-banner-item tb-hover">咨询电话:400-7000-690</div> <div class="top-banner-item tb-hover">咨询电话:400-7000-690</div>
<div class="top-banner-item"> <div class="top-banner-item">
<img src="../../assets/image/head/wx.png" alt=""/> <img src="../../assets/image/head/wx.png" alt="" />
<a class="tb-hover" target="_blank" :href="`${urls.ancc}gs1cnweixin.aspx`">官方微信</a> <a
class="tb-hover"
target="_blank"
:href="`${urls.ancc}gs1cnweixin.aspx`"
>官方微信</a
>
</div> </div>
<div class="top-banner-item"> <div class="top-banner-item">
<img src="../../assets/image/head/xlwb.png" alt=""/> <img src="../../assets/image/head/xlwb.png" alt="" />
<a class="tb-hover" target="_blank" href="https://weibo.com/gs1cn">官方微博</a> <a class="tb-hover" target="_blank" href="https://weibo.com/gs1cn"
>官方微博</a
>
</div> </div>
<div class="top-banner-item tb-hover" @click="handleSearch"> <div class="top-banner-item tb-hover" @click="handleSearch">
<img src="../../assets/image/head/search.png" alt=""/> <img src="../../assets/image/head/search.png" alt="" />
</div> </div>
<div @click="toAdmin" style="color: #00799e;display:flex;align-items: center;cursor: pointer;margin-left: 14px" v-if="user.username"> <div
<img style="width:22px;" @click="toAdmin"
src="../../assets/image/mymanage/pic_touxiang.png" alt=""> style="
<!-- <span style="">个人中心:</span>--> color: #00799e;
<span class="gs-hover" style="margin-left: 4px;font-weight: bold">{{ user.username }}</span> display: flex;
align-items: center;
cursor: pointer;
margin-left: 14px;
"
v-if="user.username"
>
<img
style="width: 22px"
src="../../assets/image/mymanage/pic_touxiang.png"
alt=""
/>
<!-- <span style="">个人中心:</span>-->
<span class="gs-hover" style="margin-left: 4px; font-weight: bold">{{
user.username
}}</span>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import {mapState} from "vuex"; import { mapState } from "vuex";
export default { export default {
name: "topBanner", name: "topBanner",
computed: { computed: {
...mapState(["urls"]), ...mapState(["urls"]),
}, },
watch: {
$route: {
handler(val) {
const currentRouterComp = val.matched[val.matched.length-1].components.default.__file;
if (currentRouterComp.indexOf('English') !== -1) {
this.languageTxt = '英文';
} else {
this.languageTxt = '中文';
}
},
immediate: true,
},
},
created() { created() {
this.user = localStorage.getItem('loginInfo') ? JSON.parse(localStorage.getItem('loginInfo')) : {} this.user = localStorage.getItem("loginInfo")
console.log(this.user) ? JSON.parse(localStorage.getItem("loginInfo"))
: {};
console.log(this.user);
}, },
data() { data() {
return { return {
user: {}, user: {},
languageTxt: '中文' languageTxt: "中文",
} };
}, },
methods: { methods: {
toAdmin() { toAdmin() {
if ((this.user.userType === 1 && this.user.isXT !== 1) || (this.user.userType === 2 && this.user.isXT !== 1) || (this.user.userType === 3 && this.user.levels === null)) { if (
this.$router.push({path: '/MyManage/UnVerify/index'}) (this.user.userType === 1 && this.user.isXT !== 1) ||
(this.user.userType === 2 && this.user.isXT !== 1) ||
(this.user.userType === 3 && this.user.levels === null)
) {
this.$router.push({ path: "/MyManage/UnVerify/index" });
} else if (this.user.isXT === 1) { } else if (this.user.isXT === 1) {
this.$router.push({path: '/MyManage/SystemMember/index'}) this.$router.push({ path: "/MyManage/SystemMember/index" });
} else if (this.user.levels === 0) { } else if (this.user.levels === 0) {
this.$router.push({path: '/MyManage/admin/check'}) this.$router.push({ path: "/MyManage/admin/check" });
} else if (this.user.levels === 1) { } else if (this.user.levels === 1) {
this.$router.push({path: '/MyManage/admin/check'}) this.$router.push({ path: "/MyManage/admin/check" });
} else if (String(this.user.levels).length === 4) { } else if (String(this.user.levels).length === 4) {
this.$router.push({path: '/MyManage/admin/check'}) this.$router.push({ path: "/MyManage/admin/check" });
} }
}, },
handleSearch() { handleSearch() {
...@@ -73,8 +118,9 @@ export default { ...@@ -73,8 +118,9 @@ export default {
}); });
}, },
handleClick(val) { handleClick(val) {
this.languageTxt = val console.log(val, "val");
if (val == '中文') { this.languageTxt = val;
if (val == "中文") {
this.$router.push({ this.$router.push({
path: "/Home", path: "/Home",
}); });
...@@ -83,7 +129,7 @@ export default { ...@@ -83,7 +129,7 @@ export default {
path: "/EnglishHome", path: "/EnglishHome",
}); });
} }
} },
}, },
}; };
</script> </script>
......
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 to comment