From e04d572f2704684f732340a83cb7ec1246f0d9a9 Mon Sep 17 00:00:00 2001 From: Hera Zhao Date: Thu, 9 Apr 2026 16:50:26 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=B8=8B=E6=9E=B6=E5=90=8E=E5=8D=A1?= =?UTF-8?q?=E7=89=87=E5=8F=98=E7=81=B0+=E6=8C=89=E9=92=AE=E5=8F=98?= =?UTF-8?q?=E7=81=B0=EF=BC=8CisActive=E5=AD=98=E4=B8=BAboolean?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因: oils store 存 isActive = oil.is_active ?? true oil.is_active=0 时 0??true=0,但检查用 ===false,0!==false 修复: isActive = oil.is_active !== 0 (true/false boolean) UI: - 下架后弹窗不关闭,按钮变灰显示"✓ 已下架 · 点击重新上架" - 卡片立即变灰(oil-chip--inactive class生效) - 重新上架后恢复正常 Co-Authored-By: Claude Opus 4.6 (1M context) --- frontend/src/stores/oils.js | 2 +- frontend/src/views/OilReference.vue | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/frontend/src/stores/oils.js b/frontend/src/stores/oils.js index 1509776..b64f6a0 100644 --- a/frontend/src/stores/oils.js +++ b/frontend/src/stores/oils.js @@ -68,7 +68,7 @@ export const useOilsStore = defineStore('oils', () => { bottlePrice: oil.bottle_price, dropCount: oil.drop_count, retailPrice: oil.retail_price ?? null, - isActive: oil.is_active ?? true, + isActive: oil.is_active !== 0, enName: oil.en_name ?? null, } } diff --git a/frontend/src/views/OilReference.vue b/frontend/src/views/OilReference.vue index 5552c76..277b861 100644 --- a/frontend/src/views/OilReference.vue +++ b/frontend/src/views/OilReference.vue @@ -330,9 +330,11 @@
+ >{{ getMeta(editingOilName)?.isActive === false ? '✓ 已下架 · 点击重新上架' : '下架' }}
@@ -702,7 +704,6 @@ async function toggleOilActive() { await oils.loadOils() cardVersion.value++ ui.showToast(newActive ? '已重新上架' : '已下架') - editingOilName.value = null } catch (e) { ui.showToast('网络错误: ' + e.message) }