From 2728896a1e260f4af036dd030c95c2dd975d7143 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Tue, 4 Aug 2026 13:39:27 +0800 Subject: [PATCH] Propagate plugin rating updates and preserve rating snapshots --- src/components/cards/PluginCard.vue | 5 +- src/components/cards/PluginMixedSortCard.vue | 3 + .../cards/__tests__/PluginCardAbout.spec.ts | 12 +++- .../dialog/PluginMarketDetailDialog.vue | 31 ++++----- .../PluginMarketDetailDialog.spec.ts | 32 +++++++-- src/views/plugin/PluginCardListView.vue | 61 +++++++++++++--- .../__tests__/PluginCardListView.spec.ts | 69 +++++++++++++++++++ 7 files changed, 175 insertions(+), 38 deletions(-) diff --git a/src/components/cards/PluginCard.vue b/src/components/cards/PluginCard.vue index a7cd52c0..1a6307a3 100644 --- a/src/components/cards/PluginCard.vue +++ b/src/components/cards/PluginCard.vue @@ -2,7 +2,7 @@ import { useToast } from 'vue-toastification' import { useConfirm } from '@/composables/useConfirm' import api from '@/api' -import type { ApiResponse, Plugin } from '@/api/types' +import type { ApiResponse, Plugin, PluginRating } from '@/api/types' import { getLogoUrl } from '@/utils/imageUtils' import { getCardAccentRgbFromImage } from '@/composables/useCardAccentColor' import { formatDownloadCount } from '@/@core/utils/formatters' @@ -34,7 +34,7 @@ const props = defineProps({ }) // 定义触发的自定义事件 -const emit = defineEmits(['remove', 'save', 'actionDone']) +const emit = defineEmits(['remove', 'save', 'actionDone', 'rating']) // 多语言 const { t } = useI18n() @@ -392,6 +392,7 @@ async function showPluginAbout() { // 详情弹窗的安装事件只刷新父列表,动态导航由卡片补充同步。 void pluginSidebarNavStore.ensureSidebarNav(true) }, + rating: (pluginRating: PluginRating) => emit('rating', pluginRating), }, { closeOn: ['close', 'install', 'update:modelValue'] }, ) diff --git a/src/components/cards/PluginMixedSortCard.vue b/src/components/cards/PluginMixedSortCard.vue index ae6fe483..53881746 100644 --- a/src/components/cards/PluginMixedSortCard.vue +++ b/src/components/cards/PluginMixedSortCard.vue @@ -1,4 +1,5 @@