Houjie
2 天以前 964faa1077a89713910063c39ebe08fac4e4c56e
pages/home/home.vue
@@ -53,7 +53,10 @@
            <view class="cu-item animation-slide-bottom" :style="[{animationDelay: (index + 1)*0.1 + 's'}]"
               v-for="(item,index) in osList" :key="index" @tap="goPage(item.page)">
               <view class="padding text-center">
                  <image :src="item.icon" style="width:28px;height:28px;" />
                  <image :src="item.icon" style="width:28px;height:28px;">
                     <view class="cu-tag badge margin-top-sm" style="margin-left:1.2em"
                        v-if="getTtemDotInfo(item)"></view>
                  </image>
                  <view class="margin-top-xs">{{item.title}}</view>
               </view>
            </view>
@@ -70,7 +73,10 @@
            <view class="cu-item animation-slide-bottom" :style="[{animationDelay: (index + 1)*0.1 + 's'}]"
               v-for="(item,index) in wsList" :key="index" @tap="goPage(item.page)">
               <view class="padding text-center">
                  <image :src="item.icon" style="width:28px;height:28px;" />
                  <image :src="item.icon" style="width:28px;height:28px;">
                     <view class="cu-tag badge margin-top-sm" style="margin-left:1.2em"
                        v-if="getTtemDotInfo(item)"></view>
                  </image>
                  <view class="margin-top-xs">{{item.title}}</view>
               </view>
            </view>
@@ -96,45 +102,50 @@
      props: {
         cur: String,
      },
      // watch: {
      //    cur: {
      //       immediate: true,
      //       handler: function(val, oldVal) {
      //          console.log('cur', val, oldVal)
      //          this.initMenu()
      //       },
      //    },
      // },
      watch: {
         cur: {
            immediate: true,
            handler: function(val, oldVal) {
               console.log('cur', val, oldVal)
               this.initMenu()
            },
         },
        cur: {
          immediate: true,
          handler: function(val, oldVal) {
            console.log('cur', val, oldVal)
            // 即使值没有变化,也主动调用 initMenu
            this.initMenu()
          },
        },
      },
      data() {
         return {
            url: {
               bindingThirdPhone: '/sys/permission/getUserPermissionByToken',
               countItem: '/assign/flow/taskCountBySelf'
               countItem: '/assign/flow/taskCountBySelf',
               waitTiem: 'eam/dashboard/pendingExecOrderCountBySelf'
            },
            swiperList: [{
                  id: 1,
                  type: 'image',
                  url: '/static/banner/eam_banner1.png',
                  url: '/static/banner/fashite-banner.png',
                  link: ''
               },
               {
                  id: 2,
                  type: 'image',
                  url: '/static/banner/eam_banner2.png',
                  url: '/static/banner/eam_banner3.png',
                  link: ''
               },
               {
                  id: 3,
                  type: 'image',
                  url: '/static/banner/eam_banner3.png',
                  link: ''
               },
               {
                  id: 4,
                  type: 'image',
                  url: '/static/banner/eam_banner4.png',
                  link: ''
               },
               }
            ],
            middleApps: [{
                  icon: 'line2_icon1.png',
@@ -152,7 +163,9 @@
            wsList: ws.data,
            msgCount: 0,
            toDomsgCount: 0,
            unExecRepairOrderCount: 0,
            unExecInspectionOrderCount: 0,
            unExecMaintenanceOrderCount: 0,
            dot: {
               mailHome: false
            }
@@ -165,6 +178,7 @@
            this.onSocketReceive()
            this.saveClientId()
            this.taskCountBySelf();
            this.getItemCount();
            this.loadCount(0);
         },
         goPage(page) {
@@ -203,10 +217,25 @@
         taskCountBySelf() {
            let token = uni.getStorageSync(ACCESS_TOKEN)
            this.$http.get(this.url.countItem).then(res => {
               console.log("res::taskCountBySelf>", res)
               this.toDomsgCount = res.data.result
            })
         },
         getItemCount() {
            this.$http.get(this.url.waitTiem).then(res => {
               const {
                  unExecRepairOrderCount,
                  unExecInspectionOrderCount,
                  unExecMaintenanceOrderCount
               } = res.data.result;
               // 或者单独赋值给不同的数据属性
               this.unExecRepairOrderCount = unExecRepairOrderCount;
               this.unExecInspectionOrderCount = unExecInspectionOrderCount;
               this.unExecMaintenanceOrderCount = unExecMaintenanceOrderCount;
            });
         },
         loadCount(flag) {
            console.log("loadCount::flag", flag)
            let url = '/sys/annountCement/listByUser';
@@ -248,11 +277,17 @@
         },
         getTtemDotInfo(item) {
            if (item.page === 'ToDoList' && this.toDomsgCount > 0) {
               // return this.toDomsgCount
               return true
               return true;
            } else if (item.page === 'maintenanceReport' && this.unExecRepairOrderCount > 0) {
               return true;
            } else if (item.page === 'checkList' && this.unExecInspectionOrderCount > 0) {
               return true;
            } else if (item.page === 'baoZhou' && this.unExecMaintenanceOrderCount > 0) {
               return true;
            }
            return false;
         }
      }
   }
</script>