Commit f35559d4 by 林家欣

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

parent 976eed23
......@@ -7,6 +7,10 @@
<span class="el-dropdown-link">
{{ languageTxt }}<i class="el-icon-arrow-down el-icon--right"></i>
</span>
<!-- <select name="" id="">
<option value="中文">中文</option>
<option value="英文">英文</option>
</select> -->
<el-dropdown-menu slot="dropdown" class="language-dropdown-menu">
<el-dropdown-item command="中文">中文</el-dropdown-item>
<el-dropdown-item command="英文">英文</el-dropdown-item>
......@@ -15,56 +19,97 @@
</div>
<div class="top-banner-item tb-hover">咨询电话:400-7000-690</div>
<div class="top-banner-item">
<img src="../../assets/image/head/wx.png" alt=""/>
<a class="tb-hover" target="_blank" :href="`${urls.ancc}gs1cnweixin.aspx`">官方微信</a>
<img src="../../assets/image/head/wx.png" alt="" />
<a
class="tb-hover"
target="_blank"
:href="`${urls.ancc}gs1cnweixin.aspx`"
>官方微信</a
>
</div>
<div class="top-banner-item">
<img src="../../assets/image/head/xlwb.png" alt=""/>
<a class="tb-hover" target="_blank" href="https://weibo.com/gs1cn">官方微博</a>
<img src="../../assets/image/head/xlwb.png" alt="" />
<a class="tb-hover" target="_blank" href="https://weibo.com/gs1cn"
>官方微博</a
>
</div>
<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 @click="toAdmin" style="color: #00799e;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
@click="toAdmin"
style="
color: #00799e;
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>
</template>
<script>
import {mapState} from "vuex";
import { mapState } from "vuex";
export default {
name: "topBanner",
computed: {
...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() {
this.user = localStorage.getItem('loginInfo') ? JSON.parse(localStorage.getItem('loginInfo')) : {}
console.log(this.user)
this.user = localStorage.getItem("loginInfo")
? JSON.parse(localStorage.getItem("loginInfo"))
: {};
console.log(this.user);
},
data() {
return {
user: {},
languageTxt: '中文'
}
languageTxt: "中文",
};
},
methods: {
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)) {
this.$router.push({path: '/MyManage/UnVerify/index'})
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)
) {
this.$router.push({ path: "/MyManage/UnVerify/index" });
} 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) {
this.$router.push({path: '/MyManage/admin/check'})
this.$router.push({ path: "/MyManage/admin/check" });
} 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) {
this.$router.push({path: '/MyManage/admin/check'})
this.$router.push({ path: "/MyManage/admin/check" });
}
},
handleSearch() {
......@@ -73,8 +118,9 @@ export default {
});
},
handleClick(val) {
this.languageTxt = val
if (val == '中文') {
console.log(val, "val");
this.languageTxt = val;
if (val == "中文") {
this.$router.push({
path: "/Home",
});
......@@ -83,7 +129,7 @@ export default {
path: "/EnglishHome",
});
}
}
},
},
};
</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