# Conflicts:
#	src/layout/component/aside.vue
#	src/layout/component/header.vue
#	src/layout/navBars/tagsView/tagsView.vue
#	src/store/modules/tagsViewRoutes.ts
This commit is contained in:
21030442-mao 2021-07-27 08:51:34 +08:00
commit 0050120d79
8 changed files with 72 additions and 34 deletions

View File

@ -1,18 +1,22 @@
<template>
<el-aside class="layout-aside" :class="setCollapseWidth" v-if="!isCurrenFullscreen && clientWidth > 1000">
<Logo v-if="setShowLogo" />
<el-scrollbar class="flex-auto" ref="layoutAsideScrollbarRef">
<Vertical :menuList="menuList" :class="setCollapseWidth" />
</el-scrollbar>
</el-aside>
<el-drawer v-model="getThemeConfig.isCollapse" :with-header="false" direction="ltr" size="220px" v-else>
<el-aside class="layout-aside w100 h100">
<template v-if="clientWidth > 1000">
<el-aside class="layout-aside" :class="setCollapseWidth" v-show="!isCurrenFullscreen">
<Logo v-if="setShowLogo" />
<el-scrollbar class="flex-auto" ref="layoutAsideScrollbarRef">
<Vertical :menuList="menuList" />
<Vertical :menuList="menuList" :class="setCollapseWidth" />
</el-scrollbar>
</el-aside>
</el-drawer>
</template>
<template v-else>
<el-drawer v-model="getThemeConfig.isCollapse" :with-header="false" direction="ltr" size="220px">
<el-aside class="layout-aside w100 h100">
<Logo v-if="setShowLogo" />
<el-scrollbar class="flex-auto" ref="layoutAsideScrollbarRef">
<Vertical :menuList="menuList" />
</el-scrollbar>
</el-aside>
</el-drawer>
</template>
</template>
<script lang="ts">

View File

@ -1,5 +1,5 @@
<template>
<div class="layout-columns-aside">
<div class="layout-columns-aside" v-show="!isCurrenFullscreen">
<el-scrollbar>
<ul>
<li
@ -70,6 +70,10 @@ export default {
const setColumnsAsidelayout = computed(() => {
return store.state.themeConfig.themeConfig.columnsAsideLayout;
});
//
const isCurrenFullscreen = computed(() => {
return store.state.tagsViewRoutes.isCurrenFullscreen;
});
//
const setColumnsAsideMove = (k: number) => {
state.liIndex = k;
@ -152,6 +156,7 @@ export default {
setColumnsAsideStyle,
setColumnsAsidelayout,
onColumnsAsideMenuClick,
isCurrenFullscreen,
...toRefs(state),
};
},
@ -211,8 +216,8 @@ export default {
position: absolute;
left: 50%;
top: 2px;
height: 44px;
width: 65px;
height: 50px;
width: 60px;
transform: translateX(-50%);
z-index: 0;
transition: 0.3s ease-in-out;
@ -221,7 +226,6 @@ export default {
.columns-card {
@extend .columns-round;
top: 0;
height: 50px;
width: 100%;
border-radius: 0;
}

View File

@ -1,5 +1,5 @@
<template>
<el-header class="layout-header sackajljfs" :height="setHeaderHeight" v-show="!isCurrenFullscreen">
<el-header class="layout-header" :height="setHeaderHeight" v-show="!isCurrenFullscreen">
<NavBarsIndex />
</el-header>
</template>

View File

@ -225,8 +225,19 @@ export default {
break;
}
};
// F11
const initOnkeydown = () => {
document.onkeydown = (event) => {
var e = event || window.event || arguments.callee.caller.arguments[0];
if (e && e.keyCode === 122 && !state.isScreenfull) {
e.preventDefault();
onScreenfullClick();
}
};
};
//
onMounted(() => {
initOnkeydown();
if (Local.get('themeConfig')) {
initI18n();
initComponentSize();

View File

@ -185,21 +185,24 @@ export default {
addBrowserSetSession(state.tagsViewList);
};
// 6
const openCurrenFullscreen = (path: string) => {
const item = state.tagsViewList.find((v: any) => v.path === path);
const openCurrenFullscreen = (path: string, currentRouteInfo: object) => {
nextTick(() => {
router.push({ path, query: item.query });
store.dispatch('tagsViewRoutes/openCurrenFullscreen');
const { meta, name, params, query } = currentRouteInfo;
if (meta.isDynamic) router.push({ name, params });
else router.push({ path, query });
store.dispatch('tagsViewRoutes/setCurrenFullscreen');
});
};
// tagsView
const getCurrentRouteItem = (path: string) => {
if (!Session.get('tagsViewList')) return state.tagsViewList.find((v: any) => v.path === path);
return Session.get('tagsViewList').find((v: any) => v.path === path);
};
//
const onCurrentContextmenuClick = (item) => {
const { id, path } = item;
const { meta, name, params, query } = getCurrentRouteItem(path);
const currentRouteInfo = getCurrentRouteItem(path);
const { meta, name, params, query } = currentRouteInfo;
switch (id) {
case 0:
refreshCurrentTagsView(path);
@ -218,7 +221,7 @@ export default {
closeAllTagsView(path);
break;
case 4:
openCurrenFullscreen(path);
openCurrenFullscreen(path, currentRouteInfo);
break;
}
};

View File

@ -1,4 +1,7 @@
import { Module } from 'vuex';
import { ElMessage } from 'element-plus';
import screenfull from 'screenfull';
import { Local } from '/@/utils/storage';
// 此处加上 `.ts` 后缀报错,具体原因不详
import { TagsViewRoutesState, RootStateTypes } from '/@/store/interface/index';
import { ElMessage } from 'element-plus';
@ -16,7 +19,7 @@ const tagsViewRoutesModule: Module<TagsViewRoutesState, RootStateTypes> = {
state.tagsViewRoutes = data;
},
// 设置卡片全屏
setCurrenFullscreen(state: any, data: boolean) {
getCurrenFullscreen(state: any, data: boolean) {
state.isCurrenFullscreen = data;
},
},
@ -25,22 +28,34 @@ const tagsViewRoutesModule: Module<TagsViewRoutesState, RootStateTypes> = {
async setTagsViewRoutes({ commit }, data: Array<string>) {
commit('getTagsViewRoutes', data);
},
// 开启卡片全屏
openCurrenFullscreen({ commit }) {
if (!screenfull.isEnabled) {
// 设置卡片全屏
setCurrenFullscreen({ commit }) {
const screenfulls: any = screenfull;
if (!screenfulls.isEnabled) {
ElMessage.warning('暂不不支持全屏');
return false;
}
screenfull.toggle();
screenfulls.toggle();
const currenFullscreenChange = () => {
if (screenfull.isFullscreen) commit('setCurrenFullscreen', true);
else {
screenfull.off('change', currenFullscreenChange);
commit('setCurrenFullscreen', false);
const layoutViewBgWhite = document.querySelector('.layout-view-bg-white') as HTMLElement;
if (screenfulls.isFullscreen) {
commit('getCurrenFullscreen', true);
// 设置全屏时,设置有 `layout-view-bg-white` 类的高度
if (layoutViewBgWhite) layoutViewBgWhite.style.height = `calc(100vh - 30px)`;
} else {
screenfulls.off('change', currenFullscreenChange);
commit('getCurrenFullscreen', false);
if (!layoutViewBgWhite) return false;
const getThemeConfig = Local.get('themeConfig');
if (getThemeConfig) {
let { isTagsview } = getThemeConfig;
if (isTagsview) layoutViewBgWhite.style.height = `calc(100vh - 114px)`;
else layoutViewBgWhite.style.height = `calc(100vh - 80px)`;
}
}
};
screenfull.on('change', currenFullscreenChange);
commit('setCurrenFullscreen', true);
screenfulls.on('change', currenFullscreenChange);
commit('getCurrenFullscreen', true);
},
},
};

View File

@ -54,6 +54,7 @@ body,
.el-scrollbar {
width: 100%;
}
// 此字段多次用到不可删除如需修改请重写覆盖样式
.layout-view-bg-white {
background: white;
width: 100%;

View File

@ -1,6 +1,6 @@
<template>
<div class="chart-scrollbar" :style="{ height: `calc(100vh - ${initTagViewHeight}` }">
<div class="chart-warp layout-view-bg-white">
<div class="chart-scrollbar layout-view-bg-white" :style="{ height: `calc(100vh - ${initTagViewHeight}` }">
<div class="chart-warp">
<div class="chart-warp-top">
<ChartHead />
</div>