wuzhen update
This commit is contained in:
1 parent
edaf8dbacf
commit
48da578546
86 files changed
+2101
-1849
No files matched your search
@@ -6,7 +6,7 @@
|
||||
|
||||
<div v-else>
|
||||
<!-- 移除统计信息部分 -->
|
||||
|
||||
|
||||
<el-table :data="ratings" height="600" border stripe>
|
||||
<!-- 基本信息 - 减少宽度 -->
|
||||
<el-table-column label="评分人信息" width="160" fixed="left">
|
||||
@@ -18,7 +18,7 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
||||
<!-- 所属信息 - 减少宽度 -->
|
||||
<el-table-column label="所属信息" width="140">
|
||||
<template #default="scope">
|
||||
@@ -117,19 +117,23 @@ const averageRating = computed(() => {
|
||||
// 计算最高评分
|
||||
const maxRating = computed(() => {
|
||||
if (ratings.value.length === 0) return 0;
|
||||
return Math.max(...ratings.value.map((rating) => {
|
||||
const score = typeof rating.ratingScore === 'string' ? parseFloat(rating.ratingScore) : rating.ratingScore;
|
||||
return isNaN(score) ? 0 : score;
|
||||
}));
|
||||
return Math.max(
|
||||
...ratings.value.map((rating) => {
|
||||
const score = typeof rating.ratingScore === 'string' ? parseFloat(rating.ratingScore) : rating.ratingScore;
|
||||
return isNaN(score) ? 0 : score;
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
// 计算最低评分
|
||||
const minRating = computed(() => {
|
||||
if (ratings.value.length === 0) return 0;
|
||||
return Math.min(...ratings.value.map((rating) => {
|
||||
const score = typeof rating.ratingScore === 'string' ? parseFloat(rating.ratingScore) : rating.ratingScore;
|
||||
return isNaN(score) ? 0 : score;
|
||||
}));
|
||||
return Math.min(
|
||||
...ratings.value.map((rating) => {
|
||||
const score = typeof rating.ratingScore === 'string' ? parseFloat(rating.ratingScore) : rating.ratingScore;
|
||||
return isNaN(score) ? 0 : score;
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
// 简化的日期时间格式化
|
||||
@@ -171,12 +175,16 @@ const loadRatings = async () => {
|
||||
};
|
||||
|
||||
// 监听 activityId 变化,自动重新加载评分数据
|
||||
watch(() => props.activityId, (newId, oldId) => {
|
||||
console.log('活动ID发生变化:', oldId, '->', newId);
|
||||
if (newId && newId !== oldId) {
|
||||
loadRatings();
|
||||
}
|
||||
}, { immediate: true }); // immediate: true 确保组件挂载时也会执行一次
|
||||
watch(
|
||||
() => props.activityId,
|
||||
(newId, oldId) => {
|
||||
console.log('活动ID发生变化:', oldId, '->', newId);
|
||||
if (newId && newId !== oldId) {
|
||||
loadRatings();
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
); // immediate: true 确保组件挂载时也会执行一次
|
||||
|
||||
// 移除 onMounted,因为 watch 的 immediate: true 已经覆盖了这个功能
|
||||
</script>
|
||||
|
||||
Reference in new issue
Block a user