<template>
  <div id="smartDatav">
    <dv-full-screen-container class="bg">
      <dv-loading v-if="loading">Loading...</dv-loading>
      <div v-else class="host-body" style="width: 100%;height: 100%;">
        <headBtn></headBtn>
        <div class="d-flex jc-center">
          <dv-decoration-10 style="width:33.3%;height:.0625rem;" />
          <div class="d-flex jc-center">
            <dv-decoration-8 :color="['#568aea', '#000000']" style="width:2.5rem;height:.625rem;" />
            <div class="title">
              <span class="title-text">智慧社区公安警务平台</span>
              <dv-decoration-6
                class="title-bototm"
                :reverse="true"
                :color="['#50e3c2', '#67a1e5']"
                style="width:3.125rem;height:.1rem;"
              />
            </div>
            <dv-decoration-8
              :reverse="true"
              :color="['#568aea', '#000000']"
              style="width:2.5rem;height:.625rem;"
            />
          </div>
          <dv-decoration-10 style="width:33.3%;height:.0625rem; transform: rotateY(180deg);" />
        </div>

        <!-- 第二行 -->
        <div class="d-flex jc-between px-2">
          <div class="d-flex" style="width: 40%">
            <div
              class="react-right ml-4"
              style="width: 6.25rem; text-align: left;background-color: #0f1325;"
              @click="jump('2')"
            >
              <span class="react-before"></span>
              <span class="text">数据分析</span>
            </div>
            <div class="react-right ml-3" style="background-color: #0f1325;">
              <!-- <span class="text colorBlue">数据分析</span> -->
            </div>
          </div>
          <div style="width: 40%" class="d-flex">
            <div class="react-left mr-3"  style="background-color: #0f1325;">
              <span class="text fw-b"></span>
            </div>
            <div
              class="react-left mr-4"
              style="width: 6.25rem; background-color: #0f1325; text-align: right;"
            >
              <span class="react-after"></span>
              <span class="text">{{dateYear}} {{dateWeek}} {{dateDay}}</span>
            </div>
          </div>
        </div>

        <div style="width: 100%;height: 100%;display: flex;">
          <div style="width: 30%;height: 100%;">
            <border3 title="小区类型">
              <cmp5></cmp5>
            </border3>
            <border3 title="房屋数据">
              <cmp6></cmp6>
            </border3>
            <border3 title="汽车数据">
              <cmp1></cmp1>
            </border3>
          </div>
          <div style="width: 40%;height: 100%;">
            <mapCmp></mapCmp>
          </div>
          <div style="width: 30%;height: 100%;">
            <border3 title="年龄分布" showType="right" >
              <cmp2></cmp2>
            </border3>
            <border3 title="特殊人员统计" showType="right">
              <cmp3></cmp3>
            </border3>
            <border3 title="特殊人员流动率" showType="right">
              <cmp4></cmp4>
            </border3>
          </div>
        </div>
      </div>
    </dv-full-screen-container>
  </div>

</template>

<script>
import { formatTime } from './utils/index.js'
import centerLeft1 from "./components/centerLeft1";
import centerLeft2 from "./components/centerLeft2";
import centerRight1 from "./components/centerRight1";
import centerRight2 from "./components/centerRight2";
import center from "./components/center";
import bottomLeft from "./components/bottomLeft";
import bottomRight from "./components/bottomRight";
import border3 from "./components/border3.vue"
import cmp1 from "./components/policeCmp/cmp1.vue"
import cmp2 from "./components/policeCmp/cmp2.vue"
import cmp3 from "./components/policeCmp/cmp3.vue"
import cmp4 from "./components/policeCmp/cmp4.vue"
import cmp5 from "./components/policeCmp/cmp5.vue"
import cmp6 from "./components/policeCmp/cmp6.vue"
import mapCmp from "./components/policeCmp/map.vue"
import headBtn from "./components/headBtn.vue"
export default {
  data () {
    return {
      loading: true,
      dateDay: null,
      dateYear: null,
      dateWeek: null,
      weekday: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
    };
  },
  components: {
    centerLeft1,
    centerLeft2,
    centerRight1,
    centerRight2,
    center,
    bottomLeft,
    bottomRight,
    border3,
    cmp1,
    cmp2,
    cmp3,
    cmp4,
    cmp5,
    cmp6,
    mapCmp,
    headBtn
  },
  mounted () {
    this.timeFn();
    this.cancelLoading();
  },
  methods: {
    jump(v){
          let path;
          if(v==2){
            path = 'policeData'
          }
          this.$router.push({path:path})
        },
    timeFn () {
      setInterval(() => {
        this.dateDay = formatTime(new Date(), 'HH: mm: ss');
        this.dateYear = formatTime(new Date(), 'yyyy-MM-dd');
        this.dateWeek = this.weekday[new Date().getDay()];
      }, 1000)
    },
    cancelLoading () {
      setTimeout(() => {
        this.loading = false;
      }, 500);
    }
  }
};
</script>

<style lang="scss">
    @import './assets/scss/index.scss';
</style>
