<template>
  <view>
    <image src="../../static/index/banner.png" class="banner"></image>
    <div class="map">
      <div
        class="mapdom"
        style="float: left"
        v-for="(item, index) in mapList"
        :key="index"
        @click="jumpPage(item.path)"
      >
        <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 } 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/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/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/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",
        // },
      ],
    };
  },
  onShareAppMessage() {},
  mounted() {
    // demo();
  },
  onLoad() {
    this.getUserPower();
  },
  methods: {
    // 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;
}
.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: 450rpx;
  border-radius: 48rpx 48rpx 0rpx 0rpx;
  background: white;
  margin-top: 402rpx;
  padding: 48rpx 32rpx;
}
</style>
