|
@@ -1,6 +1,7 @@
|
|
|
<!-- 数据卡片 -->
|
|
|
<script setup lang="ts">
|
|
|
import SvgIcon from "@/components/SvgIcon/index.vue";
|
|
|
+import { useTransition, TransitionPresets } from "@vueuse/core";
|
|
|
const props = defineProps({
|
|
|
classes: {
|
|
|
type: Number,
|
|
@@ -28,6 +29,36 @@ const props = defineProps({
|
|
|
required: true,
|
|
|
},
|
|
|
});
|
|
|
+// 卡片数字动效
|
|
|
+function countNumber(number) {
|
|
|
+ return useTransition(number, {
|
|
|
+ duration: 5000,
|
|
|
+ transition: TransitionPresets.easeOutExpo,
|
|
|
+ });
|
|
|
+}
|
|
|
+// 全部班级
|
|
|
+const classCount = ref(0);
|
|
|
+const classCountOutput = countNumber(classCount);
|
|
|
+// 全部教师
|
|
|
+const teacherCount = ref(0);
|
|
|
+const teacherCountOutput = countNumber(teacherCount);
|
|
|
+// 全部学生
|
|
|
+const studentCount = ref(0);
|
|
|
+const studentCountOutput = countNumber(studentCount);
|
|
|
+// 设备套数
|
|
|
+const equipmentCount = ref(0);
|
|
|
+const equipmentCountOutput = countNumber(equipmentCount);
|
|
|
+// 累计训练次数
|
|
|
+const trainingCount = ref(0);
|
|
|
+const trainingCountOutput = countNumber(trainingCount);
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ classCount.value = <number>props.classes;
|
|
|
+ teacherCount.value = <number>props.teachers;
|
|
|
+ studentCount.value = <number>props.students;
|
|
|
+ equipmentCount.value = <number>props.equipments;
|
|
|
+ trainingCount.value = <number>props.trainings;
|
|
|
+});
|
|
|
</script>
|
|
|
<template>
|
|
|
<el-row :gutter="40" class="mb-4">
|
|
@@ -40,7 +71,7 @@ const props = defineProps({
|
|
|
</div>
|
|
|
<div class="flex flex-col space-y-3">
|
|
|
<div class="text-[var(--el-text-color-secondary)]">全部班级</div>
|
|
|
- <div class="text-lg">{{ Math.round(classes) }}</div>
|
|
|
+ <div class="text-lg">{{ Math.round(classCountOutput) }}</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</el-col>
|
|
@@ -53,7 +84,7 @@ const props = defineProps({
|
|
|
</div>
|
|
|
<div class="flex flex-col space-y-3">
|
|
|
<div class="text-[var(--el-text-color-secondary)]">全部教师</div>
|
|
|
- <div class="text-lg">{{ Math.round(teachers) }}</div>
|
|
|
+ <div class="text-lg">{{ Math.round(teacherCountOutput) }}</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</el-col>
|
|
@@ -66,7 +97,7 @@ const props = defineProps({
|
|
|
</div>
|
|
|
<div class="flex flex-col space-y-3">
|
|
|
<div class="text-[var(--el-text-color-secondary)]">全部学生</div>
|
|
|
- <div class="text-lg">{{ Math.round(students) }}</div>
|
|
|
+ <div class="text-lg">{{ Math.round(studentCountOutput) }}</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</el-col>
|
|
@@ -80,7 +111,7 @@ const props = defineProps({
|
|
|
<div class="flex flex-col space-y-3">
|
|
|
<div class="text-[var(--el-text-color-secondary)]">设备套数</div>
|
|
|
<div class="text-lg">
|
|
|
- {{ Math.round(equipments) }}
|
|
|
+ {{ Math.round(equipmentCountOutput) }}
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -95,7 +126,7 @@ const props = defineProps({
|
|
|
<div class="flex flex-col space-y-3">
|
|
|
<div class="text-[var(--el-text-color-secondary)]">累计训练次数</div>
|
|
|
<div class="text-lg">
|
|
|
- {{ Math.round(trainings) }}
|
|
|
+ {{ Math.round(trainingCountOutput) }}
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|