Commit 6810631f by liimin

4级菜单及样式优化

1 parent 6399a7da
......@@ -17,7 +17,7 @@
"gltracker": "^0.1.3",
"md5": "^2.3.0",
"nprogress": "^0.2.0",
"qiankun": "^2.10.5",
"qiankun": "^2.10.13",
"vue": "2.6.11",
"vue-router": "^3.5.3",
"vuex": "^3.4.0"
......@@ -9046,9 +9046,9 @@
}
},
"node_modules/import-html-entry": {
"version": "1.14.6",
"resolved": "https://registry.npmjs.org/import-html-entry/-/import-html-entry-1.14.6.tgz",
"integrity": "sha512-5MQkbwIr8n/bXOoE05M5/Nm0lnHO46vnb3D6svSvtVwpDqwhd/X14zjLcU31QWZ6gL8rUXNzj6vKHx4yOUL6gQ==",
"version": "1.15.1",
"resolved": "https://registry.npmjs.org/import-html-entry/-/import-html-entry-1.15.1.tgz",
"integrity": "sha512-flVVS3lQTaHUUEF/zByio0WHdJRMNwT/1sI48/ps9VVGWNn+oE1wuX+fBRZkXLKAeggVVmfU41MpgNnZ7I9nRg==",
"dependencies": {
"@babel/runtime": "^7.7.2"
}
......@@ -15004,12 +15004,12 @@
}
},
"node_modules/qiankun": {
"version": "2.10.5",
"resolved": "https://registry.npmjs.org/qiankun/-/qiankun-2.10.5.tgz",
"integrity": "sha512-mNbneqQzdKXpgB1K/mCO3MIXsdXwzcvxU07cUQCSljeyga3LWlI9L+clirmoaj7+UK6tylhhVQ55RyFJngh3ZQ==",
"version": "2.10.13",
"resolved": "https://registry.npmjs.org/qiankun/-/qiankun-2.10.13.tgz",
"integrity": "sha512-US861R2do2DMCU/BT1TEa3ccFHfCJtcu9Qs7Ytxax8sLNtPQLZpzBW3Itt9XjhBwL8q4F6nMg8WzYl/qczGT4Q==",
"dependencies": {
"@babel/runtime": "^7.10.5",
"import-html-entry": "^1.14.5",
"import-html-entry": "^1.14.6",
"lodash": "^4.17.11",
"single-spa": "^5.9.2"
}
......@@ -16318,9 +16318,9 @@
"dev": true
},
"node_modules/single-spa": {
"version": "5.9.4",
"resolved": "https://registry.npmjs.org/single-spa/-/single-spa-5.9.4.tgz",
"integrity": "sha512-QkEoh0AzGuU82qnbUUk0ydF78QbU5wMKqKKJn7uUQfBiOYlRQEfIOpLM4m23Sab+kTOLI1kbYhYeiQ7fX5KVVw=="
"version": "5.9.5",
"resolved": "https://registry.npmjs.org/single-spa/-/single-spa-5.9.5.tgz",
"integrity": "sha512-9SQdmsyz4HSP+3gs6PJzhkaMEg+6zTlu9oxIghnwUX3eq+ajq4ft5egl0iyR55LAmO/UwvU8NgIWs/ZyQMa6dw=="
},
"node_modules/sirv": {
"version": "1.0.19",
......@@ -26919,9 +26919,9 @@
}
},
"import-html-entry": {
"version": "1.14.6",
"resolved": "https://registry.npmjs.org/import-html-entry/-/import-html-entry-1.14.6.tgz",
"integrity": "sha512-5MQkbwIr8n/bXOoE05M5/Nm0lnHO46vnb3D6svSvtVwpDqwhd/X14zjLcU31QWZ6gL8rUXNzj6vKHx4yOUL6gQ==",
"version": "1.15.1",
"resolved": "https://registry.npmjs.org/import-html-entry/-/import-html-entry-1.15.1.tgz",
"integrity": "sha512-flVVS3lQTaHUUEF/zByio0WHdJRMNwT/1sI48/ps9VVGWNn+oE1wuX+fBRZkXLKAeggVVmfU41MpgNnZ7I9nRg==",
"requires": {
"@babel/runtime": "^7.7.2"
}
......@@ -31562,12 +31562,12 @@
"dev": true
},
"qiankun": {
"version": "2.10.5",
"resolved": "https://registry.npmjs.org/qiankun/-/qiankun-2.10.5.tgz",
"integrity": "sha512-mNbneqQzdKXpgB1K/mCO3MIXsdXwzcvxU07cUQCSljeyga3LWlI9L+clirmoaj7+UK6tylhhVQ55RyFJngh3ZQ==",
"version": "2.10.13",
"resolved": "https://registry.npmjs.org/qiankun/-/qiankun-2.10.13.tgz",
"integrity": "sha512-US861R2do2DMCU/BT1TEa3ccFHfCJtcu9Qs7Ytxax8sLNtPQLZpzBW3Itt9XjhBwL8q4F6nMg8WzYl/qczGT4Q==",
"requires": {
"@babel/runtime": "^7.10.5",
"import-html-entry": "^1.14.5",
"import-html-entry": "^1.14.6",
"lodash": "^4.17.11",
"single-spa": "^5.9.2"
}
......@@ -32619,9 +32619,9 @@
}
},
"single-spa": {
"version": "5.9.4",
"resolved": "https://registry.npmjs.org/single-spa/-/single-spa-5.9.4.tgz",
"integrity": "sha512-QkEoh0AzGuU82qnbUUk0ydF78QbU5wMKqKKJn7uUQfBiOYlRQEfIOpLM4m23Sab+kTOLI1kbYhYeiQ7fX5KVVw=="
"version": "5.9.5",
"resolved": "https://registry.npmjs.org/single-spa/-/single-spa-5.9.5.tgz",
"integrity": "sha512-9SQdmsyz4HSP+3gs6PJzhkaMEg+6zTlu9oxIghnwUX3eq+ajq4ft5egl0iyR55LAmO/UwvU8NgIWs/ZyQMa6dw=="
},
"sirv": {
"version": "1.0.19",
......@@ -18,7 +18,7 @@
"gltracker": "^0.1.3",
"md5": "^2.3.0",
"nprogress": "^0.2.0",
"qiankun": "^2.10.5",
"qiankun": "^2.10.13",
"vue": "2.6.11",
"vue-router": "^3.5.3",
"vuex": "^3.4.0"
......
......@@ -36,7 +36,7 @@ export default {
// 统一边距 begin
#app {
background-color: transparent !important;
padding: 16px $left !important;
padding: 8px $left !important;
margin: 0 !important;
position: relative !important;
}
......
......@@ -17,9 +17,9 @@ export default {
name: 'GLBreadcrumb2',
computed: {
page() {
const { id, hidden, title: pageTitle = '', name } = this.app.currentPage || {}
const { id, hidden, title: pageTitle = '' } = this.app.currentPage || {}
const isShowBack = id?.split('-').length > 2 && hidden
const title = name === 'HomeHomeIndex' ? '首页' : decodeURI(pageTitle)
const title = decodeURI(pageTitle)
return { isShowBack, title }
},
...mapGetters(['app', 'auth'])
......
<template>
<div class="com-left-side-menu-lv2">
<GLScroll class="com-left-side-menu-lv2-scroll-y">
<!-- <div class="menu-wrap"> -->
<el-menu class="flex-1 none-border" background-color="#fff" active-text-color="#409EFF" text-color="#999" :default-openeds="cur.openeds" :default-active="cur.active" :collapse-transition="false">
<LeftSideMenuLv2Item></LeftSideMenuLv2Item>
</el-menu>
<!-- </div> -->
</GLScroll>
</div>
</template>
<script>
import { mapActions, mapGetters } from 'vuex'
import { currentId } from './mixins/index'
export default {
name: 'LeftSideMenuLv2',
......@@ -19,17 +16,14 @@ export default {
inject: ['bus'],
created() {
this.bus.$on('current', this.handleCurrentChange)
this.bus.$on('menuChanged', this.handleMenuChanged)
},
computed: {
...mapGetters(['app', 'menu'])
this.bus.$on('menuOpenedsChanged', this.handleMenuOpenedsChanged)
},
mounted() {
this.handleCurrentChange(this.current)
},
beforeDestroy() {
this.bus.$off('current', this.handleCurrentChange)
this.bus.$off('menuChanged', this.handleMenuChanged)
this.bus.$off('menuOpenedsChanged', this.handleMenuOpenedsChanged)
},
data() {
return {
......@@ -40,20 +34,17 @@ export default {
}
},
methods: {
...mapActions('menu', ['setOpenId', 'setHoverId']),
open(index) {
this.setOpenId(index)
},
close() {
this.setOpenId('')
// this.setHoverId('')
},
handleCurrentChange({ lv1, lv2, lv3 }) {
this.cur.active = `${lv1}-${lv2}-${lv3}`
},
handleMenuChanged({ menus, isReload }) {
if (isReload) return
this.cur.openeds = menus.map(({ id }) => id)
handleMenuOpenedsChanged({ menus }) {
const _ids = menus.map(({ id, children = [] }) => {
if (children.noHidden().length) {
return id
}
})
if (this.cur.openeds.toString() == _ids.toString()) return
this.cur.openeds = _ids
}
}
}
......@@ -70,6 +61,7 @@ export default {
// height: 100%;
/deep/.el-menu {
height: 100%;
width: calc(#{$menu_width} - #{$menu_width_collapse} -1px);
}
// }
&-scroll-y {
......@@ -77,7 +69,6 @@ export default {
margin-bottom: 0 !important ;
.el-scrollbar__view {
min-height: 52px;
width: calc(#{$menu_width} - #{$menu_width_collapse} -1px);
max-height: calc(100vh - #{$logo-height});
}
}
......
......@@ -53,17 +53,19 @@ export default {
isMenuNoChildren({ children = [] }) {
return children.noHidden().length == 0
},
handleMenuChanged({ menus, isReload = false }) {
handleMenuChanged({ menus = [], isReload = false }) {
if (this.menus[0]?.pid == menus[0]?.pid) return
if (isReload) {
this.reload()
return
}
this.menus = menus
this.bus.$emit('menuOpenedsChanged', { menus })
},
reload() {
const { lv1 } = this.current
const menus = this.app.menuList.find(({ id }) => id == lv1).children.noHidden()
this.bus.$emit('menuChanged', { menus })
this.handleMenuChanged({ menus })
}
}
}
......@@ -100,15 +102,6 @@ $active-background-color: rgba(88, 80, 255, 0.2) !important;
right: 0;
}
}
// &.is-opened {
// .el-submenu__title {
// background-color: transparent !important;
// span,
// i {
// color: $main-color !important;
// }
// }
// }
&.is-active {
.el-submenu__title {
background-color: transparent !important;
......
......@@ -9,6 +9,7 @@
<script>
export default {
name: 'LeftSideMenuLv3',
inject: ['bus'],
props: {
menuItems: {
type: Array,
......@@ -16,9 +17,10 @@ export default {
}
},
methods: {
handleSelect({ path }) {
handleSelect({ path, children = [] }) {
if (path) {
this.$router.push(path)
this.bus.$emit('menu3Changed', children.noHidden())
}
}
}
......
<template>
<li class="com-left-side-menu-lv3-item">{{ menu3 }}</li>
</template>
<script>
import { mapGetters } from 'vuex'
export default {
name: 'LeftSideMenuLv3Item',
props: {
menu3: {
type: Object,
default: () => {}
}
},
computed: {
...mapGetters(['app', 'menu'])
},
methods: {}
}
</script>
<style lang="scss" scoped>
@import '~@/assets/style/collapse.scss';
.com-left-side-menu-lv3-item {
width: 100%;
min-height: 36px;
background-color: blue;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 16px;
color: #333;
}
</style>
<template>
<div class="com-left-side-right">
<LeftSideMenuNav></LeftSideMenuNav>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
export default {
name: 'LeftSideRight',
computed: {
...mapGetters(['app', 'menu'])
},
methods: {}
}
</script>
<style lang="scss" scoped>
@import '~@/assets/style/collapse.scss';
.com-left-side-right {
flex: 1;
}
</style>
<template>
<div class="scrm-base-mebu-lv4" v-show="nav4 && nav4.length">
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane :name="item.path" v-for="item in nav4" :key="item.id">
<span slot="label" style="padding: 0 10px">{{ item.title }}</span>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import { currentId } from './mixins/index'
export default {
name: 'MenuLv4',
mixins: [currentId],
data() {
return {
activeName: '',
nav4: []
}
},
mounted() {
this.bus.$on('menu3Changed', this.onMenu4Changed)
this.onLoad()
},
beforeDestroy() {
this.bus.$off('menu3Changed', this.onMenu4Changed)
},
methods: {
handleClick(item) {
this.$router.push(item.name)
},
setActive(activeId = '', nav4 = []) {
const sub = this.find(activeId)
if (sub) {
this.nav4 = nav4
this.$nextTick(() => (this.activeName = sub.path))
}
},
find(id) {
return this.app.flatten.find(item => item.id == id)
},
onMenu4Changed(menus = []) {
this.setActive(menus[0]?.id, menus)
},
onLoad() {
const [lv1, lv2, lv3, lv4] = this.current
const lv3id = `${lv1}-${lv2}-${lv3}`
const lv4id = `${lv3id}-${lv4}`
const sub = this.find(lv3id).children
if (sub?.length) {
const nav4 = sub.noHidden()
this.setActive(lv4id, nav4)
}
}
}
}
</script>
<style lang="scss" scoped>
@import '~@/assets/style/mixins.scss';
.scrm-base-mebu-lv4 {
// transform: translateY(-5px);
@include leftpadding;
/deep/.el-tabs {
&__nav-wrap {
&::after {
height: 1px;
// width: calc(100% - #{$left});
}
}
&__header {
margin: 4px 0 1px;
}
&__item {
height: 42px !important;
// line-height: 10px !important;
&.is-active,
&:hover {
color: $main-color;
font-weight: 600;
}
font-weight: 400;
font-size: 16px;
color: #717171;
height: 36px;
line-height: 36px;
}
&__active-bar {
background-color: $main-color;
}
}
}
</style>
......@@ -7,6 +7,7 @@ export const currentId = {
if (this.app.currentPage) {
const [lv1, lv2, lv3, lv4] = this.app.currentPage.id.split('-')
Object.assign(_current, { lv1, lv2, lv3, lv4 })
this.bus?.$emit('current', _current)
}
return _current
}
......
......@@ -7,7 +7,7 @@
<el-header>
<div class="header-wrap">
<NavMenu></NavMenu>
<SubNav></SubNav>
<MenuLv4></MenuLv4>
</div>
</el-header>
<el-main>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!