From 65a34c2a476f8305579582b402445a640f531a65 Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期二, 11 三月 2025 16:17:16 +0800 Subject: [PATCH] 3333233332 --- src/components/AppHeader.vue | 40 +++++++++++++++++++++++++++++----------- 1 files changed, 29 insertions(+), 11 deletions(-) diff --git a/src/components/AppHeader.vue b/src/components/AppHeader.vue index 8966bdf..74f36e6 100644 --- a/src/components/AppHeader.vue +++ b/src/components/AppHeader.vue @@ -16,32 +16,32 @@ <el-menu-item index="/home" class="!px-4">棣栭〉</el-menu-item> <el-menu-item index="/certified-products" class="!px-4">鑳芥晥浜у搧</el-menu-item> <el-menu-item index="/eec-label-search" class="!px-4">璇佷功鏌ヨ</el-menu-item> - <el-menu-item index="/news-detail/99" class="!px-4">琛ヨ创鏀跨瓥</el-menu-item> - <el-menu-item index="/select-selpara" class="!px-4" @click="linkClick">鏌ユ车缃�</el-menu-item> + <el-menu-item index="/news-detail/99" class="!px-4">鏀跨瓥鏂囦欢</el-menu-item> + <el-menu-item index="/select-selpara" class="!px-4" @click="linkClick">娉甸�夊瀷</el-menu-item> </el-menu> </nav> <!-- Search and User Actions --> <div class="flex items-center space-x-8 ml-[65px]"> - <el-input v-model="searchQuery" placeholder="鏌ヨ瘉涔�" class="w-48"> + <el-input v-model="searchQuery" placeholder="鏌ヨ瘉涔�" class="w-48" v-if="false"> <template #suffix> <el-icon class="cursor-pointer" @click="handleSearch"><Search /></el-icon> </template> </el-input> <!-- Add shopping cart icon here --> - <div class="flex items-center gap-4"> + <div class="flex items-center gap-4" @click="goToCart"> <el-badge :value="cartCount" :max="99" class="cart-badge"> - <el-button class="flex items-center" link @click="goToCart"> - <el-icon class="text-xl"><ShoppingCart /></el-icon> + <el-button class="flex items-center" link> + <el-icon class="text-lg" style="font-size: 20px;"><ShoppingCart /></el-icon> </el-button> </el-badge> </div> <div class="flex items-center text-gray-600 text-sm text-nowrap"> - <template v-if="!userInfo"> - <a href="#" class="hover:text-blue-500">娉ㄥ唽</a> - <span class="mx-2">路</span> + <template v-if="!userInfo.Token"> + <!-- <a href="#" class="hover:text-blue-500">娉ㄥ唽</a> + <span class="mx-2">路</span> --> <a @click="toLogin" class="hover:text-blue-500">鐧诲綍</a> </template> <template v-else> @@ -103,14 +103,32 @@ }; const linkClick = () => { - router.push('/select-selpara'); + if (userInfo.value.Token) { + router.push('/select-selpara'); + } else { + loginStore.logOut(); + router.replace({ + path: '/login', + query: { redirectPath: route.fullPath }, + }); + } }; // 浠� Pinia store 鑾峰彇璐墿杞︽暟閲� const cartCount = computed(() => cartStore.cartItemCount); const goToCart = () => { - router.push('/cart'); + if (userInfo.value.Token) { + router.push('/cart'); + } else { + loginStore.logOut(); + router.replace({ + path: '/login', + query: { redirectPath: route.fullPath }, + }); + return + } + }; </script> -- Gitblit v1.9.3