From 019abc739d9e231c2ebfe9ca537f82e2e1843496 Mon Sep 17 00:00:00 2001 From: QYF-GitLab1 <1940665526@qq.com> Date: 星期日, 24 八月 2025 21:24:39 +0800 Subject: [PATCH] 课程班级显示 --- src/layout/components/headerPage.vue | 95 +++++++++++++++++++++++++++-------------------- 1 files changed, 55 insertions(+), 40 deletions(-) diff --git a/src/layout/components/headerPage.vue b/src/layout/components/headerPage.vue index 9aa7fcd..a03c9ab 100644 --- a/src/layout/components/headerPage.vue +++ b/src/layout/components/headerPage.vue @@ -7,7 +7,7 @@ () => { $router.push({ path: '/home', - }); + }) } " src="@/assets/images/xiehe/home/Group_303.png" @@ -17,9 +17,9 @@ <el-input style="width: 500px; height: 50px" placeholder="璇疯緭鍏ュ唴瀹�" - @change="gotoSearch" v-model="searchKey" :suffix-icon="Search" + @keyup.enter="gotoSearch" > </el-input> <div class="loginInfoBox"> @@ -27,8 +27,8 @@ <a @click=" () => { - console.log(loginRef.value); - loginRef.logIn(); + console.log(loginRef.value) + loginRef.logIn() } " >娉ㄥ唽/鐧诲綍</a @@ -44,10 +44,10 @@ </span> <template #dropdown> <el-dropdown-menu> - <el-dropdown-item icon="el-icon-user" command="gotoPersonalCenter" + <el-dropdown-item :icon="Avatar" command="gotoPersonalCenter" >涓汉涓績</el-dropdown-item > - <el-dropdown-item icon="el-icon-switch-button" command="logout" + <el-dropdown-item :icon="SwitchButton" command="logout" >閫�鍑虹櫥褰�</el-dropdown-item > </el-dropdown-menu> @@ -75,15 +75,16 @@ </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 } from 'vue-router' +import { ElMessage } from 'element-plus' +const userStore = useUserStore() +const router = useRouter() -const loginRef = ref(); +const loginRef = ref() const props = defineProps({ hideSerch: { type: Boolean, @@ -93,51 +94,65 @@ 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', }, { - name: "鏁欒偛鍑虹増", - path: "/bookStore", + name: '鏁欒偛鍑虹増', + path: '/bookStore', }, { - name: "璇昏�呮湇鍔�", - path: "/teachingServices", + name: '璇昏�呮湇鍔�', + path: '/teachingServices', }, { - name: "鍏充簬鎴戜滑", - path: "/aboutUs", + name: '鍏充簬鎴戜滑', + path: '/aboutUs', }, -]); +]) onMounted(() => { - userInfo.value = userStore.userInfo; - console.log(userInfo.value, "userInfo"); -}); + userInfo.value = userStore.userInfo + console.log(userInfo.value, 'userInfo') +}) -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() 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> -- Gitblit v1.9.1