Commit cee29c9d by xinla

新版菜单调整基本完成

1 parent 295ed6b8
<style lang="scss" scoped>
.page {
padding: 16px 24px 24px;
}
</style>
<template> <template>
<section class="app-main"> <section class="app-main">
<transition name="fade-transform" mode="out-in"> <transition name="fade-transform" mode="out-in">
...@@ -34,7 +29,7 @@ export default { ...@@ -34,7 +29,7 @@ export default {
width: 100%; width: 100%;
position: relative; position: relative;
overflow: auto; overflow: auto;
background-color: #fff; // background-color: #fff;
} }
.fixed-header + .app-main { .fixed-header + .app-main {
......
<template> <template>
<div style="padding: 0 15px;display: inline-block;" @click="toggleClick"> <div style="padding-right: 15px;display: inline-block;" @click="toggleClick">
<svg <svg
:class="{ 'is-active': $store.state.app.sidebar.opened }" :class="{ 'is-active': $store.state.app.sidebar.opened }"
class="hamburger" class="hamburger"
...@@ -22,7 +22,7 @@ export default { ...@@ -22,7 +22,7 @@ export default {
$route(route) { $route(route) {
// if you go to the redirect page, do not update the breadcrumbs // if you go to the redirect page, do not update the breadcrumbs
if (route.name == '首页') { if (route.name == '首页') {
// this.$store.state.app.sidebar.opened = false this.$store.state.app.sidebar.opened = 0
} }
}, },
}, },
......
...@@ -197,6 +197,7 @@ export default { ...@@ -197,6 +197,7 @@ export default {
margin: 0 20px; margin: 0 20px;
flex: none; flex: none;
position: relative; position: relative;
cursor: pointer;
&.active::after { &.active::after {
content: ''; content: '';
display: inline-block; display: inline-block;
......
<template>
<router-view></router-view>
</template>
<script>
export default {}
</script>
<style></style>
...@@ -12,8 +12,14 @@ ...@@ -12,8 +12,14 @@
<div class="main main-size"> <div class="main main-size">
<sidebar v-if="$route.name !== '首页'" class="sidebar-container" /> <sidebar v-if="$route.name !== '首页'" class="sidebar-container" />
<div class="main-container"> <div class="main-container">
<div v-show="$route.name !== '首页'">
<hamburger id="hamburger-container" class="hamburger-container" /> <hamburger id="hamburger-container" class="hamburger-container" />
<breadcrumb id="breadcrumb-container" class="breadcrumb-container" /> <span class="slogan">仟微科技 |</span>
<breadcrumb
id="breadcrumb-container"
class="breadcrumb-container"
/>
</div>
<!-- <div :class="{ 'fixed-header': fixedHeader }"> <!-- <div :class="{ 'fixed-header': fixedHeader }">
<navbar /> <navbar />
...@@ -99,6 +105,12 @@ export default { ...@@ -99,6 +105,12 @@ export default {
.main-wrap { .main-wrap {
height: calc(100vh - 58px); height: calc(100vh - 58px);
background: #eee; background: #eee;
.main {
height: 100%;
padding: 10px;
display: flex;
align-items: stretch;
}
} }
} }
...@@ -138,4 +150,9 @@ export default { ...@@ -138,4 +150,9 @@ export default {
background: rgba(0, 0, 0, 0.025); background: rgba(0, 0, 0, 0.025);
} }
} }
.slogan {
font-size: 22px;
color: #999;
vertical-align: middle;
}
</style> </style>
...@@ -38,6 +38,11 @@ export const constantRoutes = [ ...@@ -38,6 +38,11 @@ export const constantRoutes = [
], ],
}, },
{ {
path: '',
redirect: '/index',
hidden: true,
},
{
path: '/index', path: '/index',
component: Layout, component: Layout,
redirect: '/index', redirect: '/index',
......
import { constantRoutes } from '@/router' import { constantRoutes } from '@/router'
import { getRouters } from '@/api/menu' import { getRouters } from '@/api/menu'
import Layout from '@/layout/index' import Layout from '@/layout/index'
import View from '@/layout/components/View'
const permission = { const permission = {
state: { state: {
...@@ -30,7 +31,7 @@ const permission = { ...@@ -30,7 +31,7 @@ const permission = {
} }
// 遍历后台传来的路由字符串,转换为组件对象 // 遍历后台传来的路由字符串,转换为组件对象
function filterAsyncRouter(asyncRouterMap) { function filterAsyncRouter(asyncRouterMap, level) {
return asyncRouterMap.filter((route) => { return asyncRouterMap.filter((route) => {
if (route.component) { if (route.component) {
// Layout组件特殊处理 // Layout组件特殊处理
...@@ -38,13 +39,17 @@ function filterAsyncRouter(asyncRouterMap) { ...@@ -38,13 +39,17 @@ function filterAsyncRouter(asyncRouterMap) {
if (route.redirect === 'noRedirect' && route.children.length) { if (route.redirect === 'noRedirect' && route.children.length) {
route.redirect = route.path + '/' + route.children[0].path route.redirect = route.path + '/' + route.children[0].path
} }
if (level === 2) {
route.component = View
} else {
route.component = Layout route.component = Layout
}
} else { } else {
route.component = loadView(route.component) route.component = loadView(route.component)
} }
} }
if (route.children != null && route.children && route.children.length) { if (route.children != null && route.children && route.children.length) {
route.children = filterAsyncRouter(route.children) route.children = filterAsyncRouter(route.children, 2)
} }
return true return true
}) })
......
#app { #app {
.main-container { .main-container {
min-height: 100%; min-height: 100%;
transition: margin-left 0.28s; transition: all 0.28s;
margin-left: $sideBarWidth; margin-left: 40px;
position: relative; position: relative;
flex: auto;
overflow: hidden;
} }
.sidebar-container { .sidebar-container {
transition: width 0.28s; transition: width 0.28s;
width: $sideBarWidth !important; width: $sideBarWidth !important;
background-color: $menuBg; background-color: $menuBg;
height: calc(100% - 58px);
position: fixed;
font-size: 0px; font-size: 0px;
bottom: 0; bottom: 0;
z-index: 1001; z-index: 1001;
overflow: hidden; overflow: hidden;
flex: none;
box-shadow: 0px 2px 2px 0px rgba(228, 228, 228, 0.35);
border-radius: 10px;
.el-menu-item.is-active { .el-menu-item.is-active {
color: #fff !important;
background-color: $menuActiveBg !important; background-color: $menuActiveBg !important;
border-right: 2px solid #0079de;
} }
// reset element-ui css // reset element-ui css
...@@ -91,11 +94,11 @@ ...@@ -91,11 +94,11 @@
.hideSidebar { .hideSidebar {
.sidebar-container { .sidebar-container {
width: 54px !important; width: 0 !important;
} }
.main-container { .main-container {
margin-left: 54px; margin-left: 0;
} }
.submenu-title-noDropdown { .submenu-title-noDropdown {
......
...@@ -15,12 +15,12 @@ $menuActiveText: #333; ...@@ -15,12 +15,12 @@ $menuActiveText: #333;
$subMenuActiveText: #333; // https://github.com/ElemeFE/element/issues/12951 $subMenuActiveText: #333; // https://github.com/ElemeFE/element/issues/12951
$menuBg: #fff; $menuBg: #fff;
$menuActiveBg: #4ca1e8; $menuActiveBg: #fafafa;
$menuHover: #4ca1e8; $menuHover: #fafafa;
$subMenuBg: #fff; $subMenuBg: #fff;
$subMenuActiveBg: #4ca1e8; $subMenuActiveBg: #fafafa;
$subMenuHover: #4ca1e8; $subMenuHover: #fafafa;
$sideBarWidth: 200px; $sideBarWidth: 200px;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!