初始化
This commit is contained in:
@@ -0,0 +1,106 @@
|
||||
<template>
|
||||
<el-aside class="layout-aside" :class="setCollapseWidth" v-if="clientWidth > 1000">
|
||||
<Logo v-if="setShowLogo" />
|
||||
<el-scrollbar class="flex-auto" ref="layoutAsideRef">
|
||||
<Vertical :menuList="menuList" :class="setCollapseWidth" />
|
||||
</el-scrollbar>
|
||||
</el-aside>
|
||||
<el-drawer :visible.sync="getThemeConfig.isCollapse" :with-header="false" direction="ltr" size="220px" v-else>
|
||||
<el-aside class="layout-aside w100 h100">
|
||||
<Logo v-if="setShowLogo" />
|
||||
<el-scrollbar class="flex-auto" ref="layoutAsideRef">
|
||||
<Vertical :menuList="menuList" />
|
||||
</el-scrollbar>
|
||||
</el-aside>
|
||||
</el-drawer>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Vertical from '@/layout/navMenu/vertical.vue';
|
||||
import Logo from '@/layout/logo/index.vue';
|
||||
export default {
|
||||
name: 'layoutAside',
|
||||
components: { Vertical, Logo },
|
||||
data() {
|
||||
return {
|
||||
menuList: [],
|
||||
clientWidth: '',
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 设置左侧菜单的具体宽度
|
||||
setCollapseWidth() {
|
||||
let { layout, isCollapse } = this.$store.state.themeConfig.themeConfig;
|
||||
let asideBrColor = '';
|
||||
layout === 'classic' || layout === 'columns' ? (asideBrColor = 'layout-el-aside-br-color') : '';
|
||||
|
||||
if (layout === 'columns') {
|
||||
// 分栏布局,菜单收起时宽度给 1px
|
||||
if (isCollapse) {
|
||||
return ['layout-aside-width1', asideBrColor];
|
||||
} else {
|
||||
return ['layout-aside-width-default', asideBrColor];
|
||||
}
|
||||
} else {
|
||||
// 其它布局给 64px
|
||||
if (isCollapse) {
|
||||
return ['layout-aside-width64', asideBrColor];
|
||||
} else {
|
||||
return ['layout-aside-width-default', asideBrColor];
|
||||
}
|
||||
}
|
||||
},
|
||||
// 设置 logo 是否显示
|
||||
setShowLogo() {
|
||||
let { layout, isShowLogo } = this.$store.state.themeConfig.themeConfig;
|
||||
return (isShowLogo && layout === 'defaults') || (isShowLogo && layout === 'columns');
|
||||
},
|
||||
// 获取布局配置信息
|
||||
getThemeConfig() {
|
||||
return this.$store.state.themeConfig.themeConfig;
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.initMenuFixed(document.body.clientWidth);
|
||||
this.setFilterRoutes();
|
||||
this.bus.$on('setSendColumnsChildren', (res) => {
|
||||
this.menuList = res.children;
|
||||
});
|
||||
this.bus.$on('layoutMobileResize', (res) => {
|
||||
this.initMenuFixed(res.clientWidth);
|
||||
});
|
||||
// 菜单滚动条监听
|
||||
this.bus.$on('updateElScrollBar', () => {
|
||||
setTimeout(() => {
|
||||
this.$refs.layoutAsideRef.update();
|
||||
}, 300);
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
// 设置/过滤路由(非静态路由/是否显示在菜单中)
|
||||
setFilterRoutes() {
|
||||
if (this.$store.state.themeConfig.themeConfig.layout === 'columns') return false;
|
||||
this.menuList = this.filterRoutesFun(this.$store.state.routesList.routesList);
|
||||
},
|
||||
// 设置/过滤路由 递归函数
|
||||
filterRoutesFun(arr) {
|
||||
return arr
|
||||
.filter((item) => !item.meta.isHide)
|
||||
.map((item) => {
|
||||
item = Object.assign({}, item);
|
||||
if (item.children) item.children = this.filterRoutesFun(item.children);
|
||||
return item;
|
||||
});
|
||||
},
|
||||
// 设置菜单导航是否固定(移动端)
|
||||
initMenuFixed(clientWidth) {
|
||||
this.clientWidth = clientWidth;
|
||||
},
|
||||
},
|
||||
// 页面销毁时
|
||||
destroyed() {
|
||||
// 取消菜单滚动条监听
|
||||
this.bus.$off('updateElScrollBar', () => {});
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,233 @@
|
||||
<template>
|
||||
<div class="layout-columns-aside">
|
||||
<el-scrollbar>
|
||||
<ul>
|
||||
<li
|
||||
v-for="(v, k) in columnsAsideList"
|
||||
:key="k"
|
||||
@click="onColumnsAsideMenuClick(v)"
|
||||
ref="columnsAsideOffsetTopRefs"
|
||||
:class="{ 'layout-columns-active': liIndex === k }"
|
||||
:title="$t(v.meta.title)"
|
||||
>
|
||||
<div :class="setColumnsAsidelayout" v-if="!v.meta.isLink || (v.meta.isLink && v.meta.isIframe)">
|
||||
<i :class="v.meta.icon"></i>
|
||||
<div class="font12">
|
||||
{{
|
||||
$t(v.meta.title) && $t(v.meta.title).length >= 4
|
||||
? $t(v.meta.title).substr(0, setColumnsAsidelayout === 'columns-vertical' ? 4 : 3)
|
||||
: $t(v.meta.title)
|
||||
}}
|
||||
</div>
|
||||
</div>
|
||||
<div :class="setColumnsAsidelayout" v-else>
|
||||
<a :href="v.meta.isLink" target="_blank">
|
||||
<i :class="v.meta.icon"></i>
|
||||
<div class="font12">
|
||||
{{
|
||||
$t(v.meta.title) && $t(v.meta.title).length >= 4
|
||||
? $t(v.meta.title).substr(0, setColumnsAsidelayout === 'columns-vertical' ? 4 : 3)
|
||||
: $t(v.meta.title)
|
||||
}}
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</li>
|
||||
<div ref="columnsAsideActiveRef" :class="setColumnsAsideStyle"></div>
|
||||
</ul>
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'layoutColumnsAside',
|
||||
data() {
|
||||
return {
|
||||
columnsAsideList: [],
|
||||
liIndex: 0,
|
||||
difference: 0,
|
||||
routeSplit: [],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 设置分栏高亮风格
|
||||
setColumnsAsideStyle() {
|
||||
return this.$store.state.themeConfig.themeConfig.columnsAsideStyle;
|
||||
},
|
||||
// 设置分栏布局风格
|
||||
setColumnsAsidelayout() {
|
||||
return this.$store.state.themeConfig.themeConfig.columnsAsideLayout;
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.setFilterRoutes();
|
||||
},
|
||||
methods: {
|
||||
// 设置菜单高亮位置移动
|
||||
setColumnsAsideMove(k) {
|
||||
if (k === undefined) return false;
|
||||
const els = this.$refs.columnsAsideOffsetTopRefs;
|
||||
this.liIndex = k;
|
||||
this.$refs.columnsAsideActiveRef.style.top = `${els[k].offsetTop + this.difference}px`;
|
||||
},
|
||||
// 菜单高亮点击事件
|
||||
onColumnsAsideMenuClick(v) {
|
||||
let { path, redirect } = v;
|
||||
if (redirect) this.$router.push(redirect);
|
||||
else this.$router.push(path);
|
||||
// 一个路由设置自动收起菜单
|
||||
// https://gitee.com/lyt-top/vue-next-admin/issues/I6HW7H
|
||||
if (!v.children || v.children.length <= 1) this.$store.state.themeConfig.themeConfig.isCollapse = true;
|
||||
else if (v.children.length > 1) this.$store.state.themeConfig.themeConfig.isCollapse = false;
|
||||
},
|
||||
// 设置高亮动态位置
|
||||
onColumnsAsideDown(k) {
|
||||
this.$nextTick(() => {
|
||||
this.setColumnsAsideMove(k);
|
||||
});
|
||||
},
|
||||
// 设置/过滤路由(非静态路由/是否显示在菜单中)
|
||||
setFilterRoutes() {
|
||||
if (this.$store.state.routesList.routesList.length <= 0) return false;
|
||||
this.columnsAsideList = this.filterRoutesFun(this.$store.state.routesList.routesList);
|
||||
const resData = this.setSendChildren(this.$route.path);
|
||||
if (Object.keys(resData).length <= 0) return false;
|
||||
this.onColumnsAsideDown(resData.item[0].k);
|
||||
// 刷新时,初始化一个路由设置自动收起菜单
|
||||
// https://gitee.com/lyt-top/vue-next-admin/issues/I6HW7H
|
||||
resData.children.length <= 1
|
||||
? (this.$store.state.themeConfig.themeConfig.isCollapse = true)
|
||||
: (this.$store.state.themeConfig.themeConfig.isCollapse = false);
|
||||
this.bus.$emit('setSendColumnsChildren', resData);
|
||||
},
|
||||
// 传送当前子级数据到菜单中
|
||||
setSendChildren(path) {
|
||||
const currentPathSplit = path.split('/');
|
||||
let currentData = {};
|
||||
this.columnsAsideList.map((v, k) => {
|
||||
if (v.path === `/${currentPathSplit[1]}`) {
|
||||
v['k'] = k;
|
||||
currentData['item'] = [{ ...v }];
|
||||
currentData['children'] = [{ ...v }];
|
||||
if (v.children) currentData['children'] = v.children;
|
||||
}
|
||||
});
|
||||
return currentData;
|
||||
},
|
||||
// 路由过滤递归函数
|
||||
filterRoutesFun(arr) {
|
||||
return arr
|
||||
.filter((item) => !item.meta.isHide)
|
||||
.map((item) => {
|
||||
item = Object.assign({}, item);
|
||||
if (item.children) item.children = this.filterRoutesFun(item.children);
|
||||
return item;
|
||||
});
|
||||
},
|
||||
// tagsView 点击时,根据路由查找下标 columnsAsideList,实现左侧菜单高亮
|
||||
setColumnsMenuHighlight(path) {
|
||||
this.routeSplit = path.split('/');
|
||||
this.routeSplit.shift();
|
||||
const routeFirst = `/${this.routeSplit[0]}`;
|
||||
const currentSplitRoute = this.columnsAsideList.find((v) => v.path === routeFirst);
|
||||
if (!currentSplitRoute) return false;
|
||||
// 延迟拿值,防止取不到
|
||||
setTimeout(() => {
|
||||
this.onColumnsAsideDown(currentSplitRoute.k);
|
||||
}, 0);
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
// 监听 vuex 数据变化
|
||||
'$store.state': {
|
||||
handler(val) {
|
||||
val.themeConfig.themeConfig.columnsAsideStyle === 'columnsRound' ? (this.difference = 3) : (this.difference = 0);
|
||||
if (val.routesList.routesList.length === this.columnsAsideList.length) return false;
|
||||
this.setFilterRoutes();
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
// 监听路由的变化
|
||||
$route: {
|
||||
handler(to) {
|
||||
this.setColumnsMenuHighlight(to.path);
|
||||
this.bus.$emit('setSendColumnsChildren', this.setSendChildren(to.path));
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.layout-columns-aside {
|
||||
width: 70px;
|
||||
height: 100%;
|
||||
background: var(--prev-bg-columnsMenuBar);
|
||||
ul {
|
||||
position: relative;
|
||||
li {
|
||||
color: var(--prev-bg-columnsMenuBarColor);
|
||||
width: 100%;
|
||||
height: 50px;
|
||||
text-align: center;
|
||||
display: flex;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
.columns-vertical {
|
||||
margin: auto;
|
||||
.columns-vertical-title {
|
||||
padding-top: 1px;
|
||||
}
|
||||
}
|
||||
.columns-horizontal {
|
||||
display: flex;
|
||||
height: 50px;
|
||||
width: 100%;
|
||||
align-items: center;
|
||||
padding: 0 5px;
|
||||
i {
|
||||
margin-right: 3px;
|
||||
}
|
||||
a {
|
||||
display: flex;
|
||||
.columns-horizontal-title {
|
||||
padding-top: 1px;
|
||||
}
|
||||
}
|
||||
}
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: var(--prev-bg-columnsMenuBarColor);
|
||||
}
|
||||
}
|
||||
.layout-columns-active,
|
||||
.layout-columns-active a {
|
||||
color: var(--prev-color-text-white);
|
||||
transition: 0.3s ease-in-out;
|
||||
}
|
||||
.columns-round {
|
||||
background: var(--prev-color-primary);
|
||||
color: var(--prev-color-text-white);
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 2px;
|
||||
height: 50px;
|
||||
width: 65px;
|
||||
transform: translateX(-50%);
|
||||
z-index: 0;
|
||||
transition: 0.3s ease-in-out;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.columns-card {
|
||||
@extend .columns-round;
|
||||
top: 0;
|
||||
height: 50px;
|
||||
width: 100%;
|
||||
border-radius: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,24 @@
|
||||
<template>
|
||||
<el-header class="layout-header" :height="setHeaderHeight">
|
||||
<NavBarsIndex />
|
||||
</el-header>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import NavBarsIndex from '@/layout/navBars/index.vue';
|
||||
export default {
|
||||
name: 'layoutHeader',
|
||||
components: { NavBarsIndex },
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
computed: {
|
||||
// 设置顶部 header 的具体高度
|
||||
setHeaderHeight() {
|
||||
let { isTagsview, layout } = this.$store.state.themeConfig.themeConfig;
|
||||
if (isTagsview && layout !== 'classic') return '84px';
|
||||
else return '50px';
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,93 @@
|
||||
<template>
|
||||
<el-main class="layout-main">
|
||||
<el-scrollbar
|
||||
class="layout-scrollbar"
|
||||
ref="layoutScrollbarRef"
|
||||
v-show="!currentRouteMeta.isLink && !currentRouteMeta.isIframe"
|
||||
:style="{ minHeight: `calc(100vh - ${headerHeight}` }"
|
||||
>
|
||||
<LayoutParentView />
|
||||
<Footers v-if="getThemeConfig.isFooter" />
|
||||
</el-scrollbar>
|
||||
<Links
|
||||
:style="{ height: `calc(100vh - ${headerHeight}` }"
|
||||
:meta="currentRouteMeta"
|
||||
v-if="currentRouteMeta.isLink && !currentRouteMeta.isIframe"
|
||||
/>
|
||||
<Iframes
|
||||
:style="{ height: `calc(100vh - ${headerHeight}` }"
|
||||
:meta="currentRouteMeta"
|
||||
v-if="currentRouteMeta.isLink && currentRouteMeta.isIframe && isShowLink"
|
||||
@getCurrentRouteMeta="onGetCurrentRouteMeta"
|
||||
/>
|
||||
</el-main>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import LayoutParentView from '@/layout/routerView/parent.vue';
|
||||
import Footers from '@/layout/footer/index.vue';
|
||||
import Links from '@/layout/routerView/link.vue';
|
||||
import Iframes from '@/layout/routerView/iframes.vue';
|
||||
export default {
|
||||
name: 'layoutMain',
|
||||
components: { LayoutParentView, Footers, Links, Iframes },
|
||||
data() {
|
||||
return {
|
||||
headerHeight: '',
|
||||
currentRouteMeta: {},
|
||||
isShowLink: false,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 获取布局配置信息
|
||||
getThemeConfig() {
|
||||
return this.$store.state.themeConfig.themeConfig;
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.initHeaderHeight();
|
||||
this.initCurrentRouteMeta(this.$route.meta);
|
||||
},
|
||||
methods: {
|
||||
// 初始化当前路由 meta 信息
|
||||
initCurrentRouteMeta(meta) {
|
||||
this.isShowLink = false;
|
||||
this.currentRouteMeta = meta;
|
||||
setTimeout(() => {
|
||||
this.isShowLink = true;
|
||||
}, 100);
|
||||
},
|
||||
// 设置 main 的高度
|
||||
initHeaderHeight() {
|
||||
let { isTagsview } = this.$store.state.themeConfig.themeConfig;
|
||||
if (isTagsview) return (this.headerHeight = `84px`);
|
||||
else return (this.headerHeight = `50px`);
|
||||
},
|
||||
// 子组件触发更新
|
||||
onGetCurrentRouteMeta() {
|
||||
this.initCurrentRouteMeta(this.$route.meta);
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
// 监听 vuex 数据变化
|
||||
'$store.state.themeConfig.themeConfig': {
|
||||
handler(val) {
|
||||
this.headerHeight = val.isTagsview ? '84px' : '50px';
|
||||
if (val.isFixedHeaderChange !== val.isFixedHeader) {
|
||||
if (!this.$refs.layoutScrollbarRef) return false;
|
||||
this.$refs.layoutScrollbarRef.update();
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
// 监听路由的变化
|
||||
$route: {
|
||||
handler(to) {
|
||||
this.initCurrentRouteMeta(to.meta);
|
||||
this.$refs.layoutScrollbarRef.wrap.scrollTop = 0;
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,29 @@
|
||||
<template>
|
||||
<div class="layout-footer mt15">
|
||||
<div class="layout-footer-warp">
|
||||
<div>智慧校园❤️</div>
|
||||
<div class="mt5">版权所有:数字校园教育管理平台</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "layoutFooter",
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.layout-footer {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
&-warp {
|
||||
margin: auto;
|
||||
color: var(--prev-color-text-secondary);
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,51 @@
|
||||
<template>
|
||||
<Defaults v-if="getThemeConfig.layout === 'defaults'" />
|
||||
<Classic v-else-if="getThemeConfig.layout === 'classic'" />
|
||||
<Transverse v-else-if="getThemeConfig.layout === 'transverse'" />
|
||||
<Columns v-else-if="getThemeConfig.layout === 'columns'" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { Local } from '@/utils/storage.js';
|
||||
export default {
|
||||
name: 'layout',
|
||||
components: {
|
||||
Defaults: () => import('@/layout/main/defaults.vue'),
|
||||
Classic: () => import('@/layout/main/classic.vue'),
|
||||
Transverse: () => import('@/layout/main/transverse.vue'),
|
||||
Columns: () => import('@/layout/main/columns.vue'),
|
||||
},
|
||||
computed: {
|
||||
// 获取布局配置信息
|
||||
getThemeConfig() {
|
||||
return this.$store.state.themeConfig.themeConfig;
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.onLayoutResize();
|
||||
window.addEventListener('resize', this.onLayoutResize);
|
||||
},
|
||||
methods: {
|
||||
// 窗口大小改变时(适配移动端)
|
||||
onLayoutResize() {
|
||||
if (!Local.get('oldLayout')) Local.set('oldLayout', this.$store.state.themeConfig.themeConfig.layout);
|
||||
const clientWidth = document.body.clientWidth;
|
||||
if (clientWidth < 1000) {
|
||||
this.$store.state.themeConfig.themeConfig.isCollapse = false;
|
||||
this.bus.$emit('layoutMobileResize', {
|
||||
layout: 'defaults',
|
||||
clientWidth,
|
||||
});
|
||||
} else {
|
||||
this.bus.$emit('layoutMobileResize', {
|
||||
layout: Local.get('oldLayout') ? Local.get('oldLayout') : this.$store.state.themeConfig.themeConfig.layout,
|
||||
clientWidth,
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
distroyed() {
|
||||
window.removeEventListener('resize', this.onLayoutResize);
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,78 @@
|
||||
<template>
|
||||
<div class="layout-logo" v-if="setShowLogo" @click="onThemeConfigChange">
|
||||
<!-- <img :src="logo" class="layout-logo-medium-img" /> -->
|
||||
<!-- <span>{{ getThemeConfig.globalTitle }}</span> -->
|
||||
<span>数字校园教育管理平台</span>
|
||||
</div>
|
||||
<div class="layout-logo-size" v-else @click="onThemeConfigChange">
|
||||
<img :src="logo" class="layout-logo-size-img" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "layoutLogo",
|
||||
data() {
|
||||
return {
|
||||
logo: require("@/assets/logo.png"),
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 获取布局配置信息
|
||||
getThemeConfig() {
|
||||
console.log(this.$store.state.themeConfig);
|
||||
return this.$store.state.themeConfig.themeConfig;
|
||||
},
|
||||
// 设置 logo 是否显示
|
||||
setShowLogo() {
|
||||
let { isCollapse, layout } = this.$store.state.themeConfig.themeConfig;
|
||||
return !isCollapse || layout === "classic" || document.body.clientWidth < 1000;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
// logo 点击实现菜单展开/收起
|
||||
onThemeConfigChange() {
|
||||
if (this.$store.state.themeConfig.themeConfig.layout === "transverse") return false;
|
||||
this.$store.state.themeConfig.themeConfig.isCollapse = !this.$store.state
|
||||
.themeConfig.themeConfig.isCollapse;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.layout-logo {
|
||||
width: 220px;
|
||||
height: 50px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-shadow: rgb(0 21 41 / 2%) 0px 1px 4px;
|
||||
color: var(--prev-color-primary);
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
animation: logoAnimation 0.3s ease-in-out;
|
||||
&:hover {
|
||||
span {
|
||||
opacity: 0.9;
|
||||
}
|
||||
}
|
||||
&-medium-img {
|
||||
width: 20px;
|
||||
margin-right: 5px;
|
||||
position: relative;
|
||||
top: 2px;
|
||||
}
|
||||
}
|
||||
.layout-logo-size {
|
||||
width: 100%;
|
||||
height: 50px;
|
||||
display: flex;
|
||||
cursor: pointer;
|
||||
&-img {
|
||||
width: 20px;
|
||||
margin: auto;
|
||||
animation: logoAnimation 0.3s ease-in-out;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,30 @@
|
||||
<template>
|
||||
<el-container class="layout-container flex-center">
|
||||
<Headers />
|
||||
<el-container class="layout-mian-height-50">
|
||||
<Asides />
|
||||
<div class="flex-center layout-backtop">
|
||||
<TagsView v-if="getThemeConfig.isTagsview" />
|
||||
<Mains />
|
||||
</div>
|
||||
</el-container>
|
||||
<el-backtop target=".layout-backtop .el-main .el-scrollbar__wrap"></el-backtop>
|
||||
</el-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Asides from '@/layout/component/aside.vue';
|
||||
import Headers from '@/layout/component/header.vue';
|
||||
import Mains from '@/layout/component/main.vue';
|
||||
import TagsView from '@/layout/navBars/tagsView/tagsView.vue';
|
||||
export default {
|
||||
name: 'layoutClassic',
|
||||
components: { Asides, Headers, Mains, TagsView },
|
||||
computed: {
|
||||
// 获取布局配置信息
|
||||
getThemeConfig() {
|
||||
return this.$store.state.themeConfig.themeConfig;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<el-container class="layout-container">
|
||||
<ColumnsAside />
|
||||
<div class="layout-columns-warp">
|
||||
<Asides />
|
||||
<el-container class="flex-center layout-backtop">
|
||||
<Headers v-if="isFixedHeader" />
|
||||
<el-scrollbar>
|
||||
<Headers v-if="!isFixedHeader" />
|
||||
<Mains />
|
||||
</el-scrollbar>
|
||||
</el-container>
|
||||
</div>
|
||||
<el-backtop target=".layout-backtop .el-scrollbar__wrap"></el-backtop>
|
||||
</el-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Asides from '@/layout/component/aside.vue';
|
||||
import Headers from '@/layout/component/header.vue';
|
||||
import Mains from '@/layout/component/main.vue';
|
||||
import ColumnsAside from '@/layout/component/columnsAside.vue';
|
||||
export default {
|
||||
name: 'layoutColumns',
|
||||
components: { Asides, Headers, Mains, ColumnsAside },
|
||||
computed: {
|
||||
// 是否开启固定 header
|
||||
isFixedHeader() {
|
||||
return this.$store.state.themeConfig.themeConfig.isFixedHeader;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,41 @@
|
||||
<template>
|
||||
<el-container class="layout-container">
|
||||
<Asides />
|
||||
<el-container class="flex-center layout-backtop">
|
||||
<Headers v-if="isFixedHeader" />
|
||||
<el-scrollbar ref="layoutDefaultsScrollbarRef">
|
||||
<Headers v-if="!isFixedHeader" />
|
||||
<Mains />
|
||||
</el-scrollbar>
|
||||
</el-container>
|
||||
<el-backtop target=".layout-backtop .el-scrollbar__wrap"></el-backtop>
|
||||
</el-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Asides from '@/layout/component/aside.vue';
|
||||
import Headers from '@/layout/component/header.vue';
|
||||
import Mains from '@/layout/component/main.vue';
|
||||
export default {
|
||||
name: 'layoutDefaults',
|
||||
components: { Asides, Headers, Mains },
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
computed: {
|
||||
// 是否开启固定 header
|
||||
isFixedHeader() {
|
||||
return this.$store.state.themeConfig.themeConfig.isFixedHeader;
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
// 监听路由的变化
|
||||
$route: {
|
||||
handler() {
|
||||
this.$refs.layoutDefaultsScrollbarRef.wrap.scrollTop = 0;
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,16 @@
|
||||
<template>
|
||||
<el-container class="layout-container flex-center layout-backtop">
|
||||
<Headers />
|
||||
<Mains />
|
||||
<el-backtop target=".layout-backtop .el-main .el-scrollbar__wrap"></el-backtop>
|
||||
</el-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Headers from '@/layout/component/header.vue';
|
||||
import Mains from '@/layout/component/main.vue';
|
||||
export default {
|
||||
name: 'layoutTransverse',
|
||||
components: { Headers, Mains },
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,139 @@
|
||||
<template>
|
||||
<div class="layout-navbars-breadcrumb" :style="{ display: isShowBreadcrumb }">
|
||||
<i
|
||||
class="layout-navbars-breadcrumb-icon"
|
||||
:class="getThemeConfig.isCollapse ? 'el-icon-s-unfold' : 'el-icon-s-fold'"
|
||||
@click="onThemeConfigChange"
|
||||
></i>
|
||||
<el-breadcrumb class="layout-navbars-breadcrumb-hide">
|
||||
<transition-group name="breadcrumb" mode="out-in">
|
||||
<el-breadcrumb-item v-for="(v, k) in breadcrumbList" :key="v.path">
|
||||
<span v-if="k === breadcrumbList.length - 1" class="layout-navbars-breadcrumb-span">
|
||||
<i :class="v.meta.icon" class="layout-navbars-breadcrumb-iconfont" v-if="getThemeConfig.isBreadcrumbIcon"></i>{{ $t(v.meta.title) }}
|
||||
</span>
|
||||
<a v-else @click.prevent="onBreadcrumbClick(v)">
|
||||
<i :class="v.meta.icon" class="layout-navbars-breadcrumb-iconfont" v-if="getThemeConfig.isBreadcrumbIcon"></i>{{ $t(v.meta.title) }}
|
||||
</a>
|
||||
</el-breadcrumb-item>
|
||||
</transition-group>
|
||||
</el-breadcrumb>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { Local } from '@/utils/storage.js';
|
||||
export default {
|
||||
name: 'layoutBreadcrumb',
|
||||
data() {
|
||||
return {
|
||||
breadcrumbList: [],
|
||||
routeSplit: [],
|
||||
routeSplitFirst: '',
|
||||
routeSplitIndex: 1,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 获取布局配置信息
|
||||
getThemeConfig() {
|
||||
return this.$store.state.themeConfig.themeConfig;
|
||||
},
|
||||
// 动态设置经典、横向布局不显示
|
||||
isShowBreadcrumb() {
|
||||
const { layout, isBreadcrumb } = this.$store.state.themeConfig.themeConfig;
|
||||
if (layout === 'classic' || layout === 'transverse') {
|
||||
return 'none';
|
||||
} else {
|
||||
return isBreadcrumb ? '' : 'none';
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.initRouteSplit(this.$route.path);
|
||||
},
|
||||
methods: {
|
||||
// breadcrumb 当前项点击时
|
||||
onBreadcrumbClick(v) {
|
||||
const { redirect, path } = v;
|
||||
if (redirect) this.$router.push(redirect);
|
||||
else this.$router.push(path);
|
||||
},
|
||||
// breadcrumb icon 点击菜单展开与收起
|
||||
onThemeConfigChange() {
|
||||
this.$store.state.themeConfig.themeConfig.isCollapse = !this.$store.state.themeConfig.themeConfig.isCollapse;
|
||||
this.setLocalThemeConfig();
|
||||
},
|
||||
// 存储布局配置
|
||||
setLocalThemeConfig() {
|
||||
Local.remove('themeConfigPrev');
|
||||
Local.set('themeConfigPrev', this.$store.state.themeConfig.themeConfig);
|
||||
},
|
||||
// 递归设置 breadcrumb
|
||||
getBreadcrumbList(arr) {
|
||||
arr.map((item) => {
|
||||
this.routeSplit.map((v, k, arrs) => {
|
||||
if (this.routeSplitFirst === item.path) {
|
||||
this.routeSplitFirst += `/${arrs[this.routeSplitIndex]}`;
|
||||
this.breadcrumbList.push(item);
|
||||
this.routeSplitIndex++;
|
||||
if (item.children) this.getBreadcrumbList(item.children);
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
// 当前路由分割处理
|
||||
initRouteSplit(path) {
|
||||
this.breadcrumbList = [
|
||||
{
|
||||
path: '/',
|
||||
meta: {
|
||||
title: this.$store.state.routesList.routesList[0].meta.title,
|
||||
icon: this.$store.state.routesList.routesList[0].meta.icon,
|
||||
},
|
||||
},
|
||||
];
|
||||
this.routeSplit = path.split('/');
|
||||
this.routeSplit.shift();
|
||||
this.routeSplitFirst = `/${this.routeSplit[0]}`;
|
||||
this.routeSplitIndex = 1;
|
||||
this.getBreadcrumbList(this.$store.state.routesList.routesList);
|
||||
},
|
||||
},
|
||||
// 监听路由的变化
|
||||
watch: {
|
||||
$route: {
|
||||
handler(newVal) {
|
||||
this.initRouteSplit(newVal.path);
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.layout-navbars-breadcrumb {
|
||||
flex: 1;
|
||||
height: inherit;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding-left: 15px;
|
||||
.layout-navbars-breadcrumb-icon {
|
||||
cursor: pointer;
|
||||
font-size: 18px;
|
||||
margin-right: 15px;
|
||||
color: var(--prev-bg-topBarColor);
|
||||
opacity: 0.8;
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
.layout-navbars-breadcrumb-span {
|
||||
opacity: 0.7;
|
||||
color: var(--prev-bg-topBarColor);
|
||||
}
|
||||
.layout-navbars-breadcrumb-iconfont {
|
||||
font-size: 14px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,77 @@
|
||||
<template>
|
||||
<div class="layout-navbars-breadcrumb-index">
|
||||
<Logo v-if="setIsShowLogo" />
|
||||
<Breadcrumb />
|
||||
<Horizontal :menuList="menuList" v-if="isLayoutTransverse" />
|
||||
<User />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Breadcrumb from '@/layout/navBars/breadcrumb/breadcrumb.vue';
|
||||
import User from '@/layout/navBars/breadcrumb/user.vue';
|
||||
import Logo from '@/layout/logo/index.vue';
|
||||
import Horizontal from '@/layout/navMenu/horizontal.vue';
|
||||
export default {
|
||||
name: 'layoutNavBars',
|
||||
components: { Breadcrumb, User, Logo, Horizontal },
|
||||
data() {
|
||||
return {
|
||||
menuList: [],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 设置 logo 是否显示
|
||||
setIsShowLogo() {
|
||||
let { isShowLogo, layout } = this.$store.state.themeConfig.themeConfig;
|
||||
return (isShowLogo && layout === 'classic') || (isShowLogo && layout === 'transverse');
|
||||
},
|
||||
// 设置是否显示横向菜单
|
||||
isLayoutTransverse() {
|
||||
let { layout, isClassicSplitMenu } = this.$store.state.themeConfig.themeConfig;
|
||||
return layout === 'transverse' || (isClassicSplitMenu && layout === 'classic');
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.setFilterRoutes();
|
||||
},
|
||||
methods: {
|
||||
// 设置路由的过滤
|
||||
setFilterRoutes() {
|
||||
this.menuList = this.filterRoutesFun(this.$store.state.routesList.routesList);
|
||||
},
|
||||
// 设置路由的过滤递归函数
|
||||
filterRoutesFun(arr) {
|
||||
return arr
|
||||
.filter((item) => !item.meta.isHide)
|
||||
.map((item) => {
|
||||
item = Object.assign({}, item);
|
||||
if (item.children) item.children = this.filterRoutesFun(item.children);
|
||||
return item;
|
||||
});
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
// 监听 vuex 数据变化
|
||||
'$store.state': {
|
||||
handler(val) {
|
||||
if (val.routesList.routesList.length === this.menuList.length) return false;
|
||||
this.setFilterRoutes();
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.layout-navbars-breadcrumb-index {
|
||||
height: 50px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding-right: 15px;
|
||||
overflow: hidden;
|
||||
background: var(--prev-bg-topBar);
|
||||
border-bottom: 1px solid var(--prev-border-color-lighter);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,100 @@
|
||||
<template>
|
||||
<div class="layout-search-dialog">
|
||||
<el-dialog :visible.sync="isShowSearch" width="300px" destroy-on-close :modal="false" fullscreen :show-close="false">
|
||||
<el-autocomplete
|
||||
v-model="menuQuery"
|
||||
:fetch-suggestions="menuSearch"
|
||||
:placeholder="$t('message.user.searchPlaceholder')"
|
||||
prefix-icon="el-icon-search"
|
||||
ref="layoutMenuAutocompleteRef"
|
||||
@select="onHandleSelect"
|
||||
@blur="onSearchBlur"
|
||||
>
|
||||
<template slot-scope="{ item }">
|
||||
<div><i :class="item.meta.icon" class="mr10"></i>{{ $t(item.meta.title) }}</div>
|
||||
</template>
|
||||
</el-autocomplete>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'layoutBreadcrumbSearch',
|
||||
data() {
|
||||
return {
|
||||
isShowSearch: false,
|
||||
menuQuery: '',
|
||||
tagsViewList: [],
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
// 搜索弹窗打开
|
||||
openSearch() {
|
||||
this.menuQuery = '';
|
||||
this.isShowSearch = true;
|
||||
this.initTageView();
|
||||
this.$nextTick(() => {
|
||||
this.$refs.layoutMenuAutocompleteRef.focus();
|
||||
});
|
||||
},
|
||||
// 搜索弹窗关闭
|
||||
closeSearch() {
|
||||
setTimeout(() => {
|
||||
this.isShowSearch = false;
|
||||
}, 150);
|
||||
},
|
||||
// 菜单搜索数据过滤
|
||||
menuSearch(queryString, cb) {
|
||||
let results = queryString ? this.tagsViewList.filter(this.createFilter(queryString)) : this.tagsViewList;
|
||||
cb(results);
|
||||
},
|
||||
// 菜单搜索过滤
|
||||
createFilter(queryString) {
|
||||
return (restaurant) => {
|
||||
return (
|
||||
restaurant.path.toLowerCase().indexOf(queryString.toLowerCase()) > -1 ||
|
||||
restaurant.meta.title.toLowerCase().indexOf(queryString.toLowerCase()) > -1 ||
|
||||
this.$t(restaurant.meta.title).toLowerCase().indexOf(queryString.toLowerCase()) > -1
|
||||
);
|
||||
};
|
||||
},
|
||||
// 初始化菜单数据
|
||||
initTageView() {
|
||||
if (this.tagsViewList.length > 0) return false;
|
||||
this.$store.state.tagsViewRoutes.tagsViewRoutes.map((v) => {
|
||||
if (!v.meta.isHide) this.tagsViewList.push({ ...v });
|
||||
});
|
||||
},
|
||||
// 当前菜单选中时
|
||||
onHandleSelect(item) {
|
||||
let { path, redirect } = item;
|
||||
if (item.meta.isLink && !item.meta.isIframe) window.open(item.meta.isLink);
|
||||
else if (redirect) this.$router.push(redirect);
|
||||
else this.$router.push(path);
|
||||
this.closeSearch();
|
||||
},
|
||||
// input 失去焦点时
|
||||
onSearchBlur() {
|
||||
this.closeSearch();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.layout-search-dialog {
|
||||
::v-deep .el-dialog {
|
||||
box-shadow: unset !important;
|
||||
border-radius: 0 !important;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
::v-deep .el-autocomplete {
|
||||
width: 560px;
|
||||
position: absolute;
|
||||
top: 100px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,538 @@
|
||||
<template>
|
||||
<div class="layout-breadcrumb-seting">
|
||||
<el-drawer
|
||||
:title="$t('message.layout.configTitle')"
|
||||
:visible.sync="getThemeConfig.isDrawer"
|
||||
direction="rtl"
|
||||
destroy-on-close
|
||||
size="240px"
|
||||
@close="onDrawerClose"
|
||||
>
|
||||
<el-scrollbar class="layout-breadcrumb-seting-bar">
|
||||
<!-- 全局主题 -->
|
||||
<el-divider content-position="left">{{ $t('message.layout.oneTitle') }}</el-divider>
|
||||
<div class="layout-breadcrumb-seting-bar-flex">
|
||||
<div class="layout-breadcrumb-seting-bar-flex-label">primary</div>
|
||||
<div class="layout-breadcrumb-seting-bar-flex-value">
|
||||
<el-color-picker v-model="getThemeConfig.primary" size="small" @change="onColorPickerChange"> </el-color-picker>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layout-breadcrumb-seting-bar-flex mt15">
|
||||
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.fourIsDark') }}</div>
|
||||
<div class="layout-breadcrumb-seting-bar-flex-value">
|
||||
<el-switch v-model="getThemeConfig.isIsDark" :width="35" @change="onAddDarkChange"></el-switch>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 界面设置 -->
|
||||
<el-divider content-position="left">{{ $t('message.layout.threeTitle') }}</el-divider>
|
||||
<div class="layout-breadcrumb-seting-bar-flex">
|
||||
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.threeIsCollapse') }}</div>
|
||||
<div class="layout-breadcrumb-seting-bar-flex-value">
|
||||
<el-switch v-model="getThemeConfig.isCollapse" :width="35" @change="setLocalThemeConfig"></el-switch>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layout-breadcrumb-seting-bar-flex mt15">
|
||||
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.threeIsUniqueOpened') }}</div>
|
||||
<div class="layout-breadcrumb-seting-bar-flex-value">
|
||||
<el-switch v-model="getThemeConfig.isUniqueOpened" :width="35" @change="setLocalThemeConfig"></el-switch>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layout-breadcrumb-seting-bar-flex mt15">
|
||||
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.threeIsFixedHeader') }}</div>
|
||||
<div class="layout-breadcrumb-seting-bar-flex-value">
|
||||
<el-switch v-model="getThemeConfig.isFixedHeader" :width="35" @change="setLocalThemeConfig"></el-switch>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 界面显示 -->
|
||||
<el-divider content-position="left">{{ $t('message.layout.fourTitle') }}</el-divider>
|
||||
<div class="layout-breadcrumb-seting-bar-flex">
|
||||
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.fourIsShowLogo') }}</div>
|
||||
<div class="layout-breadcrumb-seting-bar-flex-value">
|
||||
<el-switch v-model="getThemeConfig.isShowLogo" :width="35" @change="setLocalThemeConfig"></el-switch>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="layout-breadcrumb-seting-bar-flex mt15"
|
||||
:style="{ opacity: getThemeConfig.layout === 'classic' || getThemeConfig.layout === 'transverse' ? 0.5 : 1 }"
|
||||
>
|
||||
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.fourIsBreadcrumb') }}</div>
|
||||
<div class="layout-breadcrumb-seting-bar-flex-value">
|
||||
<el-switch
|
||||
v-model="getThemeConfig.isBreadcrumb"
|
||||
:disabled="getThemeConfig.layout === 'classic' || getThemeConfig.layout === 'transverse'"
|
||||
:width="35"
|
||||
@change="setLocalThemeConfig"
|
||||
></el-switch>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layout-breadcrumb-seting-bar-flex mt15">
|
||||
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.fourIsBreadcrumbIcon') }}</div>
|
||||
<div class="layout-breadcrumb-seting-bar-flex-value">
|
||||
<el-switch v-model="getThemeConfig.isBreadcrumbIcon" :width="35" @change="setLocalThemeConfig"></el-switch>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layout-breadcrumb-seting-bar-flex mt15">
|
||||
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.fourIsTagsview') }}</div>
|
||||
<div class="layout-breadcrumb-seting-bar-flex-value">
|
||||
<el-switch v-model="getThemeConfig.isTagsview" :width="35" @change="setLocalThemeConfig"></el-switch>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layout-breadcrumb-seting-bar-flex mt15">
|
||||
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.fourIsTagsviewIcon') }}</div>
|
||||
<div class="layout-breadcrumb-seting-bar-flex-value">
|
||||
<el-switch v-model="getThemeConfig.isTagsviewIcon" :width="35" @change="setLocalThemeConfig"></el-switch>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layout-breadcrumb-seting-bar-flex mt15">
|
||||
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.fourIsCacheTagsView') }}</div>
|
||||
<div class="layout-breadcrumb-seting-bar-flex-value">
|
||||
<el-switch v-model="getThemeConfig.isCacheTagsView" :width="35" @change="setLocalThemeConfig"></el-switch>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layout-breadcrumb-seting-bar-flex mt15">
|
||||
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.fourIsFooter') }}</div>
|
||||
<div class="layout-breadcrumb-seting-bar-flex-value">
|
||||
<el-switch v-model="getThemeConfig.isFooter" :width="35" @change="setLocalThemeConfig"></el-switch>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layout-breadcrumb-seting-bar-flex mt15">
|
||||
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.fourIsGrayscale') }}</div>
|
||||
<div class="layout-breadcrumb-seting-bar-flex-value">
|
||||
<el-switch v-model="getThemeConfig.isGrayscale" :width="35" @change="onAddFilterChange('grayscale')"></el-switch>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layout-breadcrumb-seting-bar-flex mt15">
|
||||
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.fourIsInvert') }}</div>
|
||||
<div class="layout-breadcrumb-seting-bar-flex-value">
|
||||
<el-switch v-model="getThemeConfig.isInvert" :width="35" @change="onAddFilterChange('invert')"></el-switch>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 其它设置 -->
|
||||
<el-divider content-position="left">{{ $t('message.layout.fiveTitle') }}</el-divider>
|
||||
<div class="layout-breadcrumb-seting-bar-flex mt15">
|
||||
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.fiveTagsStyle') }}</div>
|
||||
<div class="layout-breadcrumb-seting-bar-flex-value">
|
||||
<el-select v-model="getThemeConfig.tagsStyle" placeholder="请选择" size="mini" style="width: 90px" @change="setLocalThemeConfig">
|
||||
<el-option label="风格1" value="tags-style-one"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layout-breadcrumb-seting-bar-flex mt15">
|
||||
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.fiveAnimation') }}</div>
|
||||
<div class="layout-breadcrumb-seting-bar-flex-value">
|
||||
<el-select v-model="getThemeConfig.animation" placeholder="请选择" size="mini" style="width: 90px" @change="setLocalThemeConfig">
|
||||
<el-option label="slide-right" value="slide-right"></el-option>
|
||||
<el-option label="slide-left" value="slide-left"></el-option>
|
||||
<el-option label="opacitys" value="opacitys"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layout-breadcrumb-seting-bar-flex mt15">
|
||||
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.fiveColumnsAsideStyle') }}</div>
|
||||
<div class="layout-breadcrumb-seting-bar-flex-value">
|
||||
<el-select v-model="getThemeConfig.columnsAsideStyle" placeholder="请选择" size="mini" style="width: 90px" @change="setLocalThemeConfig">
|
||||
<el-option label="圆角" value="columns-round"></el-option>
|
||||
<el-option label="卡片" value="columns-card"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layout-breadcrumb-seting-bar-flex mt15 mb28">
|
||||
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.fiveColumnsAsideLayout') }}</div>
|
||||
<div class="layout-breadcrumb-seting-bar-flex-value">
|
||||
<el-select v-model="getThemeConfig.columnsAsideLayout" placeholder="请选择" size="mini" style="width: 90px" @change="setLocalThemeConfig">
|
||||
<el-option label="水平" value="columns-horizontal"></el-option>
|
||||
<el-option label="垂直" value="columns-vertical"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 布局切换 -->
|
||||
<el-divider content-position="left">{{ $t('message.layout.sixTitle') }}</el-divider>
|
||||
<div class="layout-drawer-content-flex">
|
||||
<!-- defaults 布局 -->
|
||||
<div class="layout-drawer-content-item" @click="onSetLayout('defaults')">
|
||||
<section class="el-container el-circular" :class="{ 'drawer-layout-active': getThemeConfig.layout === 'defaults' }">
|
||||
<aside class="el-aside" style="width: 20px"></aside>
|
||||
<section class="el-container is-vertical">
|
||||
<header class="el-header" style="height: 10px"></header>
|
||||
<main class="el-main"></main>
|
||||
</section>
|
||||
</section>
|
||||
<div class="layout-tips-warp" :class="{ 'layout-tips-warp-active': getThemeConfig.layout === 'defaults' }">
|
||||
<div class="layout-tips-box">
|
||||
<p class="layout-tips-txt">{{ $t('message.layout.sixDefaults') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- classic 布局 -->
|
||||
<div class="layout-drawer-content-item" @click="onSetLayout('classic')">
|
||||
<section class="el-container is-vertical el-circular" :class="{ 'drawer-layout-active': getThemeConfig.layout === 'classic' }">
|
||||
<header class="el-header" style="height: 10px"></header>
|
||||
<section class="el-container">
|
||||
<aside class="el-aside" style="width: 20px"></aside>
|
||||
<section class="el-container is-vertical">
|
||||
<main class="el-main"></main>
|
||||
</section>
|
||||
</section>
|
||||
</section>
|
||||
<div class="layout-tips-warp" :class="{ 'layout-tips-warp-active': getThemeConfig.layout === 'classic' }">
|
||||
<div class="layout-tips-box">
|
||||
<p class="layout-tips-txt">{{ $t('message.layout.sixClassic') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- transverse 布局 -->
|
||||
<div class="layout-drawer-content-item" @click="onSetLayout('transverse')">
|
||||
<section class="el-container is-vertical el-circular" :class="{ 'drawer-layout-active': getThemeConfig.layout === 'transverse' }">
|
||||
<header class="el-header" style="height: 10px"></header>
|
||||
<section class="el-container">
|
||||
<section class="el-container is-vertical">
|
||||
<main class="el-main"></main>
|
||||
</section>
|
||||
</section>
|
||||
</section>
|
||||
<div class="layout-tips-warp" :class="{ 'layout-tips-warp-active': getThemeConfig.layout === 'transverse' }">
|
||||
<div class="layout-tips-box">
|
||||
<p class="layout-tips-txt">{{ $t('message.layout.sixTransverse') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- columns 布局 -->
|
||||
<div class="layout-drawer-content-item" @click="onSetLayout('columns')">
|
||||
<section class="el-container el-circular" :class="{ 'drawer-layout-active': getThemeConfig.layout === 'columns' }">
|
||||
<aside class="el-aside-dark" style="width: 10px"></aside>
|
||||
<aside class="el-aside" style="width: 20px"></aside>
|
||||
<section class="el-container is-vertical">
|
||||
<header class="el-header" style="height: 10px"></header>
|
||||
<main class="el-main"></main>
|
||||
</section>
|
||||
</section>
|
||||
<div class="layout-tips-warp" :class="{ 'layout-tips-warp-active': getThemeConfig.layout === 'columns' }">
|
||||
<div class="layout-tips-box">
|
||||
<p class="layout-tips-txt">{{ $t('message.layout.sixColumns') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="copy-config">
|
||||
<el-alert :title="$t('message.layout.tipText')" type="warning" :closable="false"> </el-alert>
|
||||
<el-button
|
||||
size="small"
|
||||
class="copy-config-btn"
|
||||
icon="el-icon-document-copy"
|
||||
type="primary"
|
||||
ref="copyConfigBtnRef"
|
||||
@click="onCopyConfigClick"
|
||||
>{{ $t('message.layout.copyText') }}
|
||||
</el-button>
|
||||
<el-button size="small" class="copy-config-btn-reset" type="info" icon="el-icon-refresh-right" @click="onResetConfigClick">
|
||||
{{ $t('message.layout.resetText') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</el-scrollbar>
|
||||
</el-drawer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ClipboardJS from 'clipboard';
|
||||
import { Local } from '@/utils/storage.js';
|
||||
import { useChangeColor } from '@/utils/theme.js';
|
||||
import config from '/package.json';
|
||||
export default {
|
||||
name: 'layoutBreadcrumbSeting',
|
||||
computed: {
|
||||
// 获取布局配置信息
|
||||
getThemeConfig() {
|
||||
return this.$store.state.themeConfig.themeConfig;
|
||||
},
|
||||
},
|
||||
created() {
|
||||
// 判断当前布局是否不相同,不相同则初始化当前布局的样式,防止监听窗口大小改变时,布局配置logo、菜单背景等部分布局失效问题
|
||||
if (!Local.get('frequency')) this.initSetLayoutChange();
|
||||
Local.set('frequency', 1);
|
||||
// 监听窗口大小改变,非默认布局,设置成默认布局(适配移动端)
|
||||
this.bus.$on('layoutMobileResize', (res) => {
|
||||
if (this.$store.state.themeConfig.themeConfig.layout === res.layout) return false;
|
||||
this.$store.state.themeConfig.themeConfig.layout = res.layout;
|
||||
this.$store.state.themeConfig.themeConfig.isDrawer = false;
|
||||
this.$store.state.themeConfig.themeConfig.isCollapse = false;
|
||||
this.initSetLayoutChange();
|
||||
});
|
||||
},
|
||||
mounted() {
|
||||
this.initLayoutConfig();
|
||||
},
|
||||
methods: {
|
||||
// 全局主题
|
||||
onColorPickerChange() {
|
||||
if (!this.getThemeConfig.primary) return;
|
||||
// 颜色加深
|
||||
document.documentElement.style.setProperty('--prev-color-primary', this.getThemeConfig.primary);
|
||||
// 颜色变浅
|
||||
for (let i = 1; i <= 9; i++) {
|
||||
document.documentElement.style.setProperty(
|
||||
`--prev-color-primary-light-${i}`,
|
||||
`${useChangeColor().getLightColor(this.getThemeConfig.primary, i / 10)}`
|
||||
);
|
||||
}
|
||||
this.setLocalThemeConfig();
|
||||
},
|
||||
// 深色模式
|
||||
onAddDarkChange() {
|
||||
const body = document.documentElement;
|
||||
if (this.getThemeConfig.isIsDark) body.setAttribute('data-theme', 'dark');
|
||||
else body.setAttribute('data-theme', '');
|
||||
this.setLocalThemeConfig();
|
||||
},
|
||||
// 初始化:刷新页面时,设置了值,直接取缓存中的值进行初始化
|
||||
initLayoutConfig() {
|
||||
window.addEventListener('load', () => {
|
||||
// 默认样式
|
||||
this.onColorPickerChange();
|
||||
// 灰色模式
|
||||
if (this.$store.state.themeConfig.themeConfig.isGrayscale) this.onAddFilterChange('grayscale');
|
||||
// 色弱模式
|
||||
if (this.$store.state.themeConfig.themeConfig.isInvert) this.onAddFilterChange('invert');
|
||||
// 深色模式
|
||||
if (this.$store.state.themeConfig.themeConfig.isIsDark) this.onAddDarkChange();
|
||||
// 语言国际化
|
||||
if (Local.get('themeConfigPrev')) this.$i18n.locale = Local.get('themeConfigPrev').globalI18n;
|
||||
});
|
||||
},
|
||||
// 存储布局配置
|
||||
setLocalThemeConfig() {
|
||||
Local.remove('themeConfigPrev');
|
||||
Local.set('themeConfigPrev', this.$store.state.themeConfig.themeConfig);
|
||||
this.setLocalThemeConfigStyle();
|
||||
},
|
||||
// 存储布局配置全局主题样式(html根标签)
|
||||
setLocalThemeConfigStyle() {
|
||||
Local.set('themeConfigStyle', document.documentElement.style.cssText);
|
||||
},
|
||||
// 布局配置弹窗打开
|
||||
openDrawer() {
|
||||
this.$store.state.themeConfig.themeConfig.isDrawer = true;
|
||||
},
|
||||
// 关闭弹窗时,初始化变量
|
||||
onDrawerClose() {
|
||||
this.$store.state.themeConfig.themeConfig.isDrawer = false;
|
||||
this.setLocalThemeConfig();
|
||||
},
|
||||
// 灰色模式/色弱模式
|
||||
onAddFilterChange(attr) {
|
||||
if (attr === 'grayscale') {
|
||||
if (this.$store.state.themeConfig.themeConfig.isGrayscale) this.$store.state.themeConfig.themeConfig.isInvert = false;
|
||||
} else {
|
||||
if (this.$store.state.themeConfig.themeConfig.isInvert) this.$store.state.themeConfig.themeConfig.isGrayscale = false;
|
||||
}
|
||||
const cssAttr =
|
||||
attr === 'grayscale'
|
||||
? `grayscale(${this.$store.state.themeConfig.themeConfig.isGrayscale ? 1 : 0})`
|
||||
: `invert(${this.$store.state.themeConfig.themeConfig.isInvert ? '80%' : '0%'})`;
|
||||
const appEle = document.body;
|
||||
appEle.setAttribute('style', `filter: ${cssAttr};`);
|
||||
this.setLocalThemeConfig();
|
||||
},
|
||||
// 布局切换
|
||||
onSetLayout(layout) {
|
||||
Local.set('oldLayout', layout);
|
||||
if (this.$store.state.themeConfig.themeConfig.layout === layout) return false;
|
||||
this.$store.state.themeConfig.themeConfig.layout = layout;
|
||||
this.$store.state.themeConfig.themeConfig.isDrawer = false;
|
||||
this.initSetLayoutChange();
|
||||
},
|
||||
// 设置布局切换,重置主题样式
|
||||
initSetLayoutChange() {
|
||||
if (this.$store.state.themeConfig.themeConfig.layout === 'classic') {
|
||||
this.onBgColorPickerChange('menuBar', '#ffffff');
|
||||
this.onBgColorPickerChange('menuBarColor', '#606266');
|
||||
this.onBgColorPickerChange('topBar', '#ffffff');
|
||||
this.onBgColorPickerChange('topBarColor', '#606266');
|
||||
} else if (this.$store.state.themeConfig.themeConfig.layout === 'transverse') {
|
||||
this.onBgColorPickerChange('menuBarColor', '#ffffff');
|
||||
this.onBgColorPickerChange('topBar', '#545c64');
|
||||
this.onBgColorPickerChange('topBarColor', '#ffffff');
|
||||
} else if (this.$store.state.themeConfig.themeConfig.layout === 'columns') {
|
||||
this.onBgColorPickerChange('menuBar', '#ffffff');
|
||||
this.onBgColorPickerChange('menuBarColor', '#606266');
|
||||
this.onBgColorPickerChange('topBar', '#ffffff');
|
||||
this.onBgColorPickerChange('topBarColor', '#606266');
|
||||
} else {
|
||||
this.onBgColorPickerChange('menuBar', '#545c64');
|
||||
this.onBgColorPickerChange('menuBarColor', '#eaeaea');
|
||||
this.onBgColorPickerChange('topBar', '#ffffff');
|
||||
this.onBgColorPickerChange('topBarColor', '#606266');
|
||||
}
|
||||
},
|
||||
// 菜单 / 顶栏背景等
|
||||
onBgColorPickerChange(bg, rgb) {
|
||||
document.documentElement.style.setProperty(`--prev-bg-${bg}`, rgb);
|
||||
this.setLocalThemeConfigStyle();
|
||||
},
|
||||
// 一键复制配置
|
||||
onCopyConfigClick() {
|
||||
this.$store.state.themeConfig.themeConfig.isDrawer = false;
|
||||
let clipboardJS = new ClipboardJS('.copy-config-btn', {
|
||||
text: () => JSON.stringify(this.$store.state.themeConfig.themeConfig),
|
||||
});
|
||||
clipboardJS.on('success', () => {
|
||||
this.$message.success('配置复制成功');
|
||||
this.isDrawer = false;
|
||||
clipboardJS.destroy();
|
||||
});
|
||||
clipboardJS.on('error', () => {
|
||||
this.$message.error('配置复制失败');
|
||||
});
|
||||
},
|
||||
// 一键恢复默认
|
||||
onResetConfigClick() {
|
||||
Local.clear();
|
||||
window.location.reload();
|
||||
Local.set('version', config.version);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.layout-breadcrumb-seting-bar {
|
||||
height: calc(100vh - 50px);
|
||||
padding: 0 15px;
|
||||
::v-deep .el-scrollbar__view {
|
||||
overflow-x: hidden !important;
|
||||
}
|
||||
.layout-breadcrumb-seting-bar-flex {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
&-label {
|
||||
flex: 1;
|
||||
color: var(--prev-color-text-primary);
|
||||
}
|
||||
}
|
||||
.layout-drawer-content-flex {
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-content: flex-start;
|
||||
margin: 0 -5px;
|
||||
.layout-drawer-content-item {
|
||||
width: 50%;
|
||||
height: 70px;
|
||||
cursor: pointer;
|
||||
border: 1px solid transparent;
|
||||
position: relative;
|
||||
padding: 5px;
|
||||
.el-container {
|
||||
height: 100%;
|
||||
.el-aside-dark {
|
||||
background-color: var(--prev-color-seting-header);
|
||||
}
|
||||
.el-aside {
|
||||
background-color: var(--prev-color-seting-aside);
|
||||
}
|
||||
.el-header {
|
||||
background-color: var(--prev-color-seting-header);
|
||||
}
|
||||
.el-main {
|
||||
background-color: var(--prev-color-seting-main);
|
||||
}
|
||||
}
|
||||
.el-circular {
|
||||
border-radius: 2px;
|
||||
overflow: hidden;
|
||||
border: 1px solid transparent;
|
||||
transition: all 0.3s ease-in-out;
|
||||
}
|
||||
.drawer-layout-active {
|
||||
border: 1px solid;
|
||||
border-color: var(--prev-color-primary);
|
||||
}
|
||||
.layout-tips-warp,
|
||||
.layout-tips-warp-active {
|
||||
transition: all 0.3s ease-in-out;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
border: 1px solid;
|
||||
border-color: var(--prev-color-primary-light-5);
|
||||
border-radius: 100%;
|
||||
padding: 4px;
|
||||
.layout-tips-box {
|
||||
transition: inherit;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
z-index: 9;
|
||||
border: 1px solid;
|
||||
border-color: var(--prev-color-primary-light-5);
|
||||
border-radius: 100%;
|
||||
.layout-tips-txt {
|
||||
transition: inherit;
|
||||
position: relative;
|
||||
top: 5px;
|
||||
font-size: 12px;
|
||||
line-height: 1;
|
||||
letter-spacing: 2px;
|
||||
white-space: nowrap;
|
||||
color: var(--prev-color-primary-light-5);
|
||||
text-align: center;
|
||||
transform: rotate(30deg);
|
||||
left: -1px;
|
||||
background-color: var(--prev-color-seting-main);
|
||||
width: 32px;
|
||||
height: 17px;
|
||||
line-height: 17px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.layout-tips-warp-active {
|
||||
border: 1px solid;
|
||||
border-color: var(--prev-color-primary);
|
||||
.layout-tips-box {
|
||||
border: 1px solid;
|
||||
border-color: var(--prev-color-primary);
|
||||
.layout-tips-txt {
|
||||
color: var(--prev-color-primary) !important;
|
||||
background-color: var(--prev-color-seting-main) !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
&:hover {
|
||||
.el-circular {
|
||||
transition: all 0.3s ease-in-out;
|
||||
border: 1px solid;
|
||||
border-color: var(--prev-color-primary);
|
||||
}
|
||||
.layout-tips-warp {
|
||||
transition: all 0.3s ease-in-out;
|
||||
border-color: var(--prev-color-primary);
|
||||
.layout-tips-box {
|
||||
transition: inherit;
|
||||
border-color: var(--prev-color-primary);
|
||||
.layout-tips-txt {
|
||||
transition: inherit;
|
||||
color: var(--prev-color-primary) !important;
|
||||
background-color: var(--prev-color-seting-main) !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.copy-config {
|
||||
margin: 10px 0;
|
||||
.copy-config-btn {
|
||||
width: 100%;
|
||||
margin-top: 15px;
|
||||
}
|
||||
.copy-config-btn-reset {
|
||||
width: 100%;
|
||||
margin: 10px 0 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,331 @@
|
||||
<template>
|
||||
<div class="layout-navbars-breadcrumb-user" :style="{ flex: layoutUserFlexNum }">
|
||||
<el-dropdown
|
||||
:show-timeout="70"
|
||||
:hide-timeout="50"
|
||||
trigger="click"
|
||||
@command="onComponentSizeChange"
|
||||
>
|
||||
<div class="layout-navbars-breadcrumb-user-icon">
|
||||
<i class="iconfont icon-ziti" :title="$t('message.user.title0')"></i>
|
||||
</div>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item command="" :disabled="disabledSize === ''">{{
|
||||
$t("message.user.dropdownDefault")
|
||||
}}</el-dropdown-item>
|
||||
<el-dropdown-item command="medium" :disabled="disabledSize === 'medium'">{{
|
||||
$t("message.user.dropdownMedium")
|
||||
}}</el-dropdown-item>
|
||||
<el-dropdown-item command="small" :disabled="disabledSize === 'small'">{{
|
||||
$t("message.user.dropdownSmall")
|
||||
}}</el-dropdown-item>
|
||||
<el-dropdown-item command="mini" :disabled="disabledSize === 'mini'">{{
|
||||
$t("message.user.dropdownMini")
|
||||
}}</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
<el-dropdown
|
||||
:show-timeout="70"
|
||||
:hide-timeout="50"
|
||||
trigger="click"
|
||||
@command="onLanguageChange"
|
||||
>
|
||||
<div class="layout-navbars-breadcrumb-user-icon">
|
||||
<i
|
||||
class="iconfont"
|
||||
:class="disabledI18n === 'en' ? 'icon-fuhao-yingwen' : 'icon-fuhao-zhongwen'"
|
||||
:title="$t('message.user.title1')"
|
||||
></i>
|
||||
</div>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item command="zh-cn" :disabled="disabledI18n === 'zh-cn'"
|
||||
>简体中文</el-dropdown-item
|
||||
>
|
||||
<el-dropdown-item command="en" :disabled="disabledI18n === 'en'"
|
||||
>English</el-dropdown-item
|
||||
>
|
||||
<el-dropdown-item command="zh-tw" :disabled="disabledI18n === 'zh-tw'"
|
||||
>繁體中文</el-dropdown-item
|
||||
>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
<div class="layout-navbars-breadcrumb-user-icon" @click="onSearchClick">
|
||||
<i class="el-icon-search" :title="$t('message.user.title2')"></i>
|
||||
</div>
|
||||
<div class="layout-navbars-breadcrumb-user-icon" @click="onLayoutSetingClick">
|
||||
<i class="icon-skin iconfont" :title="$t('message.user.title3')"></i>
|
||||
</div>
|
||||
<div class="layout-navbars-breadcrumb-user-icon">
|
||||
<el-popover
|
||||
placement="bottom"
|
||||
trigger="click"
|
||||
v-model="isShowUserNewsPopover"
|
||||
:width="300"
|
||||
popper-class="el-popover-pupop-user-news"
|
||||
>
|
||||
<el-badge
|
||||
:is-dot="true"
|
||||
@click.stop="isShowUserNewsPopover = !isShowUserNewsPopover"
|
||||
slot="reference"
|
||||
>
|
||||
<i class="el-icon-bell" :title="$t('message.user.title4')"></i>
|
||||
</el-badge>
|
||||
<transition name="el-zoom-in-top">
|
||||
<UserNews v-show="isShowUserNewsPopover" />
|
||||
</transition>
|
||||
</el-popover>
|
||||
</div>
|
||||
<div class="layout-navbars-breadcrumb-user-icon mr10" @click="onScreenfullClick">
|
||||
<i
|
||||
class="iconfont"
|
||||
:title="isScreenfull ? $t('message.user.title6') : $t('message.user.title5')"
|
||||
:class="!isScreenfull ? 'icon-fullscreen' : 'icon-tuichuquanping'"
|
||||
></i>
|
||||
</div>
|
||||
<el-dropdown :show-timeout="70" :hide-timeout="50" @command="onDropdownCommand">
|
||||
<span class="layout-navbars-breadcrumb-user-link">
|
||||
<img
|
||||
:src="UserInformation.avatar"
|
||||
class="layout-navbars-breadcrumb-user-link-photo mr5"
|
||||
/>
|
||||
{{ UserInformation.name }}
|
||||
<i class="el-icon-arrow-down el-icon--right"></i>
|
||||
</span>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item command="/home">{{
|
||||
$t("message.user.dropdown1")
|
||||
}}</el-dropdown-item>
|
||||
<!-- <el-dropdown-item command="wareHouse">{{
|
||||
$t("message.user.dropdown6")
|
||||
}}</el-dropdown-item>
|
||||
<el-dropdown-item command="/personal">{{
|
||||
$t("message.user.dropdown2")
|
||||
}}</el-dropdown-item>
|
||||
<el-dropdown-item command="/404">{{
|
||||
$t("message.user.dropdown3")
|
||||
}}</el-dropdown-item>
|
||||
<el-dropdown-item command="/401">{{
|
||||
$t("message.user.dropdown4")
|
||||
}}</el-dropdown-item> -->
|
||||
<el-dropdown-item divided command="logOut">{{
|
||||
$t("message.user.dropdown5")
|
||||
}}</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
<Search ref="searchRef" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import screenfull from "screenfull";
|
||||
import { Session, Local } from "@/utils/storage.js";
|
||||
import UserNews from "@/layout/navBars/breadcrumb/userNews.vue";
|
||||
import Search from "@/layout/navBars/breadcrumb/search.vue";
|
||||
export default {
|
||||
name: "layoutBreadcrumbUser",
|
||||
components: { UserNews, Search },
|
||||
data() {
|
||||
return {
|
||||
isScreenfull: false,
|
||||
isShowUserNewsPopover: false,
|
||||
disabledI18n: "zh-cn",
|
||||
disabledSize: "",
|
||||
UserInformation: {},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 获取用户信息
|
||||
// getUserInfos() {
|
||||
// return this.$store.state.userInfos.userInfosDD;
|
||||
// },
|
||||
// 设置弹性盒子布局 flex
|
||||
layoutUserFlexNum() {
|
||||
let { layout, isClassicSplitMenu } = this.$store.state.themeConfig.themeConfig;
|
||||
let num = "";
|
||||
if (
|
||||
layout === "defaults" ||
|
||||
(layout === "classic" && !isClassicSplitMenu) ||
|
||||
layout === "columns"
|
||||
)
|
||||
num = 1;
|
||||
else num = null;
|
||||
return num;
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.resetUserInformation();
|
||||
if (Local.get("themeConfigPrev")) {
|
||||
this.initI18n();
|
||||
this.initComponentSize();
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 搜索点击
|
||||
onSearchClick() {
|
||||
this.$refs.searchRef.openSearch();
|
||||
},
|
||||
// 布局配置点击
|
||||
onLayoutSetingClick() {
|
||||
this.bus.$emit("openSetingsDrawer");
|
||||
},
|
||||
// 全屏点击
|
||||
onScreenfullClick() {
|
||||
if (!screenfull.isEnabled) {
|
||||
this.$message.warning("暂不不支持全屏");
|
||||
return false;
|
||||
}
|
||||
screenfull.toggle();
|
||||
screenfull.on("change", () => {
|
||||
if (screenfull.isFullscreen) this.isScreenfull = true;
|
||||
else this.isScreenfull = false;
|
||||
});
|
||||
// 监听菜单 horizontal.vue 滚动条高度更新
|
||||
this.bus.$emit("updateElScrollBar");
|
||||
},
|
||||
// 组件大小改变
|
||||
onComponentSizeChange(size) {
|
||||
Local.remove("themeConfigPrev");
|
||||
this.$store.state.themeConfig.themeConfig.globalComponentSize = size;
|
||||
Local.set("themeConfigPrev", this.$store.state.themeConfig.themeConfig);
|
||||
this.$ELEMENT.size = size;
|
||||
this.initComponentSize();
|
||||
window.location.reload();
|
||||
},
|
||||
// 语言切换
|
||||
onLanguageChange(lang) {
|
||||
Local.remove("themeConfigPrev");
|
||||
this.$store.state.themeConfig.themeConfig.globalI18n = lang;
|
||||
Local.set("themeConfigPrev", this.$store.state.themeConfig.themeConfig);
|
||||
this.$i18n.locale = lang;
|
||||
this.initI18n();
|
||||
},
|
||||
// 初始化言语国际化
|
||||
initI18n() {
|
||||
switch (Local.get("themeConfigPrev").globalI18n) {
|
||||
case "zh-cn":
|
||||
this.disabledI18n = "zh-cn";
|
||||
break;
|
||||
case "en":
|
||||
this.disabledI18n = "en";
|
||||
break;
|
||||
case "zh-tw":
|
||||
this.disabledI18n = "zh-tw";
|
||||
break;
|
||||
}
|
||||
},
|
||||
// 初始化全局组件大小
|
||||
initComponentSize() {
|
||||
switch (Local.get("themeConfigPrev").globalComponentSize) {
|
||||
case "":
|
||||
this.disabledSize = "";
|
||||
break;
|
||||
case "medium":
|
||||
this.disabledSize = "medium";
|
||||
break;
|
||||
case "small":
|
||||
this.disabledSize = "small";
|
||||
break;
|
||||
case "mini":
|
||||
this.disabledSize = "mini";
|
||||
break;
|
||||
}
|
||||
},
|
||||
// `dropdown 下拉菜单` 当前项点击
|
||||
onDropdownCommand(path) {
|
||||
if (path === "logOut") {
|
||||
setTimeout(() => {
|
||||
this.$msgbox({
|
||||
closeOnClickModal: false,
|
||||
closeOnPressEscape: false,
|
||||
title: this.$t("message.user.logOutTitle"),
|
||||
message: this.$t("message.user.logOutMessage"),
|
||||
showCancelButton: true,
|
||||
confirmButtonText: this.$t("message.user.logOutConfirm"),
|
||||
cancelButtonText: this.$t("message.user.logOutCancel"),
|
||||
beforeClose: (action, instance, done) => {
|
||||
if (action === "confirm") {
|
||||
instance.confirmButtonLoading = true;
|
||||
instance.confirmButtonText = this.$t("message.user.logOutExit");
|
||||
setTimeout(() => {
|
||||
done();
|
||||
setTimeout(() => {
|
||||
instance.confirmButtonLoading = false;
|
||||
}, 300);
|
||||
}, 700);
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
},
|
||||
})
|
||||
.then(() => {
|
||||
// 清除缓存/token等
|
||||
Session.clear();
|
||||
// 使用 reload 时,不需要调用 resetRoute() 重置路由
|
||||
window.location.reload();
|
||||
})
|
||||
.catch(() => {});
|
||||
}, 150);
|
||||
} else if (path === "wareHouse") {
|
||||
window.open("http://www.baidu.com");
|
||||
} else {
|
||||
this.$router.push(path);
|
||||
}
|
||||
},
|
||||
// 重置DD用户信息
|
||||
resetUserInformation() {
|
||||
let res = Session.get("userInfoDD");
|
||||
this.UserInformation = res;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.layout-navbars-breadcrumb-user {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
&-link {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
white-space: nowrap;
|
||||
&-photo {
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
border-radius: 100%;
|
||||
}
|
||||
}
|
||||
&-icon {
|
||||
padding: 0 10px;
|
||||
cursor: pointer;
|
||||
color: var(--prev-bg-topBarColor);
|
||||
height: 50px;
|
||||
line-height: 50px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
&:hover {
|
||||
background: var(--prev-color-hover);
|
||||
i {
|
||||
display: inline-block;
|
||||
animation: logoAnimation 0.3s ease-in-out;
|
||||
}
|
||||
}
|
||||
}
|
||||
& ::v-deep .el-dropdown {
|
||||
color: var(--prev-bg-topBarColor);
|
||||
}
|
||||
& ::v-deep .el-badge {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
& ::v-deep .el-badge__content.is-fixed {
|
||||
top: 12px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,130 @@
|
||||
<template>
|
||||
<div class="layout-navbars-breadcrumb-user-news">
|
||||
<div class="head-box">
|
||||
<div class="head-box-title">{{ $t("message.user.newTitle") }}</div>
|
||||
<div class="head-box-btn" v-if="newsList.length > 0" @click="onAllReadClick">
|
||||
{{ $t("message.user.newBtn") }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="content-box">
|
||||
<template v-if="newsList.length > 0">
|
||||
<div class="content-box-item" v-for="(v, k) in newsList" :key="k">
|
||||
<div>{{ v.label }}</div>
|
||||
<div class="content-box-msg">
|
||||
{{ v.value }}
|
||||
</div>
|
||||
<div class="content-box-time">{{ v.time }}</div>
|
||||
</div>
|
||||
</template>
|
||||
<div class="content-box-empty" v-else>
|
||||
<div class="content-box-empty-margin">
|
||||
<i class="el-icon-s-promotion"></i>
|
||||
<div class="mt15">{{ $t("message.user.newDesc") }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="foot-box" @click="onGoToGiteeClick" v-if="newsList.length > 0">
|
||||
{{ $t("message.user.newGo") }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "layoutBreadcrumbUserNews",
|
||||
data() {
|
||||
return {
|
||||
newsList: [
|
||||
{
|
||||
label: "暂无",
|
||||
value: "暂无",
|
||||
time: "2023-8-15",
|
||||
},
|
||||
{
|
||||
label: "暂无",
|
||||
value: "暂无",
|
||||
time: "2023-8-15",
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
// 全部已读点击
|
||||
onAllReadClick() {
|
||||
this.newsList = [];
|
||||
},
|
||||
// 前往通知中心点击
|
||||
onGoToGiteeClick() {
|
||||
window.open("https://www.baidu.com/");
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.layout-navbars-breadcrumb-user-news {
|
||||
.head-box {
|
||||
display: flex;
|
||||
border-bottom: 1px solid var(--prev-border-color-lighter);
|
||||
box-sizing: border-box;
|
||||
color: var(--prev-color-text-primary);
|
||||
justify-content: space-between;
|
||||
height: 35px;
|
||||
align-items: center;
|
||||
.head-box-btn {
|
||||
color: var(--prev-color-primary);
|
||||
font-size: 13px;
|
||||
cursor: pointer;
|
||||
opacity: 0.8;
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
.content-box {
|
||||
font-size: 13px;
|
||||
.content-box-item {
|
||||
padding-top: 12px;
|
||||
&:last-of-type {
|
||||
padding-bottom: 12px;
|
||||
}
|
||||
.content-box-msg {
|
||||
color: var(--prev-color-text-secondary);
|
||||
margin-top: 5px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.content-box-time {
|
||||
color: var(--prev-color-text-secondary);
|
||||
}
|
||||
}
|
||||
.content-box-empty {
|
||||
height: 260px;
|
||||
display: flex;
|
||||
.content-box-empty-margin {
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
i {
|
||||
font-size: 60px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.foot-box {
|
||||
height: 35px;
|
||||
color: var(--prev-color-primary);
|
||||
font-size: 13px;
|
||||
cursor: pointer;
|
||||
opacity: 0.8;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-top: 1px solid var(--prev-border-color-lighter);
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
::v-deep(.el-empty__description p) {
|
||||
font-size: 13px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,34 @@
|
||||
<template>
|
||||
<div class="layout-navbars-container">
|
||||
<BreadcrumbIndex />
|
||||
<TagsView v-if="setShowTagsView" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BreadcrumbIndex from '@/layout/navBars/breadcrumb/index.vue';
|
||||
import TagsView from '@/layout/navBars/tagsView/tagsView.vue';
|
||||
export default {
|
||||
name: 'layoutNavBars',
|
||||
components: { BreadcrumbIndex, TagsView },
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
computed: {
|
||||
// 设置是否显示 tagsView
|
||||
setShowTagsView() {
|
||||
let { layout, isTagsview } = this.$store.state.themeConfig.themeConfig;
|
||||
return layout !== 'classic' && isTagsview;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.layout-navbars-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,110 @@
|
||||
<template>
|
||||
<div>
|
||||
<transition name="el-zoom-in-center">
|
||||
<ul
|
||||
class="el-dropdown-menu el-popper el-dropdown-menu--medium custom-contextmenu"
|
||||
:style="`top: ${dropdowns.y}px;left: ${dropdowns.x}px;`"
|
||||
x-placement="bottom-end"
|
||||
id="contextmenu"
|
||||
v-show="isShow"
|
||||
>
|
||||
<li class="el-dropdown-menu__item" v-for="(v, k) in dropdownList" :key="k" @click="onCurrentContextmenuClick(v.id)">
|
||||
<template v-if="!v.affix">
|
||||
<i :class="v.icon"></i>
|
||||
<span>{{ $t(v.txt) }}</span>
|
||||
</template>
|
||||
</li>
|
||||
<div x-arrow class="popper__arrow" :style="{ left: `${arrowLeft}px` }"></div>
|
||||
</ul>
|
||||
</transition>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'layoutTagsViewContextmenu',
|
||||
props: {
|
||||
dropdown: {
|
||||
type: Object,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isShow: false,
|
||||
dropdownList: [
|
||||
{ id: 0, txt: 'message.tagsView.refresh', affix: false, icon: 'el-icon-refresh-right' },
|
||||
{ id: 1, txt: 'message.tagsView.close', affix: false, icon: 'el-icon-close' },
|
||||
{ id: 2, txt: 'message.tagsView.closeOther', affix: false, icon: 'el-icon-circle-close' },
|
||||
{ id: 3, txt: 'message.tagsView.closeAll', affix: false, icon: 'el-icon-folder-delete' },
|
||||
],
|
||||
path: {},
|
||||
arrowLeft: 5,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
dropdowns() {
|
||||
// 99 为 `Dropdown 下拉菜单` 的宽度
|
||||
if (this.dropdown.x + 99 > document.documentElement.clientWidth) {
|
||||
return {
|
||||
x: document.documentElement.clientWidth - 99 - 5,
|
||||
y: this.dropdown.y,
|
||||
};
|
||||
} else {
|
||||
return this.dropdown;
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
// 监听页面监听进行右键菜单的关闭
|
||||
document.body.addEventListener('click', this.closeContextmenu);
|
||||
},
|
||||
methods: {
|
||||
// 当前项菜单点击
|
||||
onCurrentContextmenuClick(id) {
|
||||
this.$emit('currentContextmenuClick', { id, path: this.path });
|
||||
},
|
||||
// 打开右键菜单:判断是否固定,固定则不显示关闭按钮
|
||||
openContextmenu(item) {
|
||||
this.path = item.path;
|
||||
item.meta.isAffix ? (this.dropdownList[1].affix = true) : (this.dropdownList[1].affix = false);
|
||||
this.closeContextmenu();
|
||||
setTimeout(() => {
|
||||
this.isShow = true;
|
||||
}, 80);
|
||||
},
|
||||
// 关闭右键菜单
|
||||
closeContextmenu() {
|
||||
this.isShow = false;
|
||||
},
|
||||
},
|
||||
destroyed() {
|
||||
// 页面卸载时,移除右键菜单监听事件
|
||||
document.body.removeEventListener('click', this.closeContextmenu);
|
||||
},
|
||||
// 监听下拉菜单位置
|
||||
watch: {
|
||||
dropdown: {
|
||||
handler({ x }) {
|
||||
if (x + 99 > document.documentElement.clientWidth) this.arrowLeft = 99 - (document.documentElement.clientWidth - x);
|
||||
else this.arrowLeft = 10;
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.custom-contextmenu {
|
||||
transform-origin: center top;
|
||||
z-index: 2190;
|
||||
position: fixed;
|
||||
.el-dropdown-menu__item {
|
||||
font-size: 12px !important;
|
||||
white-space: nowrap;
|
||||
i {
|
||||
font-size: 12px !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,404 @@
|
||||
<template>
|
||||
<div class="layout-navbars-tagsview">
|
||||
<el-scrollbar ref="scrollbarRef" @wheel.native.prevent="onHandleScroll">
|
||||
<ul class="layout-navbars-tagsview-ul" :class="setTagsStyle" ref="tagsUlRef">
|
||||
<li
|
||||
v-for="(v, k) in tagsViewList"
|
||||
:key="k"
|
||||
class="layout-navbars-tagsview-ul-li"
|
||||
:data-name="v.name"
|
||||
:class="{ 'is-active': v.path === tagsRoutePath }"
|
||||
@contextmenu.prevent="onContextmenu(v, $event)"
|
||||
@click="onTagsClick(v, k)"
|
||||
ref="tagsRefs"
|
||||
>
|
||||
<i class="iconfont icon-webicon318 layout-navbars-tagsview-ul-li-iconfont font14" v-if="v.path === tagsRoutePath"></i>
|
||||
<i
|
||||
class="layout-navbars-tagsview-ul-li-iconfont font14 is-tagsview-icon"
|
||||
:class="v.meta.icon"
|
||||
v-if="v.path !== tagsRoutePath && getThemeConfig.isTagsviewIcon"
|
||||
></i>
|
||||
<span>{{ $t(v.meta.title) }}</span>
|
||||
<i
|
||||
class="el-icon-refresh-right layout-navbars-tagsview-ul-li-icon ml5"
|
||||
v-if="v.path === tagsRoutePath"
|
||||
@click.stop="refreshCurrentTagsView(v.path)"
|
||||
></i>
|
||||
<i class="el-icon-close layout-navbars-tagsview-ul-li-icon ml5" v-if="!v.meta.isAffix" @click.stop="closeCurrentTagsView(v.path)"></i>
|
||||
</li>
|
||||
</ul>
|
||||
</el-scrollbar>
|
||||
<Contextmenu :dropdown="tagsDropdown" ref="tagsContextmenu" @currentContextmenuClick="onCurrentContextmenuClick" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Contextmenu from '@/layout/navBars/tagsView/contextmenu';
|
||||
import { Session } from '@/utils/storage.js';
|
||||
export default {
|
||||
name: 'tagsView',
|
||||
components: { Contextmenu },
|
||||
data() {
|
||||
return {
|
||||
userInfo: {},
|
||||
tagsViewList: [],
|
||||
tagsDropdown: {
|
||||
x: '',
|
||||
y: '',
|
||||
},
|
||||
tagsRefsIndex: 0,
|
||||
tagsRoutePath: this.$route.path,
|
||||
tagsViewRoutesList: [],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 获取布局配置信息
|
||||
getThemeConfig() {
|
||||
return this.$store.state.themeConfig.themeConfig;
|
||||
},
|
||||
// 动态设置 tagsView 风格样式
|
||||
setTagsStyle() {
|
||||
return this.$store.state.themeConfig.themeConfig.tagsStyle;
|
||||
},
|
||||
},
|
||||
created() {
|
||||
// 监听非本页面调用 0 刷新当前,1 关闭当前,2 关闭其它,3 关闭全部
|
||||
this.bus.$on('onCurrentContextmenuClick', (data) => {
|
||||
this.onCurrentContextmenuClick(data);
|
||||
});
|
||||
},
|
||||
mounted() {
|
||||
this.getTagsViewRoutes();
|
||||
},
|
||||
methods: {
|
||||
// 获取路由信息
|
||||
getRoutesList() {
|
||||
return this.$store.state.routesList.routesList;
|
||||
},
|
||||
// 当前的 tagsView 项点击时
|
||||
onTagsClick(v, k) {
|
||||
this.tagsRoutePath = v.path;
|
||||
this.tagsRefsIndex = k;
|
||||
this.$router.push(v);
|
||||
},
|
||||
// 获取 tagsView 的下标:用于处理 tagsView 点击时的横向滚动
|
||||
getTagsRefsIndex(path) {
|
||||
if (this.tagsViewList.length > 0) {
|
||||
this.tagsRefsIndex = this.tagsViewList.findIndex((item) => item.path === path);
|
||||
}
|
||||
},
|
||||
// 鼠标滚轮滚动
|
||||
onHandleScroll(e) {
|
||||
this.$refs.scrollbarRef.$refs.wrap.scrollLeft += e.wheelDelta / 4;
|
||||
},
|
||||
// tagsView 横向滚动
|
||||
tagsViewmoveToCurrentTag() {
|
||||
this.$nextTick(() => {
|
||||
const tagsRefs = this.$refs.tagsRefs;
|
||||
if (tagsRefs.length <= 0) return false;
|
||||
// 当前 li 元素
|
||||
let liDom = tagsRefs[this.tagsRefsIndex];
|
||||
// 当前 li 元素下标
|
||||
let liIndex = this.tagsRefsIndex;
|
||||
// 当前 ul 下 li 元素总长度
|
||||
let liLength = tagsRefs.length;
|
||||
// 最前 li
|
||||
let liFirst = tagsRefs[0];
|
||||
// 最后 li
|
||||
let liLast = tagsRefs[tagsRefs.length - 1];
|
||||
// 当前滚动条的值
|
||||
let scrollRefs = this.$refs.scrollbarRef.$refs.wrap;
|
||||
// 当前滚动条滚动宽度
|
||||
let scrollS = scrollRefs.scrollWidth;
|
||||
// 当前滚动条偏移宽度
|
||||
let offsetW = scrollRefs.offsetWidth;
|
||||
// 当前滚动条偏移距离
|
||||
let scrollL = scrollRefs.scrollLeft;
|
||||
// 上一个 tags li dom
|
||||
let liPrevTag = tagsRefs[this.tagsRefsIndex - 1];
|
||||
// 下一个 tags li dom
|
||||
let liNextTag = tagsRefs[this.tagsRefsIndex + 1];
|
||||
// 上一个 tags li dom 的偏移距离
|
||||
let beforePrevL = '';
|
||||
// 下一个 tags li dom 的偏移距离
|
||||
let afterNextL = '';
|
||||
if (liDom === liFirst) {
|
||||
// 头部
|
||||
scrollRefs.scrollLeft = 0;
|
||||
} else if (liDom === liLast) {
|
||||
// 尾部
|
||||
scrollRefs.scrollLeft = scrollS - offsetW;
|
||||
} else {
|
||||
// 非头/尾部
|
||||
if (liIndex === 0) beforePrevL = liFirst?.offsetLeft - 5;
|
||||
else beforePrevL = liPrevTag?.offsetLeft - 5;
|
||||
if (liIndex === liLength) afterNextL = liLast?.offsetLeft + liLast.offsetWidth + 5;
|
||||
else afterNextL = liNextTag?.offsetLeft + liNextTag.offsetWidth + 5;
|
||||
if (afterNextL > scrollL + offsetW) {
|
||||
scrollRefs.scrollLeft = afterNextL - offsetW;
|
||||
} else if (beforePrevL < scrollL) {
|
||||
scrollRefs.scrollLeft = beforePrevL;
|
||||
}
|
||||
}
|
||||
// 更新滚动条,防止不出现
|
||||
this.updateScrollbar();
|
||||
});
|
||||
},
|
||||
// 更新滚动条显示
|
||||
updateScrollbar() {
|
||||
this.$refs.scrollbarRef.update();
|
||||
},
|
||||
// 递归查找当前路径下的组件信息
|
||||
filterCurrentMenu(arr, currentPath, callback) {
|
||||
arr.map((item) => {
|
||||
if (item.path === currentPath) {
|
||||
callback(item);
|
||||
return false;
|
||||
}
|
||||
item = Object.assign({}, item);
|
||||
if (item.children) {
|
||||
item.children = this.filterCurrentMenu(item.children, currentPath, callback);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 数组对象去重
|
||||
duplicate(arr) {
|
||||
let newobj = {};
|
||||
arr = arr.reduce((preVal, curVal) => {
|
||||
newobj[curVal.path] ? '' : (newobj[curVal.path] = preVal.push(curVal));
|
||||
return preVal;
|
||||
}, []);
|
||||
return arr;
|
||||
},
|
||||
// 获取 vuex 中的 tagsViewRoutes 列表
|
||||
getTagsViewRoutes() {
|
||||
this.tagsRoutePath = this.$route.path;
|
||||
this.tagsViewList = [];
|
||||
if (!this.$store.state.themeConfig.themeConfig.isCacheTagsView) Session.remove('tagsViewList');
|
||||
this.tagsViewRoutesList = this.$store.state.tagsViewRoutes.tagsViewRoutes;
|
||||
this.initTagsViewList();
|
||||
},
|
||||
// 存储 tagsViewList 到浏览器临时缓存中,页面刷新时,保留记录
|
||||
addBrowserSetSession(tagsViewList) {
|
||||
Session.set('tagsViewList', tagsViewList);
|
||||
},
|
||||
// 初始化设置了 tagsView 数据
|
||||
initTagsViewList() {
|
||||
if (Session.get('tagsViewList') && this.$store.state.themeConfig.themeConfig.isCacheTagsView) {
|
||||
this.tagsViewList = Session.get('tagsViewList');
|
||||
} else {
|
||||
this.tagsViewRoutesList.map((v) => {
|
||||
if (v.meta.isAffix && !v.meta.isHide) this.tagsViewList.push({ ...v });
|
||||
});
|
||||
this.addTagsView(this.$route.path);
|
||||
}
|
||||
// 初始化当前元素(li)的下标
|
||||
this.getTagsRefsIndex(this.$route.path);
|
||||
// 添加初始化横向滚动条移动到对应位置
|
||||
this.tagsViewmoveToCurrentTag();
|
||||
},
|
||||
// 添加 tagsView:未设置隐藏(isHide)也添加到在 tagsView 中
|
||||
addTagsView(path, to) {
|
||||
if (this.tagsViewList.some((v) => v.path === path)) return false;
|
||||
const item = this.tagsViewRoutesList.find((v) => v.path === path);
|
||||
if (item.meta.isLink && !item.meta.isIframe) return false;
|
||||
item.query = to?.query ? to?.query : this.$route.query;
|
||||
this.tagsViewList.push({ ...item });
|
||||
this.addBrowserSetSession(this.tagsViewList);
|
||||
},
|
||||
// 右键菜单点击时显示菜单列表
|
||||
onContextmenu(v, e) {
|
||||
let { clientX, clientY } = e;
|
||||
this.tagsDropdown.x = clientX;
|
||||
this.tagsDropdown.y = clientY;
|
||||
this.$refs.tagsContextmenu.openContextmenu(v);
|
||||
},
|
||||
// 当前项右键菜单点击
|
||||
onCurrentContextmenuClick(data) {
|
||||
let { id, path } = data;
|
||||
let currentTag = this.tagsViewList.find((v) => v.path === path);
|
||||
switch (id) {
|
||||
case 0:
|
||||
this.refreshCurrentTagsView(path);
|
||||
this.$router.push({ path, query: currentTag.query });
|
||||
break;
|
||||
case 1:
|
||||
this.closeCurrentTagsView(path);
|
||||
break;
|
||||
case 2:
|
||||
this.$router.push({ path, query: currentTag.query });
|
||||
this.closeOtherTagsView(path);
|
||||
break;
|
||||
case 3:
|
||||
this.closeAllTagsView(path);
|
||||
break;
|
||||
}
|
||||
},
|
||||
// 1、刷新当前 tagsView:
|
||||
refreshCurrentTagsView(path) {
|
||||
this.bus.$emit('onTagsViewRefreshRouterView', path);
|
||||
},
|
||||
// 2、关闭当前 tagsView:当前项 `tags-view` icon 关闭时点击,如果是设置了固定的(isAffix),不可以关闭
|
||||
closeCurrentTagsView(path) {
|
||||
this.tagsViewList.map((v, k, arr) => {
|
||||
if (!v.meta.isAffix) {
|
||||
if (v.path === path) {
|
||||
this.tagsViewList.splice(k, 1);
|
||||
setTimeout(() => {
|
||||
// 最后一个
|
||||
if (this.tagsViewList.length === k) this.$router.push({ path: arr[arr.length - 1].path, query: arr[arr.length - 1].query });
|
||||
// 否则,跳转到下一个
|
||||
else this.$router.push({ path: arr[k].path, query: arr[k].query });
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
this.addBrowserSetSession(this.tagsViewList);
|
||||
},
|
||||
// 3、关闭其它 tagsView:如果是设置了固定的(isAffix),不进行关闭
|
||||
closeOtherTagsView(path) {
|
||||
this.tagsViewList = [];
|
||||
this.tagsViewRoutesList.map((v) => {
|
||||
if (v.meta.isAffix && !v.meta.isHide) this.tagsViewList.push({ ...v });
|
||||
});
|
||||
this.addTagsView(path);
|
||||
},
|
||||
// 4、关闭全部 tagsView:如果是设置了固定的(isAffix),不进行关闭
|
||||
closeAllTagsView(path) {
|
||||
this.tagsViewList = [];
|
||||
this.tagsViewRoutesList.map((v) => {
|
||||
if (v.meta.isAffix && !v.meta.isHide) {
|
||||
this.tagsViewList.push({ ...v });
|
||||
if (this.tagsViewList.some((v) => v.path === path)) this.$router.push({ path, query: this.$route.query });
|
||||
else this.$router.push({ path: v.path, query: this.$route.query });
|
||||
}
|
||||
});
|
||||
this.addBrowserSetSession(this.tagsViewList);
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
// 监听路由变化
|
||||
$route: {
|
||||
handler(to) {
|
||||
this.tagsRoutePath = to.path;
|
||||
this.addTagsView(to.path, to);
|
||||
this.getTagsRefsIndex(to.path);
|
||||
this.tagsViewmoveToCurrentTag();
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
},
|
||||
destroyed() {
|
||||
// 取消非本页面调用监听(fun/tagsView)
|
||||
this.bus.$off('onCurrentContextmenuClick');
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.layout-navbars-tagsview {
|
||||
flex: 1;
|
||||
background-color: var(--prev-bg-white);
|
||||
border-bottom: 1px solid var(--prev-border-color-lighter);
|
||||
& ::v-deep .is-vertical {
|
||||
display: none !important;
|
||||
}
|
||||
&-ul {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
height: 34px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
white-space: nowrap;
|
||||
color: var(--prev-color-text-regular);
|
||||
font-size: 12px;
|
||||
padding: 0 15px;
|
||||
&-li {
|
||||
height: 26px;
|
||||
line-height: 26px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border: 1px solid var(--prev-border-color-lighter);
|
||||
padding: 0 12px 0 15px;
|
||||
margin-right: 5px;
|
||||
border-radius: 2px;
|
||||
position: relative;
|
||||
z-index: 0;
|
||||
cursor: pointer;
|
||||
justify-content: space-between;
|
||||
transition: all 0.3s cubic-bezier(0.2, 1, 0.3, 1);
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
background: var(--prev-color-primary);
|
||||
z-index: -1;
|
||||
opacity: 0;
|
||||
transform: scale3d(0.7, 1, 1);
|
||||
transition: transform 0.3s, opacity 0.3s;
|
||||
transition-timing-function: cubic-bezier(0.2, 1, 0.3, 1);
|
||||
}
|
||||
&:hover {
|
||||
color: var(--prev-color-text-white);
|
||||
transition: all 0.3s cubic-bezier(0.2, 1, 0.3, 1);
|
||||
border-color: transparent;
|
||||
&::before {
|
||||
opacity: 1;
|
||||
transform: translate3d(0, 0, 0);
|
||||
border-radius: 2px;
|
||||
}
|
||||
.is-tagsview-icon {
|
||||
color: var(--prev-color-text-white);
|
||||
transition: all 0.3s cubic-bezier(0.2, 1, 0.3, 1);
|
||||
}
|
||||
}
|
||||
&-iconfont {
|
||||
position: relative;
|
||||
left: -5px;
|
||||
top: 1px;
|
||||
color: var(--prev-color-text-white);
|
||||
}
|
||||
&-icon {
|
||||
border-radius: 100%;
|
||||
position: relative;
|
||||
height: 14px;
|
||||
width: 14px;
|
||||
text-align: center;
|
||||
line-height: 14px;
|
||||
top: 1px;
|
||||
}
|
||||
.is-tagsview-icon {
|
||||
color: var(--prev-color-text-regular);
|
||||
transition: all 0.3s cubic-bezier(0.2, 1, 0.3, 1);
|
||||
}
|
||||
}
|
||||
.is-active {
|
||||
color: var(--prev-color-text-white);
|
||||
transition: all 0.3s cubic-bezier(0.2, 1, 0.3, 1);
|
||||
border-color: transparent;
|
||||
&::before {
|
||||
opacity: 1;
|
||||
transform: translate3d(0, 0, 0);
|
||||
border-radius: 2px;
|
||||
}
|
||||
}
|
||||
}
|
||||
& ::-webkit-scrollbar {
|
||||
display: none !important;
|
||||
}
|
||||
// // 风格2
|
||||
// .tags-style-two {
|
||||
// }
|
||||
// // 风格3
|
||||
// .tags-style-three {
|
||||
// }
|
||||
// // 风格4
|
||||
// .tags-style-four {
|
||||
// }
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,138 @@
|
||||
<template>
|
||||
<div class="el-menu-horizontal-warp">
|
||||
<el-scrollbar @wheel.native.prevent="onElMenuHorizontalScroll" ref="elMenuHorizontalScrollRef">
|
||||
<el-menu router :default-active="defaultActive" background-color="transparent" mode="horizontal" @select="onHorizontalSelect">
|
||||
<template v-for="val in menuList">
|
||||
<el-submenu :index="val.path" v-if="val.children && val.children.length > 0" :key="val.path">
|
||||
<template slot="title">
|
||||
<i :class="val.meta.icon ? val.meta.icon : ''"></i>
|
||||
<span>{{ $t(val.meta.title) }}</span>
|
||||
</template>
|
||||
<SubItem :chil="val.children" />
|
||||
</el-submenu>
|
||||
<template v-else>
|
||||
<el-menu-item :index="val.path" :key="val.path">
|
||||
<template slot="title" v-if="!val.meta.isLink || (val.meta.isLink && val.meta.isIframe)">
|
||||
<i :class="val.meta.icon ? val.meta.icon : ''"></i>
|
||||
{{ $t(val.meta.title) }}
|
||||
</template>
|
||||
<template slot="title" v-else>
|
||||
<a :href="val.meta.isLink" target="_blank">
|
||||
<i :class="val.meta.icon ? val.meta.icon : ''"></i>
|
||||
{{ $t(val.meta.title) }}
|
||||
</a>
|
||||
</template>
|
||||
</el-menu-item>
|
||||
</template>
|
||||
</template>
|
||||
</el-menu>
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import SubItem from '@/layout/navMenu/subItem.vue';
|
||||
export default {
|
||||
name: 'navMenuHorizontal',
|
||||
components: { SubItem },
|
||||
props: {
|
||||
menuList: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
defaultActive: null,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.initElMenuOffsetLeft();
|
||||
this.setCurrentRouterHighlight(this.$route.path);
|
||||
},
|
||||
methods: {
|
||||
// 设置横向滚动条可以鼠标滚轮滚动
|
||||
onElMenuHorizontalScroll(e) {
|
||||
const eventDelta = e.wheelDelta || -e.deltaY * 40;
|
||||
this.$refs.elMenuHorizontalScrollRef.$refs.wrap.scrollLeft = this.$refs.elMenuHorizontalScrollRef.$refs.wrap.scrollLeft + eventDelta / 4;
|
||||
},
|
||||
// 初始化数据,页面刷新时,滚动条滚动到对应位置
|
||||
initElMenuOffsetLeft() {
|
||||
this.$nextTick(() => {
|
||||
let els = document.querySelector('.el-menu.el-menu--horizontal li.is-active');
|
||||
if (!els) return false;
|
||||
this.$refs.elMenuHorizontalScrollRef.$refs.wrap.scrollLeft = els.offsetLeft;
|
||||
});
|
||||
},
|
||||
// 路由过滤递归函数
|
||||
filterRoutesFun(arr) {
|
||||
return arr
|
||||
.filter((item) => !item.meta.isHide)
|
||||
.map((item) => {
|
||||
item = Object.assign({}, item);
|
||||
if (item.children) item.children = this.filterRoutesFun(item.children);
|
||||
return item;
|
||||
});
|
||||
},
|
||||
// 传送当前子级数据到菜单中
|
||||
setSendClassicChildren(path) {
|
||||
const currentPathSplit = path.split('/');
|
||||
let currentData = {};
|
||||
this.filterRoutesFun(this.$store.state.routesList.routesList).map((v, k) => {
|
||||
if (v.path === `/${currentPathSplit[1]}`) {
|
||||
v['k'] = k;
|
||||
currentData['item'] = [{ ...v }];
|
||||
currentData['children'] = [{ ...v }];
|
||||
if (v.children) currentData['children'] = v.children;
|
||||
}
|
||||
});
|
||||
return currentData;
|
||||
},
|
||||
// 菜单激活回调
|
||||
onHorizontalSelect(path) {
|
||||
this.bus.$emit('setSendClassicChildren', this.setSendClassicChildren(path));
|
||||
},
|
||||
// 设置页面当前路由高亮
|
||||
setCurrentRouterHighlight(path) {
|
||||
const currentPathSplit = path.split('/');
|
||||
if (this.$store.state.themeConfig.themeConfig.layout === 'classic') {
|
||||
this.defaultActive = `/${currentPathSplit[1]}`;
|
||||
} else {
|
||||
this.defaultActive = path;
|
||||
}
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
// 监听路由的变化
|
||||
$route: {
|
||||
handler(to) {
|
||||
this.setCurrentRouterHighlight(to.path);
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.el-menu-horizontal-warp {
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
margin-right: 30px;
|
||||
::v-deep .el-scrollbar__bar.is-vertical {
|
||||
display: none;
|
||||
}
|
||||
::v-deep .el-scrollbar__wrap {
|
||||
overflow-y: hidden !important;
|
||||
}
|
||||
::v-deep a {
|
||||
width: 100%;
|
||||
}
|
||||
.el-menu.el-menu--horizontal {
|
||||
display: flex;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,41 @@
|
||||
<template>
|
||||
<div>
|
||||
<template v-for="val in chil">
|
||||
<el-submenu :index="val.path" :key="val.path" v-if="val.children && val.children.length > 0">
|
||||
<template slot="title">
|
||||
<i :class="val.meta.icon"></i>
|
||||
<span>{{ $t(val.meta.title) }}</span>
|
||||
</template>
|
||||
<sub-item :chil="val.children" />
|
||||
</el-submenu>
|
||||
<template v-else>
|
||||
<el-menu-item :index="val.path" :key="val.path">
|
||||
<template v-if="!val.meta.isLink || (val.meta.isLink && val.meta.isIframe)">
|
||||
<i :class="val.meta.icon ? val.meta.icon : ''"></i>
|
||||
<span>{{ $t(val.meta.title) }}</span>
|
||||
</template>
|
||||
<template v-else>
|
||||
<a :href="val.meta.isLink" target="_blank">
|
||||
<i :class="val.meta.icon ? val.meta.icon : ''"></i>
|
||||
{{ $t(val.meta.title) }}
|
||||
</a>
|
||||
</template>
|
||||
</el-menu-item>
|
||||
</template>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'subItem',
|
||||
props: {
|
||||
chil: {
|
||||
type: Array,
|
||||
default() {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,73 @@
|
||||
<template>
|
||||
<el-menu
|
||||
router
|
||||
background-color="transparent"
|
||||
:default-active="defaultActive"
|
||||
:collapse="setIsCollapse"
|
||||
:unique-opened="getThemeConfig.isUniqueOpened"
|
||||
:collapse-transition="false"
|
||||
>
|
||||
<template v-for="val in menuList">
|
||||
<el-submenu :index="val.path" v-if="val.children && val.children.length > 0" :key="val.path">
|
||||
<template slot="title">
|
||||
<i :class="val.meta.icon ? val.meta.icon : ''"></i>
|
||||
<span>{{ $t(val.meta.title) }}</span>
|
||||
</template>
|
||||
<SubItem :chil="val.children" />
|
||||
</el-submenu>
|
||||
<template v-else>
|
||||
<el-menu-item :index="val.path" :key="val.path">
|
||||
<i :class="val.meta.icon ? val.meta.icon : ''"></i>
|
||||
<template slot="title" v-if="!val.meta.isLink || (val.meta.isLink && val.meta.isIframe)">
|
||||
<span>{{ $t(val.meta.title) }}</span>
|
||||
</template>
|
||||
<template slot="title" v-else>
|
||||
<a :href="val.meta.isLink" target="_blank">{{ $t(val.meta.title) }}</a>
|
||||
</template>
|
||||
</el-menu-item>
|
||||
</template>
|
||||
</template>
|
||||
</el-menu>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import SubItem from '@/layout/navMenu/subItem.vue';
|
||||
export default {
|
||||
name: 'navMenuVertical',
|
||||
components: { SubItem },
|
||||
props: {
|
||||
menuList: {
|
||||
type: Array,
|
||||
default() {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
defaultActive: this.$route.path,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 获取布局配置信息
|
||||
getThemeConfig() {
|
||||
return this.$store.state.themeConfig.themeConfig;
|
||||
},
|
||||
// 设置左侧菜单是否展开/收起
|
||||
setIsCollapse() {
|
||||
return document.body.clientWidth < 1000 ? false : this.$store.state.themeConfig.themeConfig.isCollapse;
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
// 监听路由的变化
|
||||
$route: {
|
||||
handler(to) {
|
||||
this.defaultActive = to.path;
|
||||
const clientWidth = document.body.clientWidth;
|
||||
if (clientWidth < 1000) this.$store.state.themeConfig.themeConfig.isCollapse = false;
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,46 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="layout-view-bg-white flex h100" v-loading="iframeLoading">
|
||||
<iframe :src="meta.isLink" frameborder="0" height="100%" width="100%" id="iframe"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'layoutIfameView',
|
||||
props: {
|
||||
meta: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
iframeLoading: true,
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.bus.$on('onTagsViewRefreshRouterView', (path) => {
|
||||
if (this.$route.path !== path) return false;
|
||||
this.$emit('getCurrentRouteMeta');
|
||||
});
|
||||
},
|
||||
mounted() {
|
||||
this.initIframeLoad();
|
||||
},
|
||||
methods: {
|
||||
// 初始化页面加载 loading
|
||||
initIframeLoad() {
|
||||
this.$nextTick(() => {
|
||||
this.iframeLoading = true;
|
||||
const iframe = document.getElementById('iframe');
|
||||
if (!iframe) return false;
|
||||
iframe.onload = () => {
|
||||
this.iframeLoading = false;
|
||||
};
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,83 @@
|
||||
<template>
|
||||
<div class="layout-scrollbar layout-link-container">
|
||||
<div class="layout-view-bg-white flex layout-view-link">
|
||||
<div class="layout-link-warp">
|
||||
<i class="layout-link-icon iconfont icon-xingqiu"></i>
|
||||
<div class="layout-link-msg">页面 "{{ $t(meta.title) }}" 已在新窗口中打开</div>
|
||||
<el-button class="mt30" round size="small" @click="onGotoFullPage">
|
||||
<i class="iconfont icon-lianjie"></i>
|
||||
<span>立即前往体验</span>
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { verifyUrl } from '@/utils/toolsValidate';
|
||||
export default {
|
||||
name: 'layoutLinkView',
|
||||
props: {
|
||||
meta: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
// 立即前往
|
||||
onGotoFullPage() {
|
||||
const { origin, pathname } = window.location;
|
||||
if (verifyUrl(this.meta.isLink)) window.open(this.meta.isLink);
|
||||
else window.open(`${origin}${pathname}#${this.meta.isLink}`);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.layout-link-container {
|
||||
.layout-link-warp {
|
||||
margin: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
i.layout-link-icon {
|
||||
position: relative;
|
||||
font-size: 100px;
|
||||
color: var(--prev-color-primary);
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 50px;
|
||||
top: 0;
|
||||
width: 15px;
|
||||
height: 100px;
|
||||
background: linear-gradient(
|
||||
rgba(255, 255, 255, 0.01),
|
||||
rgba(255, 255, 255, 0.01),
|
||||
rgba(255, 255, 255, 0.01),
|
||||
rgba(255, 255, 255, 0.05),
|
||||
rgba(255, 255, 255, 0.05),
|
||||
rgba(255, 255, 255, 0.05),
|
||||
rgba(235, 255, 255, 0.5),
|
||||
rgba(255, 255, 255, 0.05),
|
||||
rgba(255, 255, 255, 0.05),
|
||||
rgba(255, 255, 255, 0.05),
|
||||
rgba(255, 255, 255, 0.01),
|
||||
rgba(255, 255, 255, 0.01),
|
||||
rgba(255, 255, 255, 0.01)
|
||||
);
|
||||
transform: rotate(-15deg);
|
||||
animation: toRight 5s linear infinite;
|
||||
}
|
||||
}
|
||||
.layout-link-msg {
|
||||
font-size: 12px;
|
||||
color: var(--prev-bg-topBarColor);
|
||||
opacity: 0.7;
|
||||
margin-top: 15px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,47 @@
|
||||
<template>
|
||||
<div class="h100">
|
||||
<transition :name="setTransitionName" mode="out-in">
|
||||
<keep-alive :include="keepAliveNameList">
|
||||
<router-view :key="refreshRouterViewKey" />
|
||||
</keep-alive>
|
||||
</transition>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'parent',
|
||||
data() {
|
||||
return {
|
||||
refreshRouterViewKey: null,
|
||||
keepAliveNameList: [],
|
||||
keepAliveNameNewList: [],
|
||||
};
|
||||
},
|
||||
created() {
|
||||
// 页面加载前,处理缓存,页面刷新时路由缓存处理
|
||||
this.keepAliveNameList = this.getKeepAliveNames();
|
||||
this.bus.$on('onTagsViewRefreshRouterView', (path) => {
|
||||
if (this.$route.path !== path) return false;
|
||||
this.keepAliveNameList = this.getKeepAliveNames().filter((name) => this.$route.name !== name);
|
||||
this.refreshRouterViewKey = this.$route.path;
|
||||
this.$nextTick(() => {
|
||||
this.refreshRouterViewKey = null;
|
||||
this.keepAliveNameList = this.getKeepAliveNames();
|
||||
});
|
||||
});
|
||||
},
|
||||
computed: {
|
||||
// 设置主界面切换动画
|
||||
setTransitionName() {
|
||||
return this.$store.state.themeConfig.themeConfig.animation;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
// 获取路由缓存列表(name),默认路由全部缓存
|
||||
getKeepAliveNames() {
|
||||
return this.$store.state.keepAliveNames.keepAliveNames;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,123 @@
|
||||
<template>
|
||||
<div
|
||||
class="sponsors-container"
|
||||
title="点击前往体验"
|
||||
v-show="sponsors.isShow"
|
||||
@click="onSponsorsClick"
|
||||
>
|
||||
<el-carousel
|
||||
height="240px"
|
||||
indicator-position="none"
|
||||
:arrow="setCarouselShow"
|
||||
@change="onCarouselChange"
|
||||
>
|
||||
<el-carousel-item v-for="(v, k) in sponsors.list" :key="k">
|
||||
<img :src="v.url" class="sponsors-img" />
|
||||
<div class="sponsors-text" v-html="v.text"></div>
|
||||
</el-carousel-item>
|
||||
</el-carousel>
|
||||
<div class="sponsors-close" title="关闭赞助商" @click.stop="onCloseSponsors">
|
||||
<i class="el-icon-close"></i>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import sponsorsOne from "@/assets/ccflowRightNextAdmin.png";
|
||||
export default {
|
||||
name: "layoutSponsors",
|
||||
data() {
|
||||
return {
|
||||
sponsors: {
|
||||
list: [
|
||||
{
|
||||
url: sponsorsOne,
|
||||
text: `自创建鼎盛无际后台管理系统模板`,
|
||||
link: "http://www.ccflow.org/",
|
||||
},
|
||||
],
|
||||
isShow: false,
|
||||
index: 0,
|
||||
},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 设置轮播图箭头显示
|
||||
setCarouselShow() {
|
||||
return this.sponsors.list.length <= 1 ? "never" : "hover";
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
// 关闭赞助商
|
||||
onCloseSponsors() {
|
||||
this.sponsors.isShow = false;
|
||||
},
|
||||
// 轮播图改变时
|
||||
onCarouselChange(e) {
|
||||
this.sponsors.index = e;
|
||||
},
|
||||
// 当前项内容点击
|
||||
onSponsorsClick() {
|
||||
window.open(this.sponsors.list[this.sponsors.index].link);
|
||||
},
|
||||
// 延迟显示,防止影响其它界面加载
|
||||
delayShow() {
|
||||
setTimeout(() => {
|
||||
this.sponsors.isShow = true;
|
||||
}, 3000);
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.delayShow();
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.sponsors-container {
|
||||
position: fixed;
|
||||
right: 15px;
|
||||
bottom: 15px;
|
||||
z-index: 3;
|
||||
width: 200px;
|
||||
background-color: var(--prev-bg-main-color);
|
||||
box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.12);
|
||||
border-radius: 5px;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
.sponsors-img {
|
||||
width: 100%;
|
||||
height: 80px;
|
||||
}
|
||||
.sponsors-text {
|
||||
padding: 10px;
|
||||
color: var(--prev-color-text-regular);
|
||||
font-size: 14px;
|
||||
}
|
||||
.sponsors-close {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
border-radius: 100%;
|
||||
background: rgba(0, 0, 0, 0.05);
|
||||
transition: all 0.3s ease;
|
||||
position: absolute;
|
||||
right: -35px;
|
||||
bottom: -35px;
|
||||
z-index: 5;
|
||||
i {
|
||||
position: absolute;
|
||||
left: 9px;
|
||||
top: 9px;
|
||||
color: #afafaf;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
&:hover {
|
||||
transition: all 0.3s ease;
|
||||
i {
|
||||
color: var(--prev-color-primary);
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,164 @@
|
||||
<template>
|
||||
<div class="upgrade-dialog">
|
||||
<el-dialog
|
||||
:visible.sync="isUpgrade"
|
||||
width="300px"
|
||||
destroy-on-close
|
||||
:show-close="false"
|
||||
:close-on-click-modal="false"
|
||||
:close-on-press-escape="false"
|
||||
>
|
||||
<div class="upgrade-title">
|
||||
<div class="upgrade-title-warp">
|
||||
<span class="upgrade-title-warp-txt">{{ $t("message.upgrade.title") }}</span>
|
||||
<span class="upgrade-title-warp-version">{{ version }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="upgrade-content">
|
||||
{{ getThemeConfig.globalTitle }} {{ $t("message.upgrade.msg") }}
|
||||
<div class="mt5">
|
||||
<el-link
|
||||
type="primary"
|
||||
class="font12"
|
||||
href="https://gitee.com/lyt-top/vue-next-admin/blob/vue-prev-admin/CHANGELOG.md"
|
||||
target="_black"
|
||||
>
|
||||
CHANGELOG.md
|
||||
</el-link>
|
||||
</div>
|
||||
<div class="upgrade-content-desc mt5">{{ $t("message.upgrade.desc") }}</div>
|
||||
</div>
|
||||
<div class="upgrade-btn">
|
||||
<el-button round size="small" @click="onCancel">{{
|
||||
$t("message.upgrade.btnOne")
|
||||
}}</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
disabled="disabled"
|
||||
round
|
||||
size="small"
|
||||
@click="onUpgrade"
|
||||
:loading="isLoading"
|
||||
>{{ btnTxt }}</el-button
|
||||
>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { Local } from "@/utils/storage";
|
||||
import config from "/package.json";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
isUpgrade: false,
|
||||
version: config.version,
|
||||
isLoading: false,
|
||||
btnTxt: "",
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 获取布局配置信息
|
||||
getThemeConfig() {
|
||||
return this.$store.state.themeConfig.themeConfig;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
// 残忍拒绝
|
||||
onCancel() {
|
||||
this.isUpgrade = false;
|
||||
},
|
||||
// 马上更新
|
||||
onUpgrade() {
|
||||
this.isLoading = true;
|
||||
this.btnTxt = this.$t("message.upgrade.btnTwoLoading");
|
||||
setTimeout(() => {
|
||||
Local.clear();
|
||||
window.location.reload();
|
||||
Local.set("version", this.version);
|
||||
}, 2000);
|
||||
},
|
||||
// 延迟显示,防止刷新时界面显示太快
|
||||
delayShow() {
|
||||
setTimeout(() => {
|
||||
this.isUpgrade = true;
|
||||
}, 2000);
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.delayShow();
|
||||
setTimeout(() => {
|
||||
this.btnTxt = this.$t("message.upgrade.btnTwo");
|
||||
}, 200);
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.upgrade-dialog {
|
||||
& ::v-deep .el-dialog {
|
||||
.el-dialog__body {
|
||||
padding: 0 !important;
|
||||
}
|
||||
.el-dialog__header {
|
||||
display: none !important;
|
||||
}
|
||||
.upgrade-title {
|
||||
text-align: center;
|
||||
height: 130px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: relative;
|
||||
&::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
background-color: var(--prev-color-primary-light-1);
|
||||
width: 130%;
|
||||
height: 130px;
|
||||
border-bottom-left-radius: 100%;
|
||||
border-bottom-right-radius: 100%;
|
||||
}
|
||||
.upgrade-title-warp {
|
||||
z-index: 1;
|
||||
position: relative;
|
||||
.upgrade-title-warp-txt {
|
||||
color: var(--prev-color-text-white);
|
||||
font-size: 22px;
|
||||
letter-spacing: 3px;
|
||||
}
|
||||
.upgrade-title-warp-version {
|
||||
background-color: var(--prev-color-primary-light-4);
|
||||
color: var(--prev-color-text-white);
|
||||
font-size: 12px;
|
||||
position: absolute;
|
||||
display: flex;
|
||||
top: -2px;
|
||||
right: -50px;
|
||||
padding: 2px 4px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.upgrade-content {
|
||||
padding: 20px;
|
||||
line-height: 22px;
|
||||
color: var(--prev-color-text-regular);
|
||||
.upgrade-content-desc {
|
||||
color: var(--prev-color-text-placeholder);
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
.upgrade-btn {
|
||||
border-top: 1px solid var(--prev-border-color-lighter);
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
padding: 15px 20px;
|
||||
.el-button {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user