From 49a435043b0b1a289a24606e35253365d7ab3956 Mon Sep 17 00:00:00 2001
From: QYF-GitLab1 <1940665526@qq.com>
Date: 星期一, 25 八月 2025 17:51:57 +0800
Subject: [PATCH] 首页、及教学出版样式修改

---
 src/layout/components/headerPage.vue |  200 ++++++++++++++++++++++++++++++--------------------
 1 files changed, 120 insertions(+), 80 deletions(-)

diff --git a/src/layout/components/headerPage.vue b/src/layout/components/headerPage.vue
index 9aa7fcd..1bb0e03 100644
--- a/src/layout/components/headerPage.vue
+++ b/src/layout/components/headerPage.vue
@@ -2,37 +2,30 @@
   <div class="pageHeader">
     <div class="contentBox logoBox">
       <div class="logo">
-        <img
-          @click="
-            () => {
-              $router.push({
-                path: '/home',
-              });
-            }
-          "
-          src="@/assets/images/xiehe/home/Group_303.png"
-        />
+        <img @click="
+          () => {
+            $router.push({
+              path: '/home',
+            })
+          }
+        " src="@/assets/images/xiehe/home/logo.png" />
       </div>
       <div class="searchBox" v-show="!hideSerch">
-        <el-input
-          style="width: 500px; height: 50px"
-          placeholder="璇疯緭鍏ュ唴瀹�"
-          @change="gotoSearch"
-          v-model="searchKey"
-          :suffix-icon="Search"
-        >
+        <el-input style="width: 500px; height: 36px" placeholder="璇疯緭鍏ュ叧閿瘝/涔﹀悕/ISBN/浣滆��" v-model="searchKey" :suffix-icon="Search"
+          @keyup.enter="gotoSearch">
         </el-input>
         <div class="loginInfoBox">
-          <div v-if="!userInfo" class="loginBtnBox">
-            <a
-              @click="
-                () => {
-                  console.log(loginRef.value);
-                  loginRef.logIn();
-                }
-              "
-              >娉ㄥ唽/鐧诲綍</a
-            >
+          <div v-if="!userInfo" class="loginBtnBox" style="width: 200px">
+            <div class="loginBtn" @click="
+              () => {
+                loginRef.logIn()
+              }
+            ">
+              <el-icon style="margin-right: 5px;">
+                <UserFilled />
+              </el-icon>
+              娉ㄥ唽 / 鐧诲綍
+            </div>
           </div>
           <div v-else class="userInfoBox">
             <el-dropdown @command="handleCommand">
@@ -44,12 +37,8 @@
               </span>
               <template #dropdown>
                 <el-dropdown-menu>
-                  <el-dropdown-item icon="el-icon-user" command="gotoPersonalCenter"
-                    >涓汉涓績</el-dropdown-item
-                  >
-                  <el-dropdown-item icon="el-icon-switch-button" command="logout"
-                    >閫�鍑虹櫥褰�</el-dropdown-item
-                  >
+                  <el-dropdown-item :icon="Avatar" command="gotoPersonalCenter">涓汉涓績</el-dropdown-item>
+                  <el-dropdown-item :icon="SwitchButton" command="logout">閫�鍑虹櫥褰�</el-dropdown-item>
                 </el-dropdown-menu>
               </template>
             </el-dropdown>
@@ -59,15 +48,11 @@
     </div>
     <login ref="loginRef"></login>
     <div class="contentBox navBox" v-show="!hideNav">
-      <div
-        :class="{
-          navItem: true,
-          active: $route.fullPath.indexOf(item.path) > -1,
-        }"
-        v-for="(item, index) in navData"
-        :key="index"
-        @click="gotoPage(item)"
-      >
+      <div :class="{
+        navItem: true,
+        // active: $route.fullPath.indexOf(item.path) > -1,
+        active: item.pathList.findIndex((citem) => citem == $route.path) > -1,
+      }" v-for="(item, index) in navData" :key="index" @click="gotoPage(item)">
         {{ item.name }}
       </div>
     </div>
@@ -75,15 +60,18 @@
 </template>
 
 <script setup lang="ts">
-import login from "./login.vue";
-import { onMounted, ref } from "vue";
-import { Search } from "@element-plus/icons-vue";
-import { useUserStore } from "@/store";
-import { useRouter } from "vue-router";
-const userStore = useUserStore();
-const router = useRouter();
+import login from './login.vue'
+import { onMounted, provide, ref } from 'vue'
+import { Search, Avatar, SwitchButton } from '@element-plus/icons-vue'
+import { useUserStore } from '@/store'
+import { useRouter, useRoute } from 'vue-router'
+import { ElMessage } from 'element-plus'
 
