<template>
  <view>
    <image src="../../static/index/banner.png" class="banner"></image>
    <div class="map">
      <div
        class="mapdom"
        style="float: left; position: relative"
        v-for="(item, index) in mapList"
        :key="index"
        @click="jumpPage(item.path)"
      >
        <div class="jiaobiao" v-if="item.label == '会议室审核' && MeetingNum">
          {{ MeetingNum }}
        </div>
        <div class="jiaobiao" v-if="item.label == '场馆审核' && MeetingNum">
          {{ VenueNum }}
        </div>
        <img class="mapIcon" :src="item.url" />
        <div class="maptxt">{{ item.label }}</div>
      </div>
    </div>
  </view>
</template>
<script>
// import {demo} from "@/js_sdk/http"
import {
  getUserPower,
  getUserLocalStorageInfo,
  getVenueAppointListAppCount,
  getMeetingAppointListAppCount,
} from "@/js_sdk/http";
export default {
  data() {
    return {
      mapList: [
        {
          label: "智慧党建",
          url: "https://hswkxc.idea-sf.com/fileService/static/slices/1@2x.png",
          path: "/pages/subPackages/buildmap/index",
        },
        // {
        //   label: "经发填报",
        //   url: "https://hswkxc.idea-sf.com/fileService/static/slices/1@2x.png",
        //   path: "/pages/subPackages/companyHouse/companyHouse",
        // },
        {
          label: "企业库",
          url: "https://hswkxc.idea-sf.com/fileService/static/slices/2@2x.png",
          path: "/pages/subPackages/companyHouse/companyHouse",
        },
        // {
        //   label: "走访上报",
        //   url: "https://hswkxc.idea-sf.com/fileService/static/slices/3@2x.png",
        //   path: "/pages/subPackages/companyreport/companyreport",
        // },
        // {
        //   label: "上市跟进",
        //   url: "https://hswkxc.idea-sf.com/fileService/static/slices/4@2x.png",
        // },

        {
          label: "招商管理",
          url: "https://hswkxc.idea-sf.com/fileService/static/slices/5@2x.png",
          path: "/pages/subPackages/merchants/merchants",
        },
        {
          label: "我的待办",
          url: "https://hswkxc.idea-sf.com/fileService/static/slices/7@2x.png",
          path: "/pages/subPackages/todo/index",
        },
        {
          label: "我的待阅",
          url: "https://hswkxc.idea-sf.com/fileService/static/slices/6@2x.png",
          path: "/pages/subPackages/toread/index",
        },
        // {
        //   label: "会议室审核",
        //   url: "https://hswkxc.idea-sf.com/fileService/static/slices/12@2x.png",
        //   path: "/pages/subPackages/meetingroom/meetingroom",
        // },
        {
          label: "安全管理自检",
          url: "https://hswkxc.idea-sf.com/fileService/static/slices/8@2x.png",
          path: "/pages/subPackages/secureselftest2/index",
        },
        {
          label: "安全管理统计",
          url: "https://hswkxc.idea-sf.com/fileService/static/slices/8@2x.png",
          path: "/pages/subPackages/secureselftest/index",
        },
        {
          label: "安全自检计划",
          url: "https://hswkxc.idea-sf.com/fileService/static/slices/9@2x.png",
          path: "/pages/subPackages/secureselfplan/index",
        },

        {
          label: "政企服务",
          url: "https://hswkxc.idea-sf.com/fileService/static/slices/11@2x.png",
          path: "/pages/subPackages/repairDispatch-app/index",
        },
        {
          label: "服务派单",
          url: "https://hswkxc.idea-sf.com/fileService/static/slices/11@2x.png",
          path: "/pages/subPackages/repairDispatch-serve/index",
        },
        {
          label: "服务处理",
          url: "https://hswkxc.idea-sf.com/fileService/static/slices/10@2x.png",
          path: "/pages/subPackages/repairprocessing-app/index",
        },

        {
          label: "案卷填报",
          url: "https://hswkxc.idea-sf.com/fileService/static/slices/15@2x.png",
          path: "/pages/subPackages/modifyReport/index",
        },
        {
          label: "案卷派单",
          url: "https://hswkxc.idea-sf.com/fileService/static/slices/14@2x.png",
          path: "/pages/subPackages/modifySend/index",
        },
        {
          label: "案卷处理",
          url: "https://hswkxc.idea-sf.com/fileService/static/slices/13@2x.png",
          path: "/pages/subPackages/modifyHandle/index",
        },
        {
          label: "活动核销",
          url: "https://hswkxc.idea-sf.com/fileService/static/slices/1@2x.png",
          path: "/pages/subPackages/activity/index",
        },
        {
          label: "可视化大屏",
          url: "https://hswkxc.idea-sf.com/fileService/static/slices/1@2x.png",
          path: "/pages/subPackages/bigscreen/bigscreen",
        },
        {
          label: "场馆审核",
          url: "https://hswkxc.idea-sf.com/fileService/static/slices/1@2x.png",
          path: "/pages/subPackages/venueRoom/meetingroom",
        },
        {
          label: "园区活动",
          url: "https://hswkxc.idea-sf.com/fileService/static/slices/1@2x.png",
          path: "/pages/subPackages/parkActivities/index",
        },
        {
          label: "通知公告",
          url: "https://hswkxc.idea-sf.com/fileService/static/slices/1@2x.png",
          path: "/pages/subPackages/announcement/index",
        },
      ],
      MeetingNum: 0,
      VenueNum: 0,
    };
  },
  onShareAppMessage() {},
  mounted() {
    // demo();
  },
  onLoad() {
    this.getUserPower();
    this.getVenueAppointListAppCount();
    this.getMeetingAppointListAppCount();
  },
  onShow() {
    this.getVenueAppointListAppCount();
    this.getMeetingAppointListAppCount();
  },
  methods: {
    async getVenueAppointListAppCount() {
      let data = await getVenueAppointListAppCount();
      this.VenueNum = data.data;
      console.log(data);
    },
    async getMeetingAppointListAppCount() {
      let data = await getMeetingAppointListAppCount();
      this.MeetingNum = data.data;
      console.log(data);
    },
    // getUserLocalStorageInfo
    async getUserPower() {
      if (getUserLocalStorageInfo().user.id == 1) return;
      let that = this;
      let newList = [];
      let { data } = await getUserPower(getUserLocalStorageInfo().user.id);
      for (let i = 0; i < that.mapList.length; i++) {
        let index = data.findIndex((e) => e == that.mapList[i].label);
        if (index != -1) {
          newList.push(that.mapList[i]);
        }
      }
      that.mapList = newList;
    },
    jumpPage(path) {
      uni.navigateTo({
        url: path,
        fail: (fail) => {},
      });
    },
  },
};
</script>

<style lang="scss">
page {
  background: white;
}
.jiaobiao {
  position: absolute;
  top: 10rpx;
  right: 30rpx;
  border-radius: 50%;
  background: red;
  font-size: 24rpx;
  height: 30rpx;
  width: 30rpx;
  text-align: center;
  line-height: 24rpx;
  color: white;
  line-height: 30rpx;
}
.banner {
  width: 100%;
  height: 450rpx;
  position: absolute;
  z-index: 1;
}
.mapdom {
  width: 25%;
  height: 184rpx;
}
.maptxt {
  width: 100%;
  height: 34rpx;
  font-size: 24rpx;
  font-family: PingFang SC-Medium, PingFang SC;
  font-weight: 500;
  color: #333333;
  text-align: center;
}
.mapIcon {
  width: 160rpx;
  height: 160rpx;
  //background: linear-gradient(141deg, #89BCFF 0%, #2782FA 100%);
  display: block;
  margin: auto;
}
.map {
  position: absolute;
  z-index: 2;
  width: calc(100% - 64rpx);
  height: 770rpx;
  border-radius: 48rpx 48rpx 0rpx 0rpx;
  background: white;
  margin-top: 402rpx;
  padding: 48rpx 32rpx;
  overflow-y: auto;
}
</style>
