<template>
    <div>
        <div class="deviceOvery">
            <div class="alarm">
                <div class="deviceIMG">
                    <div class="deviceNum">{{ DataOverview.totalDevices || '0' }} <span>个</span></div>
                </div>
                <div class="deviceText">设备总数</div>
            </div>

            <div class="alarm">
                <div class="deviceIMG">
                    <div class="deviceNum">{{ DataOverview.onlineDevices || '0' }} <span>个</span></div>
                </div>
                <div class="deviceText">在线数量</div>
            </div>
            <div class="alarm">
                <div class="deviceIMG">
                    <div class="deviceNum">{{ DataOverview.deviceTypes || '0' }} <span>种</span></div>
                </div>
                <div class="deviceText">设备型号</div>
            </div>
        </div>
    </div>
</template>
<script setup lang="ts">
import { getDeviceOverview } from '@/api/homeIndex'
const DataOverview = ref<any>({})
const getData = () => {
    getDeviceOverview({}).then((res) => {
        if (res.code == 200) {
            DataOverview.value = res.data
        }

    })
}
onMounted(() => {
    getData();
})

const timerAlarm = setInterval(() => {
    getData();
}, 300000);
onUnmounted(() => {
    clearInterval(timerAlarm);
});
</script>
<style scoped lang="scss">
.deviceOvery {
    display: flex;
    justify-content: space-between;
    width: 100%;
    align-items: center;
    margin-top: 7.5vh;
    text-align: center;
    font-size: 0.7vw;
    color: #DEEFFF;
    padding: 1.5vw;
}

.deviceIMG {
    width: 12vh;
    height: 12vh;
    background: url(@/assets/homeIndex/deviceIMG.png) no-repeat;
    background-size: 100% 100%;
    position: relative;

}

.deviceText {
    padding-top: 1.5vh;
}

.deviceNum {
    line-height: 12vh;
    display: inline-block;
    position: relative;
    background: radial-gradient(circle at center, #00FCFF 0%, #FFFFFF 49%);
    /* 兼容写法 */
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    z-index: 1;
    overflow: visible;
    font-size: 1.3vw;
    font-weight: 600;
}

.deviceNum span {
    font-size: 0.6vw;
}
</style>