Commit 05724f8f authored by xhx's avatar xhx

fix:白名单

parent be146949
......@@ -9,39 +9,24 @@
<script lang="ts">
import Vue from 'vue'
import menu from '@/utils/menu'
import { routes } from '@/router/index';
export default Vue.extend({
data() {
return {
breadList: [],
breadList: [] as Array<string>,
filterList: [] as any
}
},
methods: {
getList() {
this.filterList = []
const type = 1
let c = [] as any
if (type === 1) {
c = menu.admin
} else {
c = menu.groupLeader
}
const f = this.toLine(c)
for (let i = 0; i < f.length; i++) {
for (let j = 0; j < f.length; j++) {
if (f[i].id === f[j].pid) {
this.filterList.push([f[i].name, f[j].name, f[j].url])
getList(route: Array<any>, list: Array<string>) {
for (const item of route) {
if (list.includes(item.name)) {
this.breadList.push(item.meta.name)
if (item.children) {
this.getList(item.children, list)
}
}
}
const route = this.$route.path
const res = this.filterList.filter((item: any) =>
item[item.length - 1] === route
)[0]
if (res) {
res.length = 2
}
this.breadList = res
},
toLine(data: any){
return data.reduce((arr: any[], {id, pid, name, url, list = []}: any) =>
......@@ -49,11 +34,19 @@ export default Vue.extend({
}
},
mounted() {
this.getList()
const _routes = JSON.parse(JSON.stringify(routes))
const path = this.$route.path
const pathList = path.split('/').filter(item => item)
this.breadList = []
this.getList(_routes, pathList)
},
watch: {
$route() {
this.getList()
$route(n) {
this.breadList = []
const _routes = JSON.parse(JSON.stringify(routes))
const path = n.path
const pathList = path.split('/').filter((item: string) => item)
this.getList(_routes, pathList)
}
}
})
......
......@@ -8,19 +8,19 @@
border
style="width: 100%">
<el-table-column
prop="name"
prop="addr"
label="用户地址">
</el-table-column>
<el-table-column
prop="minerAddr"
prop="inviter"
label="推荐人数">
</el-table-column>
<el-table-column
prop="entrustTicket"
prop="tickets"
label="线下总票数">
</el-table-column>
<el-table-column
prop="entrustPerson"
prop="percent"
label="票数占比">
</el-table-column>
</el-table>
......
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