feat(admin): 升级后台主题并增加本机只读预览
This commit is contained in:
@@ -21,7 +21,22 @@
|
||||
<breadcrumb />
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex">
|
||||
<div class="flex items-center">
|
||||
<button
|
||||
class="admin-ui-toggle"
|
||||
type="button"
|
||||
data-admin-ui-toggle
|
||||
aria-label="新版界面"
|
||||
:aria-pressed="settingStore.adminUi === 'v2'"
|
||||
:title="settingStore.adminUi === 'v2' ? '切回旧版界面' : '切换至新版界面'"
|
||||
@click="settingStore.toggleAdminUi()"
|
||||
>
|
||||
<svg aria-hidden="true" viewBox="0 0 16 16" fill="none" width="15" height="15">
|
||||
<rect x="2" y="3" width="12" height="10" rx="2" stroke="currentColor" stroke-width="1.4" />
|
||||
<path d="M6 3v10m2-7h4" stroke="currentColor" stroke-width="1.4" />
|
||||
</svg>
|
||||
{{ settingStore.adminUi === 'v2' ? '切回旧版' : '体验新版' }}
|
||||
</button>
|
||||
<div class="navbar-item" v-if="!isMobile">
|
||||
<el-tooltip
|
||||
class="box-item"
|
||||
@@ -80,4 +95,23 @@ const { isFullscreen } = useFullscreen()
|
||||
@apply h-full flex justify-center items-center hover:bg-page;
|
||||
}
|
||||
}
|
||||
|
||||
.admin-ui-toggle {
|
||||
height: 30px;
|
||||
padding: 0 10px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
margin-inline: 4px;
|
||||
white-space: nowrap;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: var(--el-color-primary);
|
||||
border: 1px solid var(--el-color-primary-light-7);
|
||||
background: var(--el-color-primary-light-9);
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
&:hover { border-color: var(--el-color-primary); }
|
||||
&:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<main class="main-wrap h-full bg-page">
|
||||
<el-scrollbar>
|
||||
<div class="px-2 py-4">
|
||||
<div class="admin-content px-2 py-4">
|
||||
<router-view v-if="isRouteShow" v-slot="{ Component, route }">
|
||||
<keep-alive :include="includeList" :max="20">
|
||||
<component :is="Component" :key="route.fullPath" />
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
<template>
|
||||
<div class="side" :style="sideStyle">
|
||||
<div class="side" :class="{ 'side--dark': sideTheme === 'dark' }" :style="sideStyle">
|
||||
<side-logo v-if="settingStore.showLogo" :show-title="!isCollapsed" :theme="sideTheme" />
|
||||
<div v-else-if="settingStore.adminUi === 'v2'" class="admin-nav-heading" aria-hidden="true">
|
||||
<svg viewBox="0 0 24 24" fill="none" width="24" height="24">
|
||||
<path d="M4 6.5h10M4 12h16M4 17.5h10" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
|
||||
<circle cx="19" cy="6.5" r="2" fill="currentColor"/>
|
||||
</svg>
|
||||
<span v-if="!isCollapsed">工作导航</span>
|
||||
</div>
|
||||
<side-menu
|
||||
:routes="routes"
|
||||
:is-collapsed="isCollapsed"
|
||||
@@ -14,6 +21,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import defaultSetting from '@/config/setting'
|
||||
import useAppStore from '@/stores/modules/app'
|
||||
import useSettingStore from '@/stores/modules/setting'
|
||||
import useUserStore from '@/stores/modules/user'
|
||||
@@ -39,11 +47,16 @@ const routes = computed(() => userStore.routes)
|
||||
const sideStyle = computed(() => {
|
||||
return sideTheme.value == 'dark'
|
||||
? {
|
||||
'--side-dark-color': settingStore.sideDarkColor
|
||||
'--side-dark-color':
|
||||
settingStore.adminUi === 'v2' && settingStore.sideDarkColor === defaultSetting.sideDarkColor
|
||||
? 'var(--zyt-sidebar-dark)'
|
||||
: settingStore.sideDarkColor
|
||||
}
|
||||
: ''
|
||||
})
|
||||
const menuProp = computed(() => {
|
||||
// In v2 the root tokens also style the collapsed menu's teleported popup.
|
||||
if (settingStore.adminUi === 'v2') return {}
|
||||
return {
|
||||
backgroundColor: sideTheme.value == 'dark' ? settingStore.sideDarkColor : '',
|
||||
textColor: sideTheme.value == 'dark' ? 'var(--el-color-white)' : '',
|
||||
|
||||
Reference in New Issue
Block a user