From f050d38140e567fdf149fbd5667725512c5e46e1 Mon Sep 17 00:00:00 2001 From: dmy Date: Tue, 13 Jan 2026 21:16:23 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=9E=E7=8E=B0=20PinnedProject=20?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E4=B8=8E=E7=88=B6=E7=BB=84=E4=BB=B6=E7=9A=84?= =?UTF-8?q?=E5=8F=8C=E5=90=91=E4=BA=A4=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加 PinnedProject 组件引用和 pin-changed 事件处理 在 Dashboard 和 Dashboard-AI 中同步 pin 状态 暴露 loadPinnedBids 方法供父组件调用 --- frontend/src/components/Dashboard-AI.vue | 18 ++++++++- frontend/src/components/Dashboard.vue | 46 ++++++++++++++++++++++- frontend/src/components/PinnedProject.vue | 11 ++++++ 3 files changed, 72 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/Dashboard-AI.vue b/frontend/src/components/Dashboard-AI.vue index d7f6e1a..a737d3b 100644 --- a/frontend/src/components/Dashboard-AI.vue +++ b/frontend/src/components/Dashboard-AI.vue @@ -7,7 +7,7 @@ 获取 AI 推荐 - + @@ -328,6 +328,18 @@ const getConfidenceType = (confidence: number) => { return 'info' } +// PinnedProject 组件引用 +const pinnedProjectRef = ref(null) + +// 处理 PinnedProject 组件的 pin 状态改变事件 +const handlePinChanged = async (title: string) => { + // 更新对应推荐项目的 pin 状态 + const rec = aiRecommendations.value.find(r => r.title === title) + if (rec) { + rec.pin = false + } +} + // 切换 AI 推荐项目的 Pin 状态 const togglePin = async (item: AIRecommendation) => { try { @@ -335,6 +347,10 @@ const togglePin = async (item: AIRecommendation) => { await axios.patch(`/api/bids/${encodeURIComponent(item.title)}/pin`, { pin: newPinStatus }) item.pin = newPinStatus ElMessage.success(newPinStatus ? '已置顶' : '已取消置顶') + // 刷新 PinnedProject 组件的数据 + if (pinnedProjectRef.value) { + pinnedProjectRef.value.loadPinnedBids() + } } catch (error) { ElMessage.error('操作失败') } diff --git a/frontend/src/components/Dashboard.vue b/frontend/src/components/Dashboard.vue index 7f19648..982be19 100644 --- a/frontend/src/components/Dashboard.vue +++ b/frontend/src/components/Dashboard.vue @@ -7,7 +7,7 @@ 立刻抓取 - +

Today's Bids

@@ -48,6 +48,20 @@
+ + +