作者 dong

首页修改

@@ -63,7 +63,7 @@ @@ -63,7 +63,7 @@
63 }, 63 },
64 buttonStats: { 64 buttonStats: {
65 // 添加按钮统计属性 65 // 添加按钮统计属性
66 - type: Array as () => Array<{ question: string; total: number }>, 66 + type: Array as () => Array<{ name: string; total: number }>,
67 default: () => [], 67 default: () => [],
68 }, 68 },
69 }); 69 });
@@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
17 </div> 17 </div>
18 </template> 18 </template>
19 <script lang="ts" setup> 19 <script lang="ts" setup>
20 - import { computed, onMounted, onUnmounted, ref, watch } from 'vue'; 20 + import { computed, onMounted, ref, watch } from 'vue';
21 import ChartGroupCard from '../components/ChartGroupCard.vue'; 21 import ChartGroupCard from '../components/ChartGroupCard.vue';
22 import SaleTabCard from '../components/SaleTabCard.vue'; 22 import SaleTabCard from '../components/SaleTabCard.vue';
23 import HeadInfo from '/@/components/chart/HeadInfo.vue'; 23 import HeadInfo from '/@/components/chart/HeadInfo.vue';
@@ -35,7 +35,7 @@ @@ -35,7 +35,7 @@
35 rejectedCount: 0, 35 rejectedCount: 0,
36 totalCount: 0, 36 totalCount: 0,
37 averageCount: 0, 37 averageCount: 0,
38 - buttonStats: [] as { question: string; count: number }[], 38 + buttonStats: [] as { name: string; total: number }[],
39 monthlyData: [] as { month: string; count: number }[], 39 monthlyData: [] as { month: string; count: number }[],
40 }); 40 });
41 41
@@ -74,8 +74,8 @@ @@ -74,8 +74,8 @@
74 // 转换按钮统计数据格式 74 // 转换按钮统计数据格式
75 const buttonStats = computed(() => { 75 const buttonStats = computed(() => {
76 return statistics.value.buttonStats.map((item) => ({ 76 return statistics.value.buttonStats.map((item) => ({
77 - name: item.question,  
78 - total: item.count, 77 + name: item.name,
  78 + total: item.total,
79 })); 79 }));
80 }); 80 });
81 // 在 setup 中添加转换函数 81 // 在 setup 中添加转换函数
@@ -91,18 +91,9 @@ @@ -91,18 +91,9 @@
91 }; 91 };
92 }); 92 });
93 }); 93 });
94 - // 设置实时更新  
95 - let refreshTimer: number | null = null;  
96 94
97 onMounted(() => { 95 onMounted(() => {
98 fetchStatistics(); 96 fetchStatistics();
99 -  
100 - // 每5秒更新一次数据(根据需求调整间隔)  
101 - refreshTimer = setInterval(fetchStatistics, 5000) as unknown as number;  
102 - });  
103 -  
104 - onUnmounted(() => {  
105 - if (refreshTimer) clearInterval(refreshTimer);  
106 }); 97 });
107 98
108 setTimeout(() => { 99 setTimeout(() => {