From fe1c5cff00014a46dec56705de3426037839c261 Mon Sep 17 00:00:00 2001 From: tj <1378534974@qq.com> Date: 星期三, 07 五月 2025 16:09:54 +0800 Subject: [PATCH] home css update --- src/pages/Product.vue | 62 +++++++++++++++++++++++++++--- 1 files changed, 55 insertions(+), 7 deletions(-) diff --git a/src/pages/Product.vue b/src/pages/Product.vue index 19157c6..3252604 100644 --- a/src/pages/Product.vue +++ b/src/pages/Product.vue @@ -34,7 +34,7 @@ </div> - <div class="col-md-3 d-block d-md-none p-3" > + <div class="col-md-3 d-block d-md-none p-3"> <el-drawer v-model="drawerVisible" title="所有产品" direction="ltr" size="250px"> <el-menu :default-active="activeIndex" class="border-0" @select="handleSelect" @open="handleOpen" @close="handleClose"> @@ -70,7 +70,7 @@ <!-- Main Content Area --> - <div class="col-12 col-md-9 p-3" style="overflow-y: auto; max-height: 100vh;" > + <div class="col-12 col-md-9 p-3" style="overflow-y: auto; max-height: 100vh;"> <!-- Upper Layer --> <div class="mb-3"> <div class="border-b border-gray-200 p-1 text-center "> @@ -137,7 +137,7 @@ </div> <div class="row d-block d-md-none"> - <div class="justify-content-center" > + <div class="justify-content-center"> <div class="col-12 col-sm-6 col-md-4 mb-4 justify-content-center" v-for="(product, index) in products" :key="index"> <div class="card "> @@ -165,14 +165,15 @@ <!-- <button class="btn btn-primary rounded-circle floating-btn" @click="handleClick"> <i class="bi bi-list fs-3 floating-btn"></i> </button> --> - <img :src="menuIcon" alt="icon" - style="width: 30px; height: 30px;" class="floating-btn d-block d-md-none" @click="handleClick" /> + <img :src="menuIcon" alt="icon" style="width: 30px; height: 30px;" class="floating-btn d-block d-md-none" + @click="handleClick" /> - + </div> </template> <script lang="ts" setup> -import { ref } from 'vue' +import { ref, onMounted } from 'vue' +import { useRoute, useRouter } from 'vue-router'; import { MenuItem, Products, ProductCenter } from '@/models/portalModels'; import PdfViewer from '@/components/pdf/PdfViewer.vue' @@ -187,6 +188,8 @@ const title = ref('') const pdfUrl = ref('') const curSubItem = ref<MenuItem>({} as MenuItem) + + const activeIndex = ref('') @@ -255,6 +258,48 @@ ], }, ]; + + +onMounted(() => { + const route = useRoute(); + const title = route.query.title; + + if (!title) return; + + let foundIndex = ''; + let foundItem = null; + + for (const item of menuItems) { + if (item.title === title) { + foundIndex = item.index; + foundItem = item; + break; + } + + if (item.subMenu) { + const sub = item.subMenu.find(subItem => subItem.title === title); + if (sub) { + foundIndex = sub.index; + foundItem = sub; + break; + } + } + } + + if (foundIndex && foundItem) { + activeIndex.value = foundIndex; + + // 调用菜单选中逻辑(注意:这里你可能要加上菜单展开逻辑) + if (foundIndex.includes('-')) { + handleSelectSubmenu(foundItem); // 子菜单点击 + } else { + handleSelect(foundIndex); // 顶层菜单点击(如果你需要) + } + } +}); + + + const products = ref<Products[]>([ { imgUrl: 'https://portal2.tos-cn-beijing.volces.com/portal/product-our/外部供应商管理系统.png', title: '外部供应商管理系统', desc: '通过数字化整合上下游资源<br/>打通多级分销信息壁垒,助力供应商增效增收。' }, @@ -326,6 +371,9 @@ </script> <style> +body { + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; +} /* .el-menu .el-menu-item.is-active { font-weight: bold; color: #ffd04b; -- Gitblit v1.9.3