Commit d521b43e by YoMon

增加后台获取权限列表

parent 20471e6c
......@@ -11,17 +11,24 @@
</div>
</div>
<div class="y_default_start">
<keep-alive>
<div class="main_left" :style="{height: clientHeight + 'px'}">
<div class="orderCtg_txt">
<p v-for="(item, index) in orderList" :class="$route.path===item.pagePath?'orderCtg_list_now':''" @click="entriesClick(item)">{{item.name}}</p>
</div>
<div class="orderCtg_txt">
<p v-for="(item, index) in lapsList" :class="$route.path===item.pagePath?'orderCtg_list_now':''" @click="entriesClick(item)">{{item.name}}</p>
</div>
<div class="orderCtg_txt">
<p v-for="(item, index) in financeList" :class="$route.path===item.pagePath?'orderCtg_list_now':''" @click="entriesClick(item)">{{item.name}}</p>
</div>
<el-menu
:default-active="item.name"
class="el-menu-vertical-demo"
@open="handleOpen"
@close="handleClose" v-for="(item, index) in leftMenuList">
<el-submenu :index="item.name" :default-openeds="[]">
<template slot="title">
<i class="el-icon-location"></i>
<span>{{item.name}}</span>
</template>
<el-menu-item :index="sub.name" v-for="(sub, subIndex) in item.pageList">{{sub.name}}</el-menu-item>
</el-submenu>
</el-menu>
</div>
</keep-alive>
<!-- 侧边栏结束 -->
<div class="main_right">
<div class="crumbs">
<span class="crumbs_list" v-for="(item, index) in Array.from(visitedViews)">{{item.name}}</span>
......@@ -34,17 +41,23 @@
</template>
<script>
import Vue from 'vue'
import Menu from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import YCookie from '../assets/js/yCookie.js'
// import requestApi from '../assets/js/requestApi.js'
import requestApi from '../assets/js/requestApi.js'
Vue.use(Menu)
export default {
data() {
return {
tab: ['系统管理', '商品管理', '订单管理', '财务管理'],
tabNow: 0,
systemList: [],
goodManageList: [],
orderList: [],
lapsList: [],
financeList: [],
clientHeight: 0
clientHeight: 0,
leftMenuList: []
}
},
computed: {
......@@ -60,6 +73,17 @@ export default {
return this.$store.state.financalTags.fVisitedViews
}
}
// leftMenuList() {
// if (this.tabNow === 0) {
// return this.systemList
// } else if (this.tabNow === 1) {
// return this.goodManageList
// } else if (this.tabNow === 2) {
// return this.orderList
// } else {
// return this.financeList
// }
// }
},
watch: {
$route() {
......@@ -67,6 +91,23 @@ export default {
}
},
methods: {
initMenuList() {
console.log('11111111')
this.leftMenuList = []
if (this.tabNow === 0) {
this.leftMenuList = this.systemList
} else if (this.tabNow === 1) {
this.leftMenuList = this.goodManageList
} else if (this.tabNow === 2) {
this.leftMenuList = this.orderList
} else {
this.leftMenuList = this.financeList
}
},
handleOpen() {
},
handleClose() {
},
generateRoute() {
if (this.$route.name) {
return this.$route
......@@ -91,14 +132,21 @@ export default {
},
// 获取列表数据
getOrderCtg: async function () {
console.log('get data ==== ')
let obj = await requestApi.roleAuthList(this)
if (obj.code === 'success') {
this.systemList = obj.data.sys.pageList
this.goodManageList = obj.data.goods.pageList
this.orderList = obj.data.order.pageList
this.financeList = obj.data.finance.pageList
this.initMenuList()
}
},
switchTab(e) {
this.tabNow = e
this.initMenuList()
YCookie.setLocalCookie('tabNow', this.tabNow)
this.orderList = []
this.lapsList = []
this.financeList = []
this.getOrderCtg()
// this.getOrderCtg()
this.$router.push({
path: '/'
})
......@@ -207,11 +255,11 @@ export default {
font-weight: bold;
}
.main_left{
width: 10%;
width: 13%;
background: #E8E9EE;
}
.main_right{
width: 90%;
width: 87%;
position: relative;
}
.crumbs{
......
export default function ({store, redirect}) {
console.log('aut userId' + store.state.auth)
if (store.state.auth === undefined || store.state.auth === null || Object.keys(store.state.auth).length === 0 || store.state.auth.userId === 0) {
console.log('aut userId' + store.state.usrAuth.auth)
if (store.state.usrAuth.auth === undefined || store.state.usrAuth.auth === null || Object.keys(store.state.usrAuth.auth).length === 0 || store.state.usrAuth.auth.userId === 0) {
redirect('/login/login')
}
}
export default function ({ route, redirect, store }) {
console.log('route.fullPath == ' + route.fullPath)
if (route.fullPath === '/login') {
store.state.loginPath = store.state.forePath
store.state.usrAuth.loginPath = store.state.usrAuth.forePath
}
store.state.forePath = route.fullPath
store.state.usrAuth.forePath = route.fullPath
}
......@@ -4,9 +4,6 @@
<h1 class="title">
Universal Vue.js Application Framework
</h1>
<nuxt-link class="button" to="/about">
About page
</nuxt-link>
</section>
</template>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment