<template>
  <div class="home">
    <layout>
      <template #left>
        <leftDesk :resultData="leftData"></leftDesk>
      </template>
      <template #right>
        <reightDesk :resultData="leftData"></reightDesk>
      </template>
    </layout>
  </div>
</template>

<script setup>
import { getHome } from "@/api/home"
import { ref, reactive } from 'vue';
import layout from "@/components/layout_/index.vue";
import leftDesk from './index/leftDesk.vue'
import reightDesk from './index/reightDesk.vue'
const intervalId = ref(null)

const leftData = ref({})
// 生命周期
onMounted(() => {
  intervalId.value = setInterval(getHomeData, 10000);
  getHomeData()
});
onUnmounted(() => {
  clearInterval(intervalId.value);
})
function getHomeData() {
  getHome().then((res)=>{
    if(res.code == 200){
      leftData.value = res.data
    }
  })
}
</script>

<style lang="scss">
.home {
  position: relative;
  width: 100%;
  // height: 100vh;
  height: 100%;
  overflow: hidden;
}

.color-cyan {
  background-color: rgb(88, 240, 222);
}

.color-yellow {
  background-color: rgb(242, 179, 39);
}

.color-blue {
  background-color: rgb(76, 155, 255);
}

.color-red {
  background-color: rgb(239, 93, 57);
}

.text-cyan {
  color: rgb(88, 240, 222);
}

.text-yellow {
  color: rgb(242, 179, 39);
}

.text-blue {
  color: rgb(76, 155, 255);
}

.text-red {
  color: rgb(239, 93, 57);
}
</style>
