李凌
2025-10-15 7fc6bfe900790ec7c92bce85d5b20a95fbc06e65
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<template>
    <van-nav-bar :left-arrow="false" class="head">
        <template #left>
            <img src="@/assets/imgs/home/user_img.png" class="user_img" alt="" @click="onRoute('/my')" v-if="userStore.userInfo && userStore.userInfo.token">
            <div class="textColor2 bzzx" @click="onRoute('/helpCenter')">
                <van-icon name="search" class="textColor mr-2" />
                {{ $t("帮助中心") }}
            </div>
        </template>
        <template #right>
            <img src="@/assets/imgs/home/yl.png" alt="" v-if="store.state.vant.theme == 'light'"
                @click="store.commit('vant/SET_THEME', 'dark')" class="mr-5 r_img">
            <img src="@/assets/imgs/home/ty.png" alt="" v-else @click="store.commit('vant/SET_THEME', 'light')"
                class="mr-5 r_img">
            <img :src="languageObj.image" alt="" class="gq" @click="onRoute('/language')">
            <van-icon name="service-o" class="textColor ml-5" @click="onRoute('/customerService')" />
        </template>
    </van-nav-bar>
</template>
 
<script setup>
import { useRouter } from 'vue-router';
import { useI18n } from "vue-i18n";
import { lang } from "@/config";
import { useLanguageStore } from '@/store/language.store'
import { ref } from 'vue';
import store from '@/store/store'
import { useUserStore } from '@/store/user';
 
const { t } = useI18n()
const router = useRouter()
const userStore = useUserStore()
 
// 语言切换
const languageStore = useLanguageStore()
const languageObj = lang.find(i => i.key == languageStore.language)
 
// 获取客服链接
const customer_service_url = ref(store.state.user.customer_service_url)
 
const onRoute = (path) => {
    if (path == '/customerService') {
        if (customer_service_url.value) {
            window.location.href = customer_service_url.value;
        } else {
            router.push(path)
        }
    } else {
        router.push(path)
    }
}
</script>
 
 
<style lang="scss" scoped>
.head {
    @include themify() {
        border-bottom: themed("divi_line") 1px solid;
    }
}
 
.r_img {
    width: 2.2rem;
}
 
.user_img {
    width: 3rem;
    margin-right: 1rem;
}
 
.bzzx {
    padding: 0 10rem 0 1rem;
    border-radius: 3rem;
    @include themify() {
        border: themed("input_border") 1px solid;
    }
}
 
.gq {
    height: 2rem;
}
</style>