Commit d521b43e by YoMon

增加后台获取权限列表

parent 20471e6c
...@@ -11,17 +11,24 @@ ...@@ -11,17 +11,24 @@
</div> </div>
</div> </div>
<div class="y_default_start"> <div class="y_default_start">
<keep-alive>
<div class="main_left" :style="{height: clientHeight + 'px'}"> <div class="main_left" :style="{height: clientHeight + 'px'}">
<div class="orderCtg_txt"> <el-menu
<p v-for="(item, index) in orderList" :class="$route.path===item.pagePath?'orderCtg_list_now':''" @click="entriesClick(item)">{{item.name}}</p> :default-active="item.name"
</div> class="el-menu-vertical-demo"
<div class="orderCtg_txt"> @open="handleOpen"
<p v-for="(item, index) in lapsList" :class="$route.path===item.pagePath?'orderCtg_list_now':''" @click="entriesClick(item)">{{item.name}}</p> @close="handleClose" v-for="(item, index) in leftMenuList">
</div> <el-submenu :index="item.name" :default-openeds="[]">
<div class="orderCtg_txt"> <template slot="title">
<p v-for="(item, index) in financeList" :class="$route.path===item.pagePath?'orderCtg_list_now':''" @click="entriesClick(item)">{{item.name}}</p> <i class="el-icon-location"></i>
</div> <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> </div>
</keep-alive>
<!-- 侧边栏结束 -->
<div class="main_right"> <div class="main_right">
<div class="crumbs"> <div class="crumbs">
<span class="crumbs_list" v-for="(item, index) in Array.from(visitedViews)">{{item.name}}</span> <span class="crumbs_list" v-for="(item, index) in Array.from(visitedViews)">{{item.name}}</span>
...@@ -34,17 +41,23 @@ ...@@ -34,17 +41,23 @@
</template> </template>
<script> <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 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 { export default {
data() { data() {
return { return {
tab: ['系统管理', '商品管理', '订单管理', '财务管理'], tab: ['系统管理', '商品管理', '订单管理', '财务管理'],
tabNow: 0, tabNow: 0,
systemList: [],
goodManageList: [],
orderList: [], orderList: [],
lapsList: [],
financeList: [], financeList: [],
clientHeight: 0 clientHeight: 0,
leftMenuList: []
} }
}, },
computed: { computed: {
...@@ -60,6 +73,17 @@ export default { ...@@ -60,6 +73,17 @@ export default {
return this.$store.state.financalTags.fVisitedViews 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: { watch: {
$route() { $route() {
...@@ -67,6 +91,23 @@ export default { ...@@ -67,6 +91,23 @@ export default {
} }
}, },
methods: { 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() { generateRoute() {
if (this.$route.name) { if (this.$route.name) {
return this.$route return this.$route
...@@ -91,14 +132,21 @@ export default { ...@@ -91,14 +132,21 @@ export default {
}, },
// 获取列表数据 // 获取列表数据
getOrderCtg: async function () { 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) { switchTab(e) {
this.tabNow = e this.tabNow = e
this.initMenuList()
YCookie.setLocalCookie('tabNow', this.tabNow) YCookie.setLocalCookie('tabNow', this.tabNow)
this.orderList = [] // this.getOrderCtg()
this.lapsList = []
this.financeList = []
this.getOrderCtg()
this.$router.push({ this.$router.push({
path: '/' path: '/'
}) })
...@@ -207,11 +255,11 @@ export default { ...@@ -207,11 +255,11 @@ export default {
font-weight: bold; font-weight: bold;
} }
.main_left{ .main_left{
width: 10%; width: 13%;
background: #E8E9EE; background: #E8E9EE;
} }
.main_right{ .main_right{
width: 90%; width: 87%;
position: relative; position: relative;
} }
.crumbs{ .crumbs{
......
export default function ({store, redirect}) { export default function ({store, redirect}) {
console.log('aut userId' + store.state.auth) console.log('aut userId' + store.state.usrAuth.auth)
if (store.state.auth === undefined || store.state.auth === null || Object.keys(store.state.auth).length === 0 || store.state.auth.userId === 0) { 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') redirect('/login/login')
} }
} }
export default function ({ route, redirect, store }) { export default function ({ route, redirect, store }) {
console.log('route.fullPath == ' + route.fullPath) console.log('route.fullPath == ' + route.fullPath)
if (route.fullPath === '/login') { 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 @@ ...@@ -4,9 +4,6 @@
<h1 class="title"> <h1 class="title">
Universal Vue.js Application Framework Universal Vue.js Application Framework
</h1> </h1>
<nuxt-link class="button" to="/about">
About page
</nuxt-link>
</section> </section>
</template> </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