|
|
@@ -1,16 +1,26 @@
|
|
|
<script setup lang="ts">
|
|
|
import { useMenuStore } from '@/stores/menu'
|
|
|
import { useUserStore } from '@/stores/user'
|
|
|
-import config from '@/config/defaultSetting'
|
|
|
+import { useThemeStore } from '@/stores/theme'
|
|
|
import avatar from '@/assets/images/avatar.png'
|
|
|
import { ElMessageBox } from 'element-plus'
|
|
|
-import router from '@/router'
|
|
|
|
|
|
-const iconSize = ref(20)
|
|
|
+const themeStore = useThemeStore()
|
|
|
+const themeStyle = computed(() => themeStore.themeStyle)
|
|
|
+const headerStyle = computed(() => {
|
|
|
+ if (themeStyle.value.name === 'header-dark') {
|
|
|
+ return {
|
|
|
+ color: '#fff',
|
|
|
+ backgroundColor: themeStyle.value.bgColor
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ // color: themeStyle.value.textColor,
|
|
|
+ backgroundColor: '#fff'
|
|
|
+ }
|
|
|
+})
|
|
|
|
|
|
-const handleLogoClick = () => {
|
|
|
- router.push({ name: config.homeRouteName })
|
|
|
-}
|
|
|
+const iconSize = ref(20)
|
|
|
|
|
|
// 菜单收缩展开切换
|
|
|
const menuStore = useMenuStore()
|
|
|
@@ -46,20 +56,12 @@ const settingVisible = ref(false)
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
- <header class="layout-header">
|
|
|
- <div
|
|
|
- class="logo flex items-center justify-center cursor-pointer"
|
|
|
- :class="{ collapse: value }"
|
|
|
- @click="handleLogoClick"
|
|
|
- >
|
|
|
- <img :src="config.logo" class="h-36px" />
|
|
|
- <div class="ml-2" :class="{ hidden: value }">{{ config.title }}</div>
|
|
|
- </div>
|
|
|
+ <header class="layout-header" :style="headerStyle">
|
|
|
<div class="flex flex-grow items-center justify-between pr-4">
|
|
|
<el-space :size="20">
|
|
|
<el-button link @click="handleToggle">
|
|
|
- <icon-menu-unfold-one :size="iconSize" v-if="!value" />
|
|
|
- <icon-menu-fold-one :size="iconSize" v-else />
|
|
|
+ <icon-menu-unfold-one :size="iconSize" :fill="headerStyle.color" v-if="!value" />
|
|
|
+ <icon-menu-fold-one :size="iconSize" :fill="headerStyle.color" v-else />
|
|
|
</el-button>
|
|
|
<el-breadcrumb class="breadcrumb">
|
|
|
<el-breadcrumb-item v-for="item in matched.slice(1, matched.length)" :key="item.path">
|
|
|
@@ -69,11 +71,11 @@ const settingVisible = ref(false)
|
|
|
</el-space>
|
|
|
<div class="flex items-center">
|
|
|
<el-button link @click="toggleScreen">
|
|
|
- <icon-off-screen :size="iconSize" v-if="isFullscreen" />
|
|
|
- <icon-full-screen :size="iconSize" v-else />
|
|
|
+ <icon-off-screen :size="iconSize" :fill="headerStyle.color" v-if="isFullscreen" />
|
|
|
+ <icon-full-screen :size="iconSize" :fill="headerStyle.color" v-else />
|
|
|
</el-button>
|
|
|
<el-button link class="mr-4" @click="settingVisible = true">
|
|
|
- <icon-setting-two :size="iconSize" />
|
|
|
+ <icon-setting-two :size="iconSize" :fill="headerStyle.color" />
|
|
|
</el-button>
|
|
|
<el-avatar class="mr-10px" :src="user.photo">
|
|
|
<img :src="avatar" alt="" />
|
|
|
@@ -81,7 +83,7 @@ const settingVisible = ref(false)
|
|
|
<el-dropdown>
|
|
|
<span class="el-dropdown-link">
|
|
|
{{ user.name }}
|
|
|
- <el-icon class="el-icon--right">
|
|
|
+ <el-icon class="el-icon--right" :color="headerStyle.color">
|
|
|
<arrow-down />
|
|
|
</el-icon>
|
|
|
</span>
|
|
|
@@ -107,7 +109,6 @@ const settingVisible = ref(false)
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
.layout-header {
|
|
|
- background-color: #fff;
|
|
|
height: 100%;
|
|
|
display: flex;
|
|
|
justify-content: space-between;
|