Files
foton-laws-system-front/src/pages/home2/components/navMenu/index.vue
T
2021-10-08 10:08:48 +08:00

117 lines
3.5 KiB
Vue

<!-- 右侧导航 -->
<template>
<div class="nav-menu">
<div class="lattice">
<div class="title">快捷入口</div>
<div class="menu-wrap">
<enter-card v-for="(item, index) in list"
:key="index"
:label="item.label"
:path="item.path"
:class="list.length === 1 ? 'wx-card1' : (list.length == 2 ? 'wx-card2' :'')">
</enter-card>
</div>
</div>
</div>
</template>
<script>
import EnterCard from '@/pages/home/components/EnterCard'
export default {
name: 'NavMenu',
components: {EnterCard},
mixins: [],
data() {
return {
list: []
}
},
computed: {},
watch: {},
mounted() {
this.getData()
},
methods: {
getData (){
this.$http.get('/sarPersonalCenter/sar-user-personal-menu/getList',
{
userId: this.$store.getters.userInfo.userId
}, {_this: this}, res => {
if (res.ok) {
res.data.records.forEach( item => {
if (item.state == 1) {
var json = {}
json.label = item.menuName
json.path = item.menuUrl
this.list.push(json)
}
})
for (let a = this.list.length; a < 9; a++) {
var json = {}
json.label = ''
json.path = '/plate'
this.list.push(json)
}
}
})
},
toPage() {
this.$router.push(this.path)
}
},
}
</script>
<style lang="less" scoped>
.nav-menu {
.lattice {
.title {
margin-bottom: 10px;
padding-left: 10px;
height: 40px;
line-height: 40px;
background: #fff;
font-size: 16px;
font-weight: bold;
}
.menu-wrap {
height: 240px;
display: flex;
flex-wrap: wrap;
justify-content:space-between;
font-size: 18px;
color: #333333;
margin-bottom: 10px;
text-align: center;
&:last-child {
margin-bottom: 0;
}
.wx-card {
height: 70px;
background-color: #FFFFFF;
width: 32%;
margin: 0 0 10px 0;
}
.wx-card1 {
width: 100%;
}
.wx-card2 {
width: 49%;
}
.menu-item {
flex: 1;
height: 70px;
line-height: 70px;
text-align: center;
margin-right: 10px;
background: #FFFFFF;
&:last-child {
margin-right: 0;
}
}
}
}
}
</style>