| | |
| | | <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" @click="goToCart"> |
| | | <el-badge :value="cartCount" :max="99" class="cart-badge"> |
| | | <el-button class="flex items-center" link > |
| | | <el-icon class="text-xl"><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> |
| | |
| | | |
| | | <script setup lang="ts"> |
| | | import headerLogo from '@/assets/logo/header_logo.png'; |
| | | import { Search } from '@element-plus/icons-vue'; |
| | | import { Search, ShoppingCart } from '@element-plus/icons-vue'; |
| | | import { ElMessage } from 'element-plus'; |
| | | import { computed, ref } from 'vue'; |
| | | import { computed, ref, watch } from 'vue'; |
| | | import { useRoute, useRouter } from 'vue-router'; |
| | | import { useLogin } from '@/stores/useLogin'; |
| | | import { useCartStore } from '@/stores/useCartStore'; |
| | | |
| | | const loginStore = useLogin(); |
| | | const cartStore = useCartStore(); |
| | | |
| | | const route = useRoute(); |
| | | const router = useRouter(); |
| | |
| | | const linkClick = () => { |
| | | router.push('/select-selpara'); |
| | | }; |
| | | |
| | | // 从 Pinia store 获取购物车数量 |
| | | const cartCount = computed(() => cartStore.cartItemCount); |
| | | |
| | | const goToCart = () => { |
| | | router.push('/cart'); |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped> |
| | |
| | | :deep(.el-menu--horizontal) { |
| | | border-bottom: none; |
| | | } |
| | | |
| | | .cart-badge :deep(.el-badge__content) { |
| | | animation: cartBadgeAnimation 0.3s cubic-bezier(0.4, 0, 0.2, 1); |
| | | } |
| | | |
| | | @keyframes cartBadgeAnimation { |
| | | 0% { |
| | | transform: scale(0); |
| | | opacity: 0; |
| | | } |
| | | 50% { |
| | | transform: scale(1.2); |
| | | } |
| | | 100% { |
| | | transform: scale(1); |
| | | opacity: 1; |
| | | } |
| | | } |
| | | </style> |