From 9a9d832dbd364557e070abcd9a7779a2c6c07ffb Mon Sep 17 00:00:00 2001
From: 李凌 <344137771@qq.com>
Date: Tue, 20 Jan 2026 17:35:13 +0800
Subject: [PATCH] 1
---
src/views/homePage/components/head.vue | 97 +++++++++++++++++++++++++++++-------------------
1 files changed, 58 insertions(+), 39 deletions(-)
diff --git a/src/views/homePage/components/head.vue b/src/views/homePage/components/head.vue
index ca5361e..c6b7bd9 100644
--- a/src/views/homePage/components/head.vue
+++ b/src/views/homePage/components/head.vue
@@ -1,63 +1,82 @@
<template>
- <div class="head flex justify-between items-center pl-5 pr-5">
- <div class="more mr-5"><img src="@/assets/imgs/home/more.png" alt="" @click="onRoute('/my')"></div>
- <div class="more_input pl-5 pr-5 flex items-center justify-start mr-5 pt-2" @click="onRoute('/optional/search')">
- <img src="@/assets/imgs/quotes/search.png" alt="">
- <span class="pl-5">{{ $t('请输入关键词搜寻') }}</span>
- </div>
- <div class="scan"><img src="@/assets/image/assets-center/language.png" alt="" @click="onRoute('/language')"></div>
- <!-- <div class="gift"><img src="@/assets/imgs/home/gift.png" alt=""></div>
- <div class="scan"><img src="@/assets/imgs/home/scan.png" alt=""></div>
- <div class="instruction"><img src="@/assets/imgs/home/instruction.png" alt=""></div> -->
- </div>
+ <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) => {
- router.push(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 {
- width: 100%;
- $inp-bg: #F7F7F7;
- $inp-c: #999;
- margin-bottom: 1rem;
-
- .more,
- .gift,
- .scan,
- .instruction {
- width: 3.2rem;
+ @include themify() {
+ border-bottom: themed("divi_line") 1px solid;
}
+}
- .more_input {
- // width: 26rem;
- width: 100%;
- height: 4.5rem;
- background: $inp-bg;
- border-radius: 2.25rem;
- color: $inp-c;
- font-size: 1.5rem;
+.r_img {
+ width: 2.2rem;
+}
- span {
- text-overflow: ellipsis;
- overflow: hidden;
- word-break: break-all;
- white-space: nowrap;
- }
+.user_img {
+ width: 3rem;
+ margin-right: 1rem;
+}
- img {
- width: 2.5rem;
- }
+.bzzx {
+ padding: 0 10rem 0 1rem;
+ border-radius: 3rem;
+ @include themify() {
+ border: themed("input_border") 1px solid;
}
}
+
+.gq {
+ height: 2rem;
+}
</style>
\ No newline at end of file
--
Gitblit v1.9.3