YOS-DRVOGPU6U78\Administrator
2023-07-19 3acc5e4a99c7c69d25d7782e3c71152c5d0e0845
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
<template>
    <view>
        <u-grid :col="3" @click="gotoPage" border>
            <u-grid-item v-for="item in grid" :index="item[0]">
                <u-icon name="play-right-fill" :size="46" color="#FF8000"></u-icon>
                <view class="grid-text">{{item.name}}</view>
            </u-grid-item>
        </u-grid>
        <u-toast ref="uToast" />
    </view>
 
</template>
 
<script>
    import {
        queryPurview
    } from '../../api'
    import grid from '../../uni_modules/uview-ui/libs/config/props/grid'
    export default {
        data() {
            return {
                grid: [],
                filter: [{
                    name: '巡检检验',
                    src: '/pages/inspection/inspectionList',
                    icon:''
                }]
            }
        },
        onLoad() {
            queryPurview().then(res => {
                if (!res.result) {
                    this.$refs.uToast.show({
                        message: res.msg,
                        type: 'error'
                    })
                    return
                }
                // 显示需要被代理的
                for (let item of this.filter) {
                    if (res.data.find(t => t[0] == item.name)) {
                        this.grid.push(item)
                    }
                }
            })
 
        },
        methods: {
            gotoPage(e) {
                // console.log(this.grid[e])
                // let name = this.grid[e][0]
                // // 判断该页面是否应该被代理
                // let item = this.filter.find(t => {
                //     if (t.name == name) {
                //         return t;
                //     }
                // })
                // if (typeof(item) == 'undefined') {
                //     uni.navigateTo({
                //         url: '/pages/main/main?name=' + name
                //     })
                //     return
                // }
                uni.navigateTo({
                    url: this.grid[e].src
                })
            }
        }
    }
</script>
 
<style>
</style>