付延余
2022-07-26 7c3218e12105b87cab21e9ced57c99c339ffac10
components/common/popup-menu/popup-menu.vue
@@ -10,7 +10,8 @@
               <image src="@/static/menuIcon/menu-home.png" slot="icon" size="32" name="search"/>
            </u-cell>
            <u-cell
                v-if="shenqingMenu"
                v-if="$store.state.shenqingMenu"
               v-cloak
                title="我的申请"
                isLink
                url="/pages/my-application/my-application"
@@ -32,12 +33,13 @@
                <image src="@/static/menuIcon/menu-havedo.png" slot="icon" size="32" name="search"/>
            </u-cell>
            <u-cell
               v-if="rijihuaMenu"
               v-if="$store.state.rijihuaMenu"
               v-cloak
                title="日发运计划"
                isLink
                url="/pages/jihua/jihua" style="color:blue"
            >
                <image src="@/static/menuIcon/menu-home.png" slot="icon" size="32" name="search"/>
                <image src="@/static/menuIcon/menu-shipment.png" slot="icon" size="32" name="search"/>
            </u-cell>
         </u-cell-group>
         <u-button text="退出" type="primary" @click="menuPopupClick"></u-button>
@@ -63,70 +65,19 @@
   // },
   data() {
      return {
         menuShow:false,
         rijihuaMenu:false,
         shenqingMenu:false,
         menuShow:false
      };
   },
   onShow() {
      alert(111)
      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()
         console.log(this.$store.state,'shenqingMenu====')
      },
      close() {
         this.menuShow = false;
@@ -134,7 +85,22 @@
      },
      menuPopupClick(){
         this.menuShow = false;
         redirectLogin();
         uni.request({
            url:'/auth/token/logout',
            method:'DELETE',
            header:{
               'TENANT-ID': 5,
               Authorization: 'Bearer ' + uni.getStorageSync('access_token'),
               VERSION: 'zzl'
            }
         }).then(res=>{
          redirectLogin();
         }).catch(err=>{
            uni.showToast({
               title:'退出失败!',
            })
         })
      }
   }
};