作者 dong

首页修改

... ... @@ -63,7 +63,7 @@
},
buttonStats: {
// 添加按钮统计属性
type: Array as () => Array<{ question: string; total: number }>,
type: Array as () => Array<{ name: string; total: number }>,
default: () => [],
},
});
... ...
... ... @@ -17,7 +17,7 @@
</div>
</template>
<script lang="ts" setup>
import { computed, onMounted, onUnmounted, ref, watch } from 'vue';
import { computed, onMounted, ref, watch } from 'vue';
import ChartGroupCard from '../components/ChartGroupCard.vue';
import SaleTabCard from '../components/SaleTabCard.vue';
import HeadInfo from '/@/components/chart/HeadInfo.vue';
... ... @@ -35,7 +35,7 @@
rejectedCount: 0,
totalCount: 0,
averageCount: 0,
buttonStats: [] as { question: string; count: number }[],
buttonStats: [] as { name: string; total: number }[],
monthlyData: [] as { month: string; count: number }[],
});
... ... @@ -74,8 +74,8 @@
// 转换按钮统计数据格式
const buttonStats = computed(() => {
return statistics.value.buttonStats.map((item) => ({
name: item.question,
total: item.count,
name: item.name,
total: item.total,
}));
});
// 在 setup 中添加转换函数
... ... @@ -91,18 +91,9 @@
};
});
});
// 设置实时更新
let refreshTimer: number | null = null;
onMounted(() => {
fetchStatistics();
// 每5秒更新一次数据(根据需求调整间隔)
refreshTimer = setInterval(fetchStatistics, 5000) as unknown as number;
});
onUnmounted(() => {
if (refreshTimer) clearInterval(refreshTimer);
});
setTimeout(() => {
... ...