Files
dyf-vue-ui/src/views/homeIndex/components/DeviceOverview.vue

92 lines
2.2 KiB
Vue
Raw Normal View History

2025-09-27 16:10:17 +08:00
<template>
2025-09-28 15:28:15 +08:00
<div>
<div class="deviceOvery">
<div class="alarm">
<div class="deviceIMG">
2025-09-30 10:59:31 +08:00
<div class="deviceNum">{{ DataOverview.totalDevices || '0' }} <span></span></div>
2025-09-28 15:28:15 +08:00
</div>
<div class="deviceText">设备总数</div>
</div>
<div class="alarm">
<div class="deviceIMG">
2025-09-30 10:59:31 +08:00
<div class="deviceNum">{{ DataOverview.onlineDevices || '0' }} <span></span></div>
2025-09-28 15:28:15 +08:00
</div>
<div class="deviceText">在线数量</div>
</div>
<div class="alarm">
<div class="deviceIMG">
2025-09-30 10:59:31 +08:00
<div class="deviceNum">{{ DataOverview.deviceTypes || '0' }} <span></span></div>
2025-09-28 15:28:15 +08:00
</div>
<div class="deviceText">设备型号</div>
</div>
</div>
</div>
2025-09-27 16:10:17 +08:00
</template>
2025-09-28 15:28:15 +08:00
<script setup lang="ts">
import { getDeviceOverview } from '@/api/homeIndex'
const DataOverview = ref<any>({})
2025-09-30 10:59:31 +08:00
const getData = () => {
getDeviceOverview({}).then((res) => {
if (res.code == 200) {
DataOverview.value = res.data
}
})
}
2025-09-28 15:28:15 +08:00
onMounted(() => {
2025-09-30 10:59:31 +08:00
getData();
2025-09-28 15:28:15 +08:00
})
2025-09-30 10:59:31 +08:00
const timerAlarm = setInterval(() => {
getData();
}, 300000);
onUnmounted(() => {
clearInterval(timerAlarm);
});
2025-09-27 16:10:17 +08:00
</script>
2025-09-28 15:28:15 +08:00
<style scoped lang="scss">
.deviceOvery {
display: flex;
justify-content: space-between;
width: 100%;
align-items: center;
margin-top: 7.5vh;
text-align: center;
2025-09-30 10:59:31 +08:00
font-size: 0.7vw;
2025-09-28 15:28:15 +08:00
color: #DEEFFF;
padding: 1.5vw;
}
.deviceIMG {
width: 12vh;
height: 12vh;
background: url(@/assets/homeIndex/deviceIMG.png) no-repeat;
background-size: 100% 100%;
position: relative;
}
2025-09-30 10:59:31 +08:00
.deviceText {
2025-09-28 15:28:15 +08:00
padding-top: 1.5vh;
}
2025-09-30 10:59:31 +08:00
.deviceNum {
2025-09-28 15:28:15 +08:00
line-height: 12vh;
display: inline-block;
2025-09-30 10:59:31 +08:00
position: relative;
2025-09-28 15:28:15 +08:00
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;
}
2025-09-30 10:59:31 +08:00
.deviceNum span {
2025-09-28 15:28:15 +08:00
font-size: 0.6vw;
}
</style>