mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-06 00:18:51 +08:00
parent
593fc1bb26
commit
d1f0a3fd36
@ -3,6 +3,7 @@ import Search from "./search/index.vue";
|
|||||||
import Notice from "./notice/index.vue";
|
import Notice from "./notice/index.vue";
|
||||||
import mixNav from "./sidebar/mixNav.vue";
|
import mixNav from "./sidebar/mixNav.vue";
|
||||||
import { useNav } from "@/layout/hooks/useNav";
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
|
import FullScreen from "./sidebar/fullScreen.vue";
|
||||||
import Breadcrumb from "./sidebar/breadCrumb.vue";
|
import Breadcrumb from "./sidebar/breadCrumb.vue";
|
||||||
import topCollapse from "./sidebar/topCollapse.vue";
|
import topCollapse from "./sidebar/topCollapse.vue";
|
||||||
import { useTranslationLang } from "../hooks/useTranslationLang";
|
import { useTranslationLang } from "../hooks/useTranslationLang";
|
||||||
@ -10,7 +11,6 @@ import globalization from "@/assets/svg/globalization.svg?component";
|
|||||||
import LogoutCircleRLine from "@iconify-icons/ri/logout-circle-r-line";
|
import LogoutCircleRLine from "@iconify-icons/ri/logout-circle-r-line";
|
||||||
import Setting from "@iconify-icons/ri/settings-3-line";
|
import Setting from "@iconify-icons/ri/settings-3-line";
|
||||||
import Check from "@iconify-icons/ep/check";
|
import Check from "@iconify-icons/ep/check";
|
||||||
|
|
||||||
const {
|
const {
|
||||||
layout,
|
layout,
|
||||||
device,
|
device,
|
||||||
@ -47,8 +47,6 @@ const { t, locale, translationCh, translationEn } = useTranslationLang();
|
|||||||
<div v-if="layout === 'vertical'" class="vertical-header-right">
|
<div v-if="layout === 'vertical'" class="vertical-header-right">
|
||||||
<!-- 菜单搜索 -->
|
<!-- 菜单搜索 -->
|
||||||
<Search id="header-search" />
|
<Search id="header-search" />
|
||||||
<!-- 通知 -->
|
|
||||||
<Notice id="header-notice" />
|
|
||||||
<!-- 国际化 -->
|
<!-- 国际化 -->
|
||||||
<el-dropdown id="header-translation" trigger="click">
|
<el-dropdown id="header-translation" trigger="click">
|
||||||
<globalization
|
<globalization
|
||||||
@ -81,6 +79,10 @@ const { t, locale, translationCh, translationEn } = useTranslationLang();
|
|||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
|
<!-- 全屏 -->
|
||||||
|
<FullScreen id="full-screen" />
|
||||||
|
<!-- 消息通知 -->
|
||||||
|
<Notice id="header-notice" />
|
||||||
<!-- 退出登录 -->
|
<!-- 退出登录 -->
|
||||||
<el-dropdown trigger="click">
|
<el-dropdown trigger="click">
|
||||||
<span class="el-dropdown-link navbar-bg-hover select-none">
|
<span class="el-dropdown-link navbar-bg-hover select-none">
|
||||||
|
30
src/layout/components/sidebar/fullScreen.vue
Normal file
30
src/layout/components/sidebar/fullScreen.vue
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, watch } from "vue";
|
||||||
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
|
|
||||||
|
const screenIcon = ref();
|
||||||
|
const { toggle, isFullscreen, Fullscreen, ExitFullscreen } = useNav();
|
||||||
|
|
||||||
|
isFullscreen.value = !!(
|
||||||
|
document.fullscreenElement ||
|
||||||
|
document.webkitFullscreenElement ||
|
||||||
|
document.mozFullScreenElement ||
|
||||||
|
document.msFullscreenElement
|
||||||
|
);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
isFullscreen,
|
||||||
|
full => {
|
||||||
|
screenIcon.value = full ? ExitFullscreen : Fullscreen;
|
||||||
|
},
|
||||||
|
{
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
|
);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<span class="fullscreen-icon navbar-bg-hover" @click="toggle">
|
||||||
|
<IconifyIconOffline :icon="screenIcon" />
|
||||||
|
</span>
|
||||||
|
</template>
|
@ -1,6 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import Search from "../search/index.vue";
|
import Search from "../search/index.vue";
|
||||||
import Notice from "../notice/index.vue";
|
import Notice from "../notice/index.vue";
|
||||||
|
import FullScreen from "./fullScreen.vue";
|
||||||
import SidebarItem from "./sidebarItem.vue";
|
import SidebarItem from "./sidebarItem.vue";
|
||||||
import { isAllEmpty } from "@pureadmin/utils";
|
import { isAllEmpty } from "@pureadmin/utils";
|
||||||
import { ref, nextTick, computed } from "vue";
|
import { ref, nextTick, computed } from "vue";
|
||||||
@ -65,8 +66,6 @@ nextTick(() => {
|
|||||||
<div class="horizontal-header-right">
|
<div class="horizontal-header-right">
|
||||||
<!-- 菜单搜索 -->
|
<!-- 菜单搜索 -->
|
||||||
<Search id="header-search" />
|
<Search id="header-search" />
|
||||||
<!-- 通知 -->
|
|
||||||
<Notice id="header-notice" />
|
|
||||||
<!-- 国际化 -->
|
<!-- 国际化 -->
|
||||||
<el-dropdown id="header-translation" trigger="click">
|
<el-dropdown id="header-translation" trigger="click">
|
||||||
<globalization
|
<globalization
|
||||||
@ -97,6 +96,10 @@ nextTick(() => {
|
|||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
|
<!-- 全屏 -->
|
||||||
|
<FullScreen id="full-screen" />
|
||||||
|
<!-- 消息通知 -->
|
||||||
|
<Notice id="header-notice" />
|
||||||
<!-- 退出登录 -->
|
<!-- 退出登录 -->
|
||||||
<el-dropdown trigger="click">
|
<el-dropdown trigger="click">
|
||||||
<span class="el-dropdown-link navbar-bg-hover">
|
<span class="el-dropdown-link navbar-bg-hover">
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
import extraIcon from "./extraIcon.vue";
|
import extraIcon from "./extraIcon.vue";
|
||||||
import Search from "../search/index.vue";
|
import Search from "../search/index.vue";
|
||||||
import Notice from "../notice/index.vue";
|
import Notice from "../notice/index.vue";
|
||||||
|
import FullScreen from "./fullScreen.vue";
|
||||||
import { isAllEmpty } from "@pureadmin/utils";
|
import { isAllEmpty } from "@pureadmin/utils";
|
||||||
import { useNav } from "@/layout/hooks/useNav";
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
import { transformI18n } from "@/plugins/i18n";
|
import { transformI18n } from "@/plugins/i18n";
|
||||||
@ -98,8 +99,6 @@ watch(
|
|||||||
<div class="horizontal-header-right">
|
<div class="horizontal-header-right">
|
||||||
<!-- 菜单搜索 -->
|
<!-- 菜单搜索 -->
|
||||||
<Search id="header-search" />
|
<Search id="header-search" />
|
||||||
<!-- 通知 -->
|
|
||||||
<Notice id="header-notice" />
|
|
||||||
<!-- 国际化 -->
|
<!-- 国际化 -->
|
||||||
<el-dropdown id="header-translation" trigger="click">
|
<el-dropdown id="header-translation" trigger="click">
|
||||||
<globalization
|
<globalization
|
||||||
@ -130,6 +129,10 @@ watch(
|
|||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
|
<!-- 全屏 -->
|
||||||
|
<FullScreen id="full-screen" />
|
||||||
|
<!-- 消息通知 -->
|
||||||
|
<Notice id="header-notice" />
|
||||||
<!-- 退出登录 -->
|
<!-- 退出登录 -->
|
||||||
<el-dropdown trigger="click">
|
<el-dropdown trigger="click">
|
||||||
<span class="el-dropdown-link navbar-bg-hover select-none">
|
<span class="el-dropdown-link navbar-bg-hover select-none">
|
||||||
|
@ -4,7 +4,7 @@ import { emitter } from "@/utils/mitt";
|
|||||||
import { RouteConfigs } from "../../types";
|
import { RouteConfigs } from "../../types";
|
||||||
import { useTags } from "../../hooks/useTag";
|
import { useTags } from "../../hooks/useTag";
|
||||||
import { routerArrays } from "@/layout/types";
|
import { routerArrays } from "@/layout/types";
|
||||||
import { useFullscreen, onClickOutside } from "@vueuse/core";
|
import { onClickOutside } from "@vueuse/core";
|
||||||
import { handleAliveRoute, getTopMenu } from "@/router/utils";
|
import { handleAliveRoute, getTopMenu } from "@/router/utils";
|
||||||
import { useSettingStoreHook } from "@/store/modules/settings";
|
import { useSettingStoreHook } from "@/store/modules/settings";
|
||||||
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
||||||
@ -59,7 +59,6 @@ const contextmenuRef = ref();
|
|||||||
const isShowArrow = ref(false);
|
const isShowArrow = ref(false);
|
||||||
const topPath = getTopMenu()?.path;
|
const topPath = getTopMenu()?.path;
|
||||||
const { VITE_HIDE_HOME } = import.meta.env;
|
const { VITE_HIDE_HOME } = import.meta.env;
|
||||||
const { isFullscreen, toggle } = useFullscreen();
|
|
||||||
|
|
||||||
const dynamicTagView = async () => {
|
const dynamicTagView = async () => {
|
||||||
await nextTick();
|
await nextTick();
|
||||||
@ -329,28 +328,15 @@ function onClickDrop(key, item, selectRoute?: RouteConfigs) {
|
|||||||
handleAliveRoute(route as ToRouteType);
|
handleAliveRoute(route as ToRouteType);
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
// 整体页面全屏
|
|
||||||
toggle();
|
|
||||||
setTimeout(() => {
|
|
||||||
if (isFullscreen.value) {
|
|
||||||
tagsViews[6].icon = ExitFullscreen;
|
|
||||||
tagsViews[6].text = $t("buttons.hswholeExitFullScreen");
|
|
||||||
} else {
|
|
||||||
tagsViews[6].icon = Fullscreen;
|
|
||||||
tagsViews[6].text = $t("buttons.hswholeFullScreen");
|
|
||||||
}
|
|
||||||
}, 100);
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
// 内容区全屏
|
// 内容区全屏
|
||||||
onContentFullScreen();
|
onContentFullScreen();
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (pureSetting.hiddenSideBar) {
|
if (pureSetting.hiddenSideBar) {
|
||||||
tagsViews[7].icon = ExitFullscreen;
|
tagsViews[6].icon = ExitFullscreen;
|
||||||
tagsViews[7].text = $t("buttons.hscontentExitFullScreen");
|
tagsViews[6].text = $t("buttons.hscontentExitFullScreen");
|
||||||
} else {
|
} else {
|
||||||
tagsViews[7].icon = Fullscreen;
|
tagsViews[6].icon = Fullscreen;
|
||||||
tagsViews[7].text = $t("buttons.hscontentFullScreen");
|
tagsViews[6].text = $t("buttons.hscontentFullScreen");
|
||||||
}
|
}
|
||||||
}, 100);
|
}, 100);
|
||||||
break;
|
break;
|
||||||
@ -511,11 +497,6 @@ watch(route, () => {
|
|||||||
dynamicTagView();
|
dynamicTagView();
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(isFullscreen, () => {
|
|
||||||
tagsViews[6].icon = Fullscreen;
|
|
||||||
tagsViews[6].text = $t("buttons.hswholeFullScreen");
|
|
||||||
});
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (!instance) return;
|
if (!instance) return;
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import { useRouter } from "vue-router";
|
|||||||
import { emitter } from "@/utils/mitt";
|
import { emitter } from "@/utils/mitt";
|
||||||
import userAvatar from "@/assets/user.jpg";
|
import userAvatar from "@/assets/user.jpg";
|
||||||
import { getTopMenu } from "@/router/utils";
|
import { getTopMenu } from "@/router/utils";
|
||||||
|
import { useFullscreen } from "@vueuse/core";
|
||||||
import { useGlobal } from "@pureadmin/utils";
|
import { useGlobal } from "@pureadmin/utils";
|
||||||
import type { routeMetaType } from "../types";
|
import type { routeMetaType } from "../types";
|
||||||
import { transformI18n } from "@/plugins/i18n";
|
import { transformI18n } from "@/plugins/i18n";
|
||||||
@ -13,12 +14,15 @@ import { useAppStoreHook } from "@/store/modules/app";
|
|||||||
import { useUserStoreHook } from "@/store/modules/user";
|
import { useUserStoreHook } from "@/store/modules/user";
|
||||||
import { useEpThemeStoreHook } from "@/store/modules/epTheme";
|
import { useEpThemeStoreHook } from "@/store/modules/epTheme";
|
||||||
import { usePermissionStoreHook } from "@/store/modules/permission";
|
import { usePermissionStoreHook } from "@/store/modules/permission";
|
||||||
|
import ExitFullscreen from "@iconify-icons/ri/fullscreen-exit-fill";
|
||||||
|
import Fullscreen from "@iconify-icons/ri/fullscreen-fill";
|
||||||
|
|
||||||
const errorInfo = "当前路由配置不正确,请检查配置";
|
const errorInfo = "当前路由配置不正确,请检查配置";
|
||||||
|
|
||||||
export function useNav() {
|
export function useNav() {
|
||||||
const pureApp = useAppStoreHook();
|
const pureApp = useAppStoreHook();
|
||||||
const routers = useRouter().options.routes;
|
const routers = useRouter().options.routes;
|
||||||
|
const { isFullscreen, toggle } = useFullscreen();
|
||||||
const { wholeMenus } = storeToRefs(usePermissionStoreHook());
|
const { wholeMenus } = storeToRefs(usePermissionStoreHook());
|
||||||
/** 平台`layout`中所有`el-tooltip`的`effect`配置,默认`light` */
|
/** 平台`layout`中所有`el-tooltip`的`effect`配置,默认`light` */
|
||||||
const tooltipEffect = getConfig()?.TooltipEffect ?? "light";
|
const tooltipEffect = getConfig()?.TooltipEffect ?? "light";
|
||||||
@ -136,6 +140,10 @@ export function useNav() {
|
|||||||
logout,
|
logout,
|
||||||
routers,
|
routers,
|
||||||
$storage,
|
$storage,
|
||||||
|
isFullscreen,
|
||||||
|
Fullscreen,
|
||||||
|
ExitFullscreen,
|
||||||
|
toggle,
|
||||||
backTopMenu,
|
backTopMenu,
|
||||||
onPanel,
|
onPanel,
|
||||||
getDivStyle,
|
getDivStyle,
|
||||||
|
@ -104,17 +104,10 @@ export function useTags() {
|
|||||||
disabled: multiTags.value.length > 1 ? false : true,
|
disabled: multiTags.value.length > 1 ? false : true,
|
||||||
show: true
|
show: true
|
||||||
},
|
},
|
||||||
{
|
|
||||||
icon: Fullscreen,
|
|
||||||
text: $t("buttons.hswholeFullScreen"),
|
|
||||||
divided: true,
|
|
||||||
disabled: false,
|
|
||||||
show: true
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
icon: Fullscreen,
|
icon: Fullscreen,
|
||||||
text: $t("buttons.hscontentFullScreen"),
|
text: $t("buttons.hscontentFullScreen"),
|
||||||
divided: false,
|
divided: true,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
show: true
|
show: true
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.set-icon {
|
.set-icon,
|
||||||
|
.fullscreen-icon {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
@ -460,10 +461,12 @@
|
|||||||
|
|
||||||
/* 搜索 */
|
/* 搜索 */
|
||||||
.search-container,
|
.search-container,
|
||||||
/* 告警 */
|
|
||||||
.dropdown-badge,
|
|
||||||
/* 国际化 */
|
/* 国际化 */
|
||||||
.globalization,
|
.globalization,
|
||||||
|
/* 全屏 */
|
||||||
|
.fullscreen-icon,
|
||||||
|
/* 消息通知 */
|
||||||
|
.dropdown-badge,
|
||||||
/* 用户名 */
|
/* 用户名 */
|
||||||
.el-dropdown-link,
|
.el-dropdown-link,
|
||||||
/* 设置 */
|
/* 设置 */
|
||||||
@ -642,10 +645,12 @@ body[layout="vertical"] {
|
|||||||
|
|
||||||
/* 搜索 */
|
/* 搜索 */
|
||||||
.search-container,
|
.search-container,
|
||||||
/* 告警 */
|
|
||||||
.dropdown-badge,
|
|
||||||
/* 国际化 */
|
/* 国际化 */
|
||||||
.globalization,
|
.globalization,
|
||||||
|
/* 全屏 */
|
||||||
|
.fullscreen-icon,
|
||||||
|
/* 消息通知 */
|
||||||
|
.dropdown-badge,
|
||||||
/* 用户名 */
|
/* 用户名 */
|
||||||
.el-dropdown-link,
|
.el-dropdown-link,
|
||||||
/* 设置 */
|
/* 设置 */
|
||||||
|
@ -29,12 +29,6 @@ const GUIDE_STEPS = [
|
|||||||
intro: "您可以在这里搜索想要查看的菜单",
|
intro: "您可以在这里搜索想要查看的菜单",
|
||||||
position: "left"
|
position: "left"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
element: document.querySelector("#header-notice") as string | HTMLElement,
|
|
||||||
title: "消息通知",
|
|
||||||
intro: "您可以在这里查看管理员发送的消息",
|
|
||||||
position: "left"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
element: document.querySelector("#header-translation") as
|
element: document.querySelector("#header-translation") as
|
||||||
| string
|
| string
|
||||||
@ -43,6 +37,18 @@ const GUIDE_STEPS = [
|
|||||||
intro: "您可以在这里进行语言切换",
|
intro: "您可以在这里进行语言切换",
|
||||||
position: "left"
|
position: "left"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
element: document.querySelector("#full-screen") as string | HTMLElement,
|
||||||
|
title: "全屏",
|
||||||
|
intro: "您可以在这里进行全屏切换",
|
||||||
|
position: "left"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
element: document.querySelector("#header-notice") as string | HTMLElement,
|
||||||
|
title: "消息通知",
|
||||||
|
intro: "您可以在这里查看管理员发送的消息",
|
||||||
|
position: "left"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
element: document.querySelector(".set-icon") as string | HTMLElement,
|
element: document.querySelector(".set-icon") as string | HTMLElement,
|
||||||
title: "项目配置",
|
title: "项目配置",
|
||||||
|
9
types/global.d.ts
vendored
9
types/global.d.ts
vendored
@ -38,6 +38,15 @@ declare global {
|
|||||||
msRequestAnimationFrame: (callback: FrameRequestCallback) => number;
|
msRequestAnimationFrame: (callback: FrameRequestCallback) => number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Document 的类型提示
|
||||||
|
*/
|
||||||
|
interface Document {
|
||||||
|
webkitFullscreenElement?: Element;
|
||||||
|
mozFullScreenElement?: Element;
|
||||||
|
msFullscreenElement?: Element;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 打包压缩格式的类型声明
|
* 打包压缩格式的类型声明
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user