<template>
  <view class="content">
    <view class="bg-box">
      <view class="homo-title">首页</view>
      <image
        class="bg-logo"
        style="width: 200rpx; height: 170rpx"
        src="/static/adminImg/bg-logo.png"
      ></image>
      <image
        class="bg-hi"
        style="width: 130rpx; height: 50rpx"
        src="/static/adminImg/logo-hi.png"
      ></image>
      <view style="height: 150rpx"></view>
      <view class="tip">欢迎使用,张三</view>
      <view class="desc">欢迎使用巡检管理员端</view>
      <view class="card">
        <view class="card-item">
          <view class="item-title">区域数量 </view>
          <view class="item-totel">10 </view>
          <image
            class="card-img"
            style="width: 130rpx; height: 130rpx"
            src="/static/adminImg/card1.png"
          ></image>
        </view>
        <view class="card-item">
          <view class="item-title">子区域数量 </view>
          <view class="item-totel">20 </view>
          <image
            class="card-img"
            style="width: 130rpx; height: 130rpx"
            src="/static/adminImg/card2.png"
          ></image>
        </view>
        <view class="card-item">
          <view class="item-title">已绑定子区域数 </view>
          <view class="item-totel">30 </view>
          <image
            class="card-img"
            style="width: 130rpx; height: 130rpx"
            src="/static/adminImg/card3.png"
          ></image>
        </view>
        <view class="card-item">
          <view class="item-title">未绑定子区域数 </view>
          <view class="item-totel">40 </view>
          <image
            class="card-img"
            style="width: 130rpx; height: 130rpx"
            src="/static/adminImg/card4.png"
          ></image>
        </view>
      </view>
      <view v-if="true" style="display: flex">
        <u-button type="error" @click="testFn">调试录入卡片</u-button>
      </view>
    </view>
    <u-tabbar :list="vuex_tabbar"></u-tabbar>
  </view>
</template>
<script>
import { loginApi } from "@/api/apiList";
export default {
  data() {
    return {
      phone: "13800451500",
      pwd: "123456",
    };
  },
  mounted() {
    uni.hideLoading(); // 关闭 Loading
  },
  onLoad() {},
  methods: {
    testFn() {
      let u = navigator.userAgent;
      let isAndroid = u.indexOf("Android") > -1 || u.indexOf("Adr") > -1; //android
      // let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios
      try {
        if (isAndroid && AndroidJs) {
          console.log("%c%s", "color:red", "安卓--调用方法");
          const reqRow = {
            name: "input",
            data: "",
          };
          AndroidJs.func(JSON.stringify(reqRow)); // 给安卓传参
        } else {
          console.log("%c%s", "color:red", "苹果--调用方法");
          const reqRow = {
            name: "back-iphone",
            data: "",
          };
          window.webkit.messageHandlers.func.postMessage(JSON.stringify(reqRow)); // 给ios 传参
        }
      } catch (e) {
        console.log(e, "e-----判断安卓苹果类型出错");
      }
    },
  },
};
</script>
<style lang="scss" scoped>
.content {
  height: calc(100vh - 100rpx); // 确保容器有明确高度
  // background-color: skyblue;

  overflow: hidden;
  // padding-bottom: 100rpx;
  .bg-box {
    position: relative;
    // background-color: #528dfe;
    background: linear-gradient(to bottom, #3179fb, white);
    height: 650rpx;
    .homo-title {
      color: white;
      transform: translateY(30rpx);
      font-size: 35rpx;
      text-align: center;
    }
    .bg-logo {
      position: absolute;
      right: 50rpx;
      top: 160rpx;
    }
    .bg-hi {
      position: absolute;
      left: 30rpx;
      top: 200rpx;
    }

    .tip {
      padding-left: 120rpx;
      color: white;
      font-size: 40rpx;
    }
    .desc {
      margin-top: 20rpx;
      padding-left: 30rpx;
      color: #ffffff99;
    }
    .card {
      // border: 1px solid red;
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      grid-template-rows: repeat(2, 1fr);
      gap: 30rpx;
      padding: 50rpx;
      .card-item {
        position: relative;
        // border: 1px solid blue;
        border-radius: 20rpx;
        // background-color: red;
        background: linear-gradient(to bottom, white, #e1e9ff);
        height: 280rpx;
        padding: 30rpx;
        .item-title {
          font-size: 30rpx;
        }
        .item-totel {
          font-size: 50rpx;
        }
        .card-img {
          position: absolute;
          right: 20rpx;
          bottom: 20rpx;
        }
      }
    }
  }
}
</style>