-const loginRef = ref();
+const userStore = useUserStore()
+const router = useRouter()
+const route = useRoute()
+
+const loginRef = ref()
 const props = defineProps({
   hideSerch: {
     type: Boolean,
@@ -93,63 +81,85 @@
     type: Boolean,
     default: false,
   },
-});
+})
 
-let searchKey = ref("");
-let userInfo = ref("");
+let searchKey = ref('')
+let userInfo = ref('')
 const navData = ref([
   {
-    name: "棣栭〉",
-    path: "/home",
+    name: '棣栭〉',
+    path: '/home',
+    pathList: ['/home', '/search'],
   },
   {
-    name: "鏁欒偛鍑虹増",
-    path: "/bookStore",
+    name: '鏁欒偛鍑虹増',
+    path: '/bookStore',
+    pathList: ['/bookStore', '/bookdetail'],
   },
   {
-    name: "璇昏�呮湇鍔�",
-    path: "/teachingServices",
+    name: '璇昏�呮湇鍔�',
+    path: '/teachingServices',
+    pathList: ['/teachingServices'],
   },
   {
-    name: "鍏充簬鎴戜滑",
-    path: "/aboutUs",
+    name: '鍏充簬鎴戜滑',
+    path: '/aboutUs',
+    pathList: ['/aboutUs'],
   },
-]);
+])
 
 onMounted(() => {
-  userInfo.value = userStore.userInfo;
-  console.log(userInfo.value, "userInfo");
-});
+  userInfo.value = userStore.userInfo
+  console.log(userInfo.value, 'userInfo')
+  console.log(route, 'route')
+})
 
-const gotoSearch = () => {};
+const gotoSearch = () => {
+  router.push({
+    path: '/search',
+    query: {
+      key: searchKey.value,
+    },
+  })
+}
 const handleCommand = (item) => {
-  if (item === "gotoPersonalCenter") {
+  if (item === 'gotoPersonalCenter') {
     router.push({
-      path: "/personalCenter",
-    });
+      path: '/personalCenter',
+    })
   }
-  if (item === "logout") {
-    localStorage.clear();
+  if (item === 'logout') {
+    localStorage.clear()
+    userStore.delteUserInfo()
+    userInfo.value = null
     router.push({
-      path: "/home",
-    });
+      path: '/home',
+    })
   }
-};
+}
 const gotoPage = (item) => {
-  router.push(item.path);
-};
+  if (item.path === '/teachingServices') {
+    ElMessage({
+      message: '寤鸿涓�...',
+      type: 'warning',
+    })
+  } else {
+    router.push(item.path)
+  }
+}
 </script>
 
 <style lang="less" scoped>
 .pageHeader {
   width: 100%;
   background-color: #fff;
-  border-bottom: 1px solid #e6e6e6;
+
   .topBar {
     background: #e6e6e6;
     color: #808080;
     overflow: hidden;
     padding: 14px 0;
+
     p {
       float: left;
     }
@@ -158,19 +168,39 @@
   .loginInfoBox {
     width: 200px;
     margin-left: 20px;
+
+    .loginBtn {
+      width: 125px;
+      background-color: #144941;
+      display: flex;
+      justify-content: center;
+      align-items: center;  
+      text-align: center;
+      padding: 12px 0;
+      border-radius: 20px;
+      color: #ffffff;
+      cursor: pointer;
+    }
   }
+
   .logoBox {
     padding: 25px 0;
     overflow: hidden;
-    max-width: 1200px !important;
+    max-width: 1369px !important;
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+
     .logo {
       float: left;
       height: 66px;
+
       img {
-        height: 100%;
+        width: 100%;
         cursor: pointer;
       }
     }
+
     .searchBox {
       width: 670px;
       float: right;
@@ -178,10 +208,12 @@
       display: flex;
       justify-content: space-between;
       align-items: center;
+
       .searchItem {
         width: 120px;
         vertical-align: initial;
       }
+
       .searchBtn {
         width: auto;
         background: #144941;
@@ -191,6 +223,7 @@
       }
     }
   }
+
   .navBox {
     .navItem {
       display: inline-block;
@@ -200,6 +233,7 @@
       line-height: 50px;
       font-size: 16px;
       cursor: pointer;
+
       &.active {
         background: #144941;
         color: #fff;
@@ -208,9 +242,15 @@
   }
 }
 </style>
-<style>
+<style scoped>
 .pageHeader .searchBox .el-input-group__prepend {
   background: #fff;
   color: #444;
 }
+
+::v-deep(.el-input__wrapper) {
+  border-radius: 50px !important;
+  height: 36px;
+  line-height: 36px;
+}
 </style>

--
Gitblit v1.9.1