zhangxiaoxu123
2022-07-19 07e12b3b60229cdb49be9c8c923578e81d51430a
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<template>
    <view class="popup-menu">
        <u-popup mode="right" :show="menuShow" @close="close" @open="open">
            <u-cell-group>
                <u-cell
                    title="首页"
                    isLink
                    url="/pages/home/home" style="color:blue"
                >
                   <image src="@/static/menuIcon/menu-home.png" slot="icon" size="32" name="search"/>
                </u-cell>
                <u-cell
                    v-if="shenqingMenu"
                    title="我的申请"
                    isLink
                    url="/pages/my-application/my-application"
                >
                     <image src="@/static/menuIcon/menu-application.png" slot="icon" size="32" name="search"/>
                </u-cell>
                <u-cell
                    title="我的待办"
                    isLink
                    url="/pages/my-todo/my-todo"
                >                
                    <image src="@/static/menuIcon/menu-todo.png" slot="icon" size="32" name="search"/>
                </u-cell>
                <u-cell
                    title="我的已办"
                    isLink
                    url="/pages/my-have-todo/my-have-todo"
                >                
                    <image src="@/static/menuIcon/menu-havedo.png" slot="icon" size="32" name="search"/>
                </u-cell>
                <u-cell
                   v-if="rijihuaMenu"
                    title="日发运计划"
                    isLink
                    url="/pages/jihua/jihua" style="color:blue"
                >
                    <image src="@/static/menuIcon/menu-home.png" slot="icon" size="32" name="search"/>
                </u-cell>
            </u-cell-group>
            <u-button text="退出" type="primary" @click="menuPopupClick"></u-button>
        </u-popup>
    </view>
</template>
 
<script>
import { redirectLogin } from '@/utils/status.js';
export default {
    name: 'PopupMenu',
    // props:{
    //     menuShow:{
    //         type:Boolean,
    //         default:false
    //     }
    // },
    // watch:{
    //     menuShow(newV,oldV){
    //             this.menuShow = newV;
    //             console.log('监听menu',newV);
    //     }
    // },
    data() {
        return {
            menuShow:false,
            rijihuaMenu:false,
            shenqingMenu:false,
        };
    },
    onShow() {
        alert(111)
    },
    methods: {
        checkRijihua(data) {
            let labelArry = []
            let newObj = data.filter(e => e.label == '地销计量')
            newObj && newObj.forEach(e => {
                if(e.children.length > 0) {
                    e.children.forEach(item => {
                        labelArry.push(item.label)
                    })
                }else{
                    this.rijihuaMenu = false
                }
            })
            if(labelArry.indexOf('汽车日发运计划管理') > -1) {
                this.rijihuaMenu = true
            }else {
                this.rijihuaMenu = false
            }
        },
        checkShenqing(data) {
            let labelArry = []
            let newObj = data.filter(e => e.label == '工作审批')
            newObj && newObj.forEach(e => {
                if(e.children.length > 0) {
                    e.children.forEach(item => {
                        labelArry.push(item.label)
                    })
                }else{
                    this.shenqingMenu = false
                }
            })
            if(labelArry.indexOf('我的申请') > -1) {
                this.shenqingMenu = true
            }else {
                this.shenqingMenu = false
            }
        },
        menu() {
            // 权限判断
            this.$reqGet('menu').then(res => {
                if(res.data == null) {
                    this.rijihuaMenu = false
                    this.shenqingMenu = false
                }else {
                    this.checkRijihua(res.data)
                    this.checkShenqing(res.data)
                }
            })
        },
        menuClick(){
            this.menuShow = !this.menuShow
            this.$emit('menuShow',this.menuShow)
        },
        open() {
            console.log('open');
            this.menu()
        },
        close() {
            this.menuShow = false;
            this.$emit('menuShow',this.menuShow)
        },
        menuPopupClick(){
            this.menuShow = false;
            redirectLogin();
        }
    }
};
</script>
 
<style lang="scss" scoped>
::v-deep.popup-menu {
    .u-popup{
        .u-transition{
            .u-popup__content{
                // 按钮
                .u-button{
                    width:vww(222);
                    height:vww(40);
                    margin-bottom:vww(40);
                }
                // cell单元格
                .u-cell-group{
                    
                    .u-cell-group__wrapper{
                        .u-cell{
                            width:vww(270);
                            height:vww(48);
                            .u-cell__body{
                                height:vww(48);
                                .u-cell__body__content{
                                    .u-cell__left-icon-wrap{
                                        margin-right: vww(8);
                                        image{
                                            width:vww(16);
                                            height:vww(16);
                                        }
                                    }
                                    .u-cell__title{
                                        .u-cell__title-text{
                                            font-size:vww(14);
                                        }
                                }
                                }
                                .u-cell__right-icon-wrap{
                                    .u-icon{
                                        .u-icon__icon{
                                            width:vww(7.27);
                                            height:vww(12);
                                            span{
                                                color:#007AFF;
                                                
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                
                
                
            }
        }
    }
}
</style>