forked from SmartBench/CMVR-IOT-UI
- 调整了StatCards.vue中的字母间距,以提高可读性。 - 更新了RightBottomCharts.vue和RightTopCharts.vue中的图表样式,通过新的调色板和背景设置增强了视觉吸引力。 - 修改了图表中的工具提示和轴样式,以提高对比度和可见性。 - 将流程编辑器中的背景颜色更改为使用CSS变量,以保持一致性。 - 引入了新的网络主题风格,包括渐变和阴影,以提供沉浸式的暗色模式体验。 - 为各种组件添加了深色覆盖,以确保与新主题的兼容性。
278 lines
7.6 KiB
Vue
278 lines
7.6 KiB
Vue
<template>
|
|
<div class="navbar" :class="'nav' + settingsStore.navType">
|
|
<hamburger id="hamburger-container" :is-active="appStore.sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
|
|
<breadcrumb v-if="settingsStore.navType == 1" id="breadcrumb-container" class="breadcrumb-container" />
|
|
<top-nav v-if="settingsStore.navType == 2" id="topmenu-container" class="topmenu-container" />
|
|
<template v-if="settingsStore.navType == 3">
|
|
<logo v-show="settingsStore.sidebarLogo" :collapse="false"></logo>
|
|
<top-bar id="topbar-container" class="topbar-container" />
|
|
</template>
|
|
|
|
<div class="right-menu">
|
|
<template v-if="appStore.device !== 'mobile'">
|
|
<header-search id="header-search" class="right-menu-item" />
|
|
|
|
<el-tooltip content="源码地址" effect="dark" placement="bottom">
|
|
<ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" />
|
|
</el-tooltip>
|
|
|
|
<el-tooltip content="文档地址" effect="dark" placement="bottom">
|
|
<ruo-yi-doc id="ruoyi-doc" class="right-menu-item hover-effect" />
|
|
</el-tooltip>
|
|
|
|
<screenfull id="screenfull" class="right-menu-item hover-effect" />
|
|
|
|
<el-tooltip content="主题模式" effect="dark" placement="bottom">
|
|
<div class="right-menu-item hover-effect theme-switch-wrapper" @click="toggleTheme">
|
|
<svg-icon v-if="settingsStore.isDark" icon-class="sunny" />
|
|
<svg-icon v-if="!settingsStore.isDark" icon-class="moon" />
|
|
</div>
|
|
</el-tooltip>
|
|
|
|
<el-tooltip content="布局大小" effect="dark" placement="bottom">
|
|
<size-select id="size-select" class="right-menu-item hover-effect" />
|
|
</el-tooltip>
|
|
|
|
<el-tooltip content="消息通知" effect="dark" placement="bottom">
|
|
<header-notice id="header-notice" class="right-menu-item hover-effect" />
|
|
</el-tooltip>
|
|
</template>
|
|
|
|
<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>
|
|
<el-dropdown-item command="setLayout" v-if="settingsStore.showSettings">
|
|
<span>布局设置</span>
|
|
</el-dropdown-item>
|
|
<el-dropdown-item command="lockScreen">
|
|
<span>锁定屏幕</span>
|
|
</el-dropdown-item>
|
|
<el-dropdown-item divided command="logout">
|
|
<span>退出登录</span>
|
|
</el-dropdown-item>
|
|
</el-dropdown-menu>
|
|
</template>
|
|
</el-dropdown>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { ElMessageBox } from 'element-plus'
|
|
import Breadcrumb from '@/components/Breadcrumb'
|
|
import TopNav from './TopNav'
|
|
import TopBar from './TopBar'
|
|
import Logo from './Sidebar/Logo'
|
|
import Hamburger from '@/components/Hamburger'
|
|
import Screenfull from '@/components/Screenfull'
|
|
import SizeSelect from '@/components/SizeSelect'
|
|
import HeaderSearch from '@/components/HeaderSearch'
|
|
import RuoYiGit from '@/components/RuoYi/Git'
|
|
import RuoYiDoc from '@/components/RuoYi/Doc'
|
|
import useAppStore from '@/store/modules/app'
|
|
import useUserStore from '@/store/modules/user'
|
|
import useLockStore from '@/store/modules/lock'
|
|
import useSettingsStore from '@/store/modules/settings'
|
|
import HeaderNotice from './HeaderNotice'
|
|
|
|
const route = useRoute()
|
|
const router = useRouter()
|
|
const appStore = useAppStore()
|
|
const userStore = useUserStore()
|
|
const lockStore = useLockStore()
|
|
const settingsStore = useSettingsStore()
|
|
|
|
function toggleSideBar() {
|
|
appStore.toggleSideBar()
|
|
}
|
|
|
|
function handleCommand(command) {
|
|
switch (command) {
|
|
case "setLayout":
|
|
setLayout()
|
|
break
|
|
case "lockScreen":
|
|
lockScreen()
|
|
break
|
|
case "logout":
|
|
logout()
|
|
break
|
|
default:
|
|
break
|
|
}
|
|
}
|
|
|
|
function logout() {
|
|
ElMessageBox.confirm('确定注销并退出系统吗?', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
}).then(() => {
|
|
userStore.logOut().then(() => {
|
|
location.href = '/index'
|
|
})
|
|
}).catch(() => { })
|
|
}
|
|
|
|
const emits = defineEmits(['setLayout'])
|
|
function setLayout() {
|
|
emits('setLayout')
|
|
}
|
|
|
|
function lockScreen() {
|
|
const currentPath = route.fullPath
|
|
lockStore.lockScreen(currentPath)
|
|
router.push('/lock')
|
|
}
|
|
|
|
async function toggleTheme(event) {
|
|
const x = event?.clientX || window.innerWidth / 2
|
|
const y = event?.clientY || window.innerHeight / 2
|
|
const wasDark = settingsStore.isDark
|
|
|
|
const isReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches
|
|
const isSupported = document.startViewTransition && !isReducedMotion
|
|
|
|
if (!isSupported) {
|
|
settingsStore.toggleTheme()
|
|
return
|
|
}
|
|
|
|
try {
|
|
const transition = document.startViewTransition(async () => {
|
|
await new Promise((resolve) => setTimeout(resolve, 10))
|
|
settingsStore.toggleTheme()
|
|
await nextTick()
|
|
})
|
|
await transition.ready
|
|
|
|
const endRadius = Math.hypot(Math.max(x, window.innerWidth - x), Math.max(y, window.innerHeight - y))
|
|
const clipPath = [`circle(0px at ${x}px ${y}px)`, `circle(${endRadius}px at ${x}px ${y}px)`]
|
|
document.documentElement.animate(
|
|
{
|
|
clipPath: !wasDark ? [...clipPath].reverse() : clipPath
|
|
}, {
|
|
duration: 650,
|
|
easing: "cubic-bezier(0.4, 0, 0.2, 1)",
|
|
fill: "forwards",
|
|
pseudoElement: !wasDark ? "::view-transition-old(root)" : "::view-transition-new(root)"
|
|
}
|
|
)
|
|
await transition.finished
|
|
} catch (error) {
|
|
console.warn("View transition failed, falling back to immediate toggle:", error)
|
|
settingsStore.toggleTheme()
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang='scss' scoped>
|
|
.navbar {
|
|
height: 64px;
|
|
overflow: hidden;
|
|
position: relative;
|
|
background: var(--navbar-bg);
|
|
box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
|
|
|
|
.hamburger-container {
|
|
line-height: 60px;
|
|
height: 100%;
|
|
float: left;
|
|
cursor: pointer;
|
|
transition: background 0.3s;
|
|
-webkit-tap-highlight-color: transparent;
|
|
|
|
&:hover {
|
|
background: rgba(0, 0, 0, 0.025);
|
|
}
|
|
}
|
|
|
|
.breadcrumb-container {
|
|
float: left;
|
|
}
|
|
|
|
.topmenu-container {
|
|
position: absolute;
|
|
left: 64px;
|
|
}
|
|
|
|
.errLog-container {
|
|
display: inline-block;
|
|
vertical-align: top;
|
|
}
|
|
|
|
.right-menu {
|
|
float: right;
|
|
height: 100%;
|
|
line-height: 64px;
|
|
display: flex;
|
|
|
|
&:focus {
|
|
outline: none;
|
|
}
|
|
|
|
.right-menu-item {
|
|
display: inline-block;
|
|
padding: 0 8px;
|
|
height: 100%;
|
|
font-size: 18px;
|
|
color: var(--navbar-text);
|
|
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: 40px;
|
|
|
|
.avatar-wrapper {
|
|
margin-top: 12px;
|
|
position: relative;
|
|
|
|
.user-avatar {
|
|
cursor: pointer;
|
|
width: 40px;
|
|
height: 40px;
|
|
border-radius: 6px;
|
|
}
|
|
|
|
i {
|
|
cursor: pointer;
|
|
position: absolute;
|
|
right: -20px;
|
|
top: 25px;
|
|
font-size: 12px;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|