| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204 |
- <template>
- <div id="systemHeader">
- <div id="systemInformation">
- <img class="logoImg" src="@/assets/thlogo.png" alt="">
- <span>太湖流域河湖管理系统</span>
- </div>
- <div id="systemMenuContainer">
- <systemMenu @addSystemMenuView='menuItemClick'></systemMenu>
- </div>
- <div class="user-area">
- <el-dropdown @command="handleCommand" class="avatar-container right-menu-item hover-effect" trigger="hover">
- <div class="avatar-wrapper">
- <img :src="userStore.avatar" class="user-avatar"/>
- <span class="user-nickname"> {{ userStore.nickName }} </span>
- </div>
- <template #dropdown>
- <el-dropdown-menu>
- <router-link to="/user/profile">
- <el-dropdown-item>个人中心</el-dropdown-item>
- </router-link>
- <router-link to="/hlgl/bankline">
- <el-dropdown-item>后台管理</el-dropdown-item>
- </router-link>
- <el-dropdown-item divided command="logout">
- <span>退出登录</span>
- </el-dropdown-item>
- </el-dropdown-menu>
- </template>
- </el-dropdown>
- </div>
- </div>
- </template>
- <script setup>
- import {onMounted, ref} from 'vue'
- import {useRouter} from 'vue-router'
- import Cookies from 'js-cookie'
- import systemMenu from './systemMenuBar.vue'
- import useUserStore from '@/store/modules/user'
- import {ElMessageBox} from "element-plus";
- const router = useRouter()
- const userStore = useUserStore()
- const name = ref('')
- const emit = defineEmits(['addSystemMenuView'])
- const menuItemClick = (menuItem) => {
- emit('addSystemMenuView', {viewItem: menuItem.viewItem})
- }
- function handleCommand(command) {
- switch (command) {
- case "logout":
- logout()
- break
- default:
- break
- }
- }
- function logout() {
- ElMessageBox.confirm('确定注销并退出系统吗?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- userStore.logOut().then(() => {
- location.href = '/index'
- })
- }).catch(() => {
- })
- }
- onMounted(() => {
- if (Cookies.get('isLogin') === 'true') name.value = Cookies.get('name')
- })
- </script>
- <style lang="scss" scoped>
- #systemHeader {
- height: 56px;
- width: 100%;
- background: linear-gradient(135deg, #e8f4fd 0%, #d4ecfb 50%, #c5e5fa 100%);
- display: flex;
- align-items: center;
- color: #1a3a5c;
- box-shadow: 0 1px 6px rgba(0, 0, 0, .06);
- position: relative;
- z-index: 500;
- border-bottom: 2px solid #b8d8f0;
- .right-menu-item {
- display: inline-block;
- padding: 0 8px;
- height: 100%;
- font-size: 18px;
- color: #5a5e66;
- vertical-align: text-bottom;
- &.hover-effect {
- cursor: pointer;
- transition: background 0.3s;
- &:hover {
- background: rgba(0, 0, 0, 0.025);
- }
- }
- &.theme-switch-wrapper {
- display: flex;
- align-items: center;
- svg {
- transition: transform 0.3s;
- &:hover {
- transform: scale(1.15);
- }
- }
- }
- }
- .avatar-container {
- margin-right: 0px;
- padding-right: 0px;
- .avatar-wrapper {
- margin-top: 10px;
- right: 8px;
- position: relative;
- .user-avatar {
- cursor: pointer;
- width: 30px;
- height: 30px;
- margin-right: 8px;
- border-radius: 50%;
- }
- .user-nickname {
- position: relative;
- left: 0px;
- bottom: 10px;
- font-size: 14px;
- font-weight: bold;
- }
- i {
- cursor: pointer;
- position: absolute;
- right: -20px;
- top: 25px;
- font-size: 12px;
- }
- }
- }
- }
- #systemInformation {
- display: flex;
- align-items: center;
- gap: 10px;
- padding: 0 16px;
- min-width: 340px;
- flex-shrink: 0;
- font-size: 17px;
- font-weight: 600;
- color: #0d4b80;
- }
- .logoImg {
- width: 36px;
- height: 36px;
- border-radius: 8px;
- }
- #systemMenuContainer {
- flex: 1;
- height: 100%;
- display: flex;
- align-items: center;
- }
- .user-area {
- flex-shrink: 0;
- padding: 0 20px;
- }
- .user-name {
- font-size: 13px;
- cursor: pointer;
- color: #4682b4;
- padding: 6px 18px;
- border-radius: 20px;
- border: 1px solid #b0d0e8;
- background: #fff;
- }
- .user-name:hover {
- color: #0d4b80;
- border-color: #6baed6;
- background: #f0f8ff;
- }
- </style>
|