From bb50d5d925e9b770ec33718f244d7e6292d9b44f Mon Sep 17 00:00:00 2001 From: Yuzhiran Dev Date: Mon, 18 May 2026 06:14:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BB=8A=E6=97=A5=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E7=AD=9B=E9=80=89filteredTopics=E6=9C=AA=E5=A4=84=E7=90=86'tod?= =?UTF-8?q?ay'=E5=AF=BC=E8=87=B4=E5=A7=8B=E7=BB=88=E4=B8=BA=E7=A9=BA?= =?UTF-8?q?=EF=BC=8C=E7=8A=B6=E6=80=81=E7=AD=9B=E9=80=89=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E5=85=A8=E9=87=8F=E6=8B=89=E5=8F=96=E4=BF=9D=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E5=87=86=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - filteredTopics 对 filterStatus='today' 直接返回 this.topics(服务器已按日期过滤),避免按不存在的 status 再次过滤导致空列表 - fetchTopics 改为只有 'today' 走服务端 ?today=true;其他状态仍然全量拉取后客户端过滤,保证 statusStats 统计按钮数字准确 - 保留 watch 移除(用户能自由清除筛选) --- platform/frontend/topics.html | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/platform/frontend/topics.html b/platform/frontend/topics.html index 74a7162..6cf7775 100644 --- a/platform/frontend/topics.html +++ b/platform/frontend/topics.html @@ -190,7 +190,7 @@ const TopicsApp = { }, computed: { filteredTopics() { - if (!this.filterStatus) return this.topics; + if (!this.filterStatus || this.filterStatus === 'today') return this.topics; const map = { 'pending': ['pending','待处理'], 'review': ['review','待审查'], 'ready': ['ready','待发布'], 'published': ['published','已发布'] }; const allowed = map[this.filterStatus] || [this.filterStatus]; return this.topics.filter(t => allowed.includes(t.status)); @@ -235,16 +235,9 @@ const TopicsApp = { async fetchTopics() { this.loadingTable = true; try { - const params = new URLSearchParams(); - if (this.filterStatus === 'today') { - params.set('today', 'true'); - } else if (this.filterStatus) { - params.set('status', this.filterStatus); - } - const qs = params.toString(); - const data = await this.api('/api/topics' + (qs ? '?' + qs : '')); + const params = this.filterStatus === 'today' ? '?today=true' : ''; + const data = await this.api('/api/topics' + params); this.topics = data || []; - if (qs) this.$message.success(`加载 ${this.filterStatus} 选题成功`); } catch (error) { console.error('获取选题失败:', error); this.$message.error(`获取选题失败: ${error.message}`);