修改一级菜单交互方式,更改为点击一级菜单后直接打开功能界面

This commit is contained in:
wangchengming 2025-04-18 16:36:01 +08:00
parent b8d04f7830
commit 361b2de6f7
8 changed files with 92 additions and 48 deletions

View File

@ -845,6 +845,23 @@ textarea,
border-bottom: none !important; border-bottom: none !important;
} }
.ant-menu-horizontal .ant-menu-item {
background-image: url('~@/assets/img/menuDefault.png');
background-repeat: no-repeat !important;
background-size: 100% 100% !important;
min-width: 130px !important;
margin: 0 10px !important;
min-height: 55px !important;
line-height: 50px !important;
text-align: center;
font-weight: 800;
font-size: 20px !important;
padding: 0 40px !important;
vertical-align: middle !important;
font-family: @fontfamily;
border-bottom: none !important;
}
.ant-menu-item-selected>a>span, .ant-menu-item-selected>a>span,
.ant-menu-item-active>a>span, .ant-menu-item-active>a>span,
@ -868,7 +885,6 @@ textarea,
.ant-menu { .ant-menu {
border-radius: 0 !important; border-radius: 0 !important;
box-shadow: none !important; box-shadow: none !important;
border-bottom: 1px dotted #00CBFF;
} }
.ant-menu-submenu, .ant-menu-submenu,
@ -888,8 +904,22 @@ textarea,
line-height: 50px !important; line-height: 50px !important;
text-align: left; text-align: left;
float: left; float: left;
margin-right: 20px; // margin-right: 20px;
padding: 0 0 0 20px !important; // padding: 0 0 0 20px !important;
// border-top: 1px dotted #00CBFF;
color: #fff !important;
border-bottom: 1px dotted #00CBFF;
}
.ant-menu-dark.ant-menu-vertical{
background-size: 100% 100%;
width: 263px !important;
height: 50px !important;
margin-bottom: 0 !important;
margin-top: -1px !important;
line-height: 50px !important;
text-align: left;
float: left;
border-top: 1px dotted #00CBFF; border-top: 1px dotted #00CBFF;
} }

View File

@ -103,7 +103,7 @@ export default {
// render // render
renderItem(menu) { renderItem(menu) {
if (!menu.hidden) { if (!menu.hidden) {
return menu.children && !menu.alwaysShow ? this.renderSubMenu(menu) : this.renderMenuItem(menu) // return menu.children && !menu.alwaysShow ? this.renderSubMenu(menu) : this.renderMenuItem(menu)
return this.renderMenuItem(menu) return this.renderMenuItem(menu)
} }
return null return null
@ -116,11 +116,14 @@ export default {
const target = menu.meta.target || null const target = menu.meta.target || null
const tag = target && 'a' || 'router-link' const tag = target && 'a' || 'router-link'
let props = { to: { name: menu.name } } let props = { to: { name: menu.name } }
if (menu.children && menu.children.length > 0) props = { to: { name: menu.children[0].name } }
if (menu.route && menu.route === '0') { if (menu.route && menu.route === '0') {
props = { to: { path: menu.path } } props = { to: { path: menu.path } }
} }
const attrs = { href: menu.path, target: menu.meta.target } let attrs = { href: menu.path, target: menu.meta.target }
if (menu.children && menu.children.length > 0) attrs = { href: menu.children[0].path, target: menu.children[0].meta.target }
if (menu.children && menu.alwaysShow) { if (menu.children && menu.alwaysShow) {
// 把有子菜单的 并且 父菜单是要隐藏子菜单的 // 把有子菜单的 并且 父菜单是要隐藏子菜单的

View File

@ -30,6 +30,11 @@
<div class="leftMenu"> <div class="leftMenu">
<!-- <div class="parent"></div> --> <!-- <div class="parent"></div> -->
<!-- <div class="child" v-for="(item,index) in menuList">{{ item.meta.title }}</div> --> <!-- <div class="child" v-for="(item,index) in menuList">{{ item.meta.title }}</div> -->
<a-menu mode="vertical" theme="dark" :selected-keys="[current]" @click="handleClick">
<a-menu-item v-for="item in menuList" :key="item.id">
{{ item.meta.title }}
</a-menu-item>
</a-menu>
</div> </div>
<div class="content"> <div class="content">
<div :class="['page-header-index-wide']"> <div :class="['page-header-index-wide']">
@ -40,6 +45,7 @@
</template> </template>
<script> <script>
import PageHeader from './PageHeader' import PageHeader from './PageHeader'
import { mapState, mapActions } from 'vuex' import { mapState, mapActions } from 'vuex'
export default { export default {
@ -49,6 +55,7 @@ export default {
}, },
data() { data() {
return { return {
current: '',
menuList: [], menuList: [],
parentTitle: '' parentTitle: ''
} }
@ -96,21 +103,34 @@ export default {
permissionMenuList: (state) => state.user.permissionList, permissionMenuList: (state) => state.user.permissionList,
}), }),
}, },
watch: {
title(val) {
if (val) {
this.initMenuList()
}
}
},
mounted() { mounted() {
this.initMenuList() this.initMenuList()
}, },
methods: { methods: {
initMenuList() { initMenuList() {
this.menuList = [] this.menuList = []
this.parentTitle = this.$route.matched[1].meta.title this.parentTitle = this.$route.matched[1].meta.title
this.permissionMenuList.forEach((item) => { this.permissionMenuList.forEach((item) => {
if (item.meta.title == this.parentTitle) this.menuList = item.children if (item.meta.title == this.parentTitle) this.menuList = item.children
}) })
//
console.log(333, this.menuList) if (this.menuList && this.menuList.length > 0) {
var choseMenu = this.menuList.filter(item => item.meta.title == this.title)
if (choseMenu && choseMenu.length > 0) this.current = choseMenu[0].id
} }
},
handleClick(e) {
this.current = e.key;
var node = this.menuList.filter(item => item.id == e.key)
if (node && node.length > 0) this.$router.push({ name: node[0].name, path: node[0].path })
},
} }
} }
@ -126,6 +146,7 @@ export default {
left: 20px; left: 20px;
top: 140px; top: 140px;
font-size: 18px; font-size: 18px;
padding: 30px 15px 0;
} }
.leftMenu .parent { .leftMenu .parent {
@ -140,6 +161,7 @@ export default {
left: 14px; left: 14px;
top: 30px; top: 30px;
} }
.leftMenu .child { .leftMenu .child {
height: 60px; height: 60px;
background-color: #00467C; background-color: #00467C;

View File

@ -90,7 +90,6 @@
</template> </template>
<script> <script>
import PageLayout from '@/components/page/PageLayout'
import RouteView from "@/components/layouts/RouteView" import RouteView from "@/components/layouts/RouteView"
import { AppPage, ArticlePage, ProjectPage } from './page' import { AppPage, ArticlePage, ProjectPage } from './page'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
@ -99,7 +98,6 @@
export default { export default {
components: { components: {
RouteView, RouteView,
PageLayout,
AppPage, AppPage,
ArticlePage, ArticlePage,
ProjectPage ProjectPage

View File

@ -45,7 +45,6 @@
</template> </template>
<script> <script>
import PageLayout from '@/components/page/PageLayout'
import RouteView from "@/components/layouts/RouteView" import RouteView from "@/components/layouts/RouteView"
import { mixinDevice } from '@/utils/mixin.js' import { mixinDevice } from '@/utils/mixin.js'
import security from './Security' import security from './Security'
@ -56,7 +55,6 @@
export default { export default {
components: { components: {
RouteView, RouteView,
PageLayout,
security, security,
baseSetting, baseSetting,
custom, custom,

View File

@ -112,8 +112,6 @@
<script> <script>
import { timeFix } from "@/utils/util" import { timeFix } from "@/utils/util"
import {mapGetters} from "vuex" import {mapGetters} from "vuex"
import PageLayout from '@/components/page/PageLayout'
import HeadInfo from '@/components/tools/HeadInfo' import HeadInfo from '@/components/tools/HeadInfo'
import Radar from '@/components/chart/Radar' import Radar from '@/components/chart/Radar'
import { getRoleList, getServiceList, getFileAccessHttpUrl } from "@/api/manage" import { getRoleList, getServiceList, getFileAccessHttpUrl } from "@/api/manage"
@ -123,7 +121,6 @@
export default { export default {
name: "Workplace", name: "Workplace",
components: { components: {
PageLayout,
HeadInfo, HeadInfo,
Radar Radar
}, },

View File

@ -134,7 +134,6 @@
<script> <script>
import { mixinDevice } from '@/utils/mixin.js' import { mixinDevice } from '@/utils/mixin.js'
import PageLayout from '@/components/page/PageLayout'
import DetailList from '@/components/tools/DetailList' import DetailList from '@/components/tools/DetailList'
const DetailListItem = DetailList.Item const DetailListItem = DetailList.Item
@ -142,7 +141,6 @@
export default { export default {
name: "Advanced", name: "Advanced",
components: { components: {
PageLayout,
DetailList, DetailList,
DetailListItem DetailListItem
}, },

View File

@ -43,7 +43,6 @@
</template> </template>
<script> <script>
import PageLayout from '@/components/page/PageLayout'
import STable from '@/components/table/' import STable from '@/components/table/'
import DetailList from '@/components/tools/DetailList' import DetailList from '@/components/tools/DetailList'
import ABadge from "ant-design-vue/es/badge/Badge" import ABadge from "ant-design-vue/es/badge/Badge"
@ -51,7 +50,6 @@
export default { export default {
components: { components: {
PageLayout,
ABadge, ABadge,
DetailList, DetailList,
DetailListItem, DetailListItem,