<template>
  <scroll-view class="scroll-height" :scroll-y="true" :data-theme="'theme-' + proxy.$settingStore.themeColor.name">
    <view class="padding-sm">
      <!-- 宫格列表 -->
      <view class="section2 section bg-white">
        <view class="cu-list grid col-4 no-border" style="padding-top: 0.3125rem">
          <view class="cu-item justify-center align-center" v-for="(item, index) in inspectList" :key="index" @tap="navItemClick(item.redirectUrl, item.id)">
            <image :src="item.imgUrl" style="width: 40px; height: 40px"></image>
            <view class="cu-tag badge" v-if="item.badge != 0">
              <block v-if="item.badge != 0">{{ item.badge > 99 ? "99+" : item.badge }}</block>
            </view>
            <text style="font-size: 14px">{{ item.title }}</text>
          </view>
        </view>
      </view>
      <!-- 宫格列表 end -->
    </view>
  </scroll-view>
</template>

<script setup>
import { onLoad, onShow, onHide, onLaunch } from "@dcloudio/uni-app";
import { ref, reactive, computed, onMounted, getCurrentInstance, toRefs, inject } from "vue";
import { xunJianStores, publicStores } from "@/store/modules/index";

const publicStore = publicStores(); //全局公共Store
const xunJianStore = xunJianStores(); //全局变量值Store

const { proxy } = getCurrentInstance();

const inspectList = [
  {
    id: 1,
    title: "设施采集",
    badge: "0",
    imgUrl: "/static/images/xunjian/xunJian-icon1.png",
    redirectUrl: "/pages/business/fireIot/facilitiesGather/index",
  },
  {
    id: 2,
    title: "设施查看",
    badge: "0",
    imgUrl: "/static/images/xunjian/xunJian-icon2.png",
    redirectUrl: "/pages/business/fireIot/facilitiesView/index",
  },
]; //九宫格json数据

function navItemClick(url, id) {
  if (url) {
    uni.navigateTo({
      url: url,
    });
  } else {
    uni.showModal({
      title: "Tips",
      content: "此模块开发中~",
      showCancel: false,
      success: function (res) {
        if (res.confirm) {
        } else if (res.cancel) {
        }
      },
    });
  }
}

onLoad(() => {});

onShow(() => {
  //调用系统主题颜色
  proxy.$settingStore.systemThemeColor([1]);
});
</script>

<style lang="scss"></style>
