index.vue
3.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<template>
<div class="layout">
<template v-if="flag">
<template v-if="list.length">
<template v-for="item in list">
<template v-if="item.children && item.children.length">
<div :key="item.id">
<template v-if="item.label != '工作台'">
<div class="title">{{item.label}}</div>
</template>
<div class="box">
<template v-for="i in item.children">
<div
:key="i.id"
class="item"
@click="jump(i)"
>
<div class="icon">
<img
:src="i.icon"
:alt="i.label"
>
</div>
{{i.label}}
</div>
</template>
</div>
</div>
</template>
</template>
</template>
<template v-else>
<van-empty description="暂无内容" />
</template>
</template>
</div>
</template>
<script type='text/ecmascript-6'>
const { subsystemInfo } = window.$fetchConfig
import { ssoApi } from '@/api'
export default {
name: '',
data () {
return {
list: [],
flag: false
}
},
activated () {
ssoApi.getPermission().then(data => {
if (data && data.length) {
let [merchantProTreeResponses] = data[0].products[0].merchantProTreeResponses
if (merchantProTreeResponses) {
let list = merchantProTreeResponses.children
if (list && list.length) {
list.map(e => {
if (e.children) {
e.children.map(i => {
let [url, item] = i.menuUrl.split('@')
let [target, icon] = item.split('|')
let [link, query] = url.split('?')
i.icon = icon
i.link = link
i.target = target
i.query = query
})
}
})
console.log(list)
this.list = list
}
}
}
this.flag = true
})
},
mounted () { },
methods: {
jump (e) {
let sessionId = this.getSessionId()
let { corpId } = this.getLocalStorage('dj_scrm_corpId')
let { link, query, target } = e
let { path } = subsystemInfo[target]
let url = `${path}${link}?sessionId=${sessionId}&corpId=${corpId}`
if (query) url = `${url}&${query}`
window.location.href = url
}
}
}
</script>
<style scoped lang='scss'>
.layout {
padding: 16px 16px 66px;
.title {
font-weight: 500;
font-size: 16px;
color: #4a4a4a;
padding: 16px 0 10px;
}
.box {
display: grid;
grid-template-columns: repeat(4, 1fr);
align-items: center;
min-height: 84px;
background: #ffffff;
box-shadow: 0px 2px 4px 0px rgba(206, 209, 222, 0.12), 0px 2px 8px 0px rgba(206, 209, 222, 0.4);
border-radius: 4px;
box-sizing: border-box;
color: #333;
font-size: 12px;
.item {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
height: 84px;
.icon {
width: 40px;
height: 40px;
margin-bottom: 7px;
}
}
}
}
</style>