| | |
| | | </div> |
| | | <div class="searchBox" v-show="!hideSerch"> |
| | | <el-input |
| | | style="width: 500px; height: 50px" |
| | | style="width: 500px; height: 36px" |
| | | placeholder="请输入内容" |
| | | v-model="searchKey" |
| | | :suffix-icon="Search" |
| | |
| | | > |
| | | </el-input> |
| | | <div class="loginInfoBox"> |
| | | <div v-if="!userInfo" class="loginBtnBox"> |
| | | <a |
| | | <div v-if="!userInfo" class="loginBtnBox" style="width: 200px"> |
| | | <div |
| | | class="loginBtn" |
| | | @click=" |
| | | () => { |
| | | console.log(loginRef.value) |
| | | loginRef.logIn() |
| | | } |
| | | " |
| | | >注册/登录</a |
| | | > |
| | | <el-icon><UserFilled /></el-icon> |
| | | 注册/登录 |
| | | </div> |
| | | </div> |
| | | <div v-else class="userInfoBox"> |
| | | <el-dropdown @command="handleCommand"> |
| | |
| | | </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> |
| | |
| | | <div |
| | | :class="{ |
| | | navItem: true, |
| | | active: $route.fullPath.indexOf(item.path) > -1, |
| | | // active: $route.fullPath.indexOf(item.path) > -1, |
| | | active: item.pathList.findIndex((citem) => citem == $route.path) > -1, |
| | | }" |
| | | v-for="(item, index) in navData" |
| | | :key="index" |
| | |
| | | <script setup lang="ts"> |
| | | import login from './login.vue' |
| | | import { onMounted, provide, ref } from 'vue' |
| | | import { Search } from '@element-plus/icons-vue' |
| | | import { Search, Avatar, SwitchButton } from '@element-plus/icons-vue' |
| | | import { useUserStore } from '@/store' |
| | | import { useRouter } from 'vue-router' |
| | | import { useRouter, useRoute } from 'vue-router' |
| | | import { ElMessage } from 'element-plus' |
| | | |
| | | const userStore = useUserStore() |
| | | const router = useRouter() |
| | | const route = useRoute() |
| | | |
| | | const loginRef = ref() |
| | | const props = defineProps({ |
| | |
| | | { |
| | | name: '首页', |
| | | path: '/home', |
| | | pathList: ['/home', '/search'], |
| | | }, |
| | | { |
| | | name: '教育出版', |
| | | path: '/bookStore', |
| | | pathList: ['/bookStore', '/bookdetail'], |
| | | }, |
| | | { |
| | | name: '读者服务', |
| | | path: '/teachingServices', |
| | | pathList: ['/teachingServices'], |
| | | }, |
| | | { |
| | | name: '关于我们', |
| | | path: '/aboutUs', |
| | | pathList: ['/aboutUs'], |
| | | }, |
| | | ]) |
| | | |
| | | onMounted(() => { |
| | | userInfo.value = userStore.userInfo |
| | | console.log(userInfo.value, 'userInfo') |
| | | console.log(route, 'route') |
| | | }) |
| | | |
| | | const gotoSearch = () => { |
| | |
| | | } |
| | | if (item === 'logout') { |
| | | localStorage.clear() |
| | | userStore.delteUserInfo() |
| | | userInfo.value = null |
| | | router.push({ |
| | | path: '/home', |
| | | }) |
| | |
| | | .pageHeader { |
| | | width: 100%; |
| | | background-color: #fff; |
| | | border-bottom: 1px solid #e6e6e6; |
| | | .topBar { |
| | | background: #e6e6e6; |
| | | color: #808080; |
| | |
| | | .loginInfoBox { |
| | | width: 200px; |
| | | margin-left: 20px; |
| | | .loginBtn { |
| | | width: 100px; |
| | | background-color: #144941; |
| | | height: 36px; |
| | | line-height: 36px; |
| | | text-align: center; |
| | | border-radius: 20px; |
| | | color: #ffffff; |
| | | cursor: pointer; |
| | | } |
| | | } |
| | | .logoBox { |
| | | padding: 25px 0; |
| | | overflow: hidden; |
| | | max-width: 1200px !important; |
| | | max-width: 1369px !important; |
| | | .logo { |
| | | float: left; |
| | | height: 66px; |
| | |
| | | } |
| | | } |
| | | </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> |