diff --git a/frontend/src/stores/recipes.js b/frontend/src/stores/recipes.js index 76729fe..42ed836 100644 --- a/frontend/src/stores/recipes.js +++ b/frontend/src/stores/recipes.js @@ -2,7 +2,7 @@ import { defineStore } from 'pinia' import { ref } from 'vue' import { api } from '../composables/useApi' -export const EDITOR_ONLY_TAGS = ['已审核'] +export const EDITOR_ONLY_TAGS = ['已审核', '已下架'] export const useRecipesStore = defineStore('recipes', () => { const recipes = ref([]) diff --git a/frontend/src/views/RecipeSearch.vue b/frontend/src/views/RecipeSearch.vue index 768979f..d5df405 100644 --- a/frontend/src/views/RecipeSearch.vue +++ b/frontend/src/views/RecipeSearch.vue @@ -250,7 +250,7 @@ function slideCat(dir) { // Public recipes (all recipes in the public library) const filteredRecipes = computed(() => { - let list = recipeStore.recipes + let list = recipeStore.recipes.filter(r => !r.tags || !r.tags.includes('已下架')) if (selectedCategory.value) { list = list.filter(r => r.tags && r.tags.includes(selectedCategory.value)) } @@ -318,6 +318,7 @@ const exactResults = computed(() => { const q = searchQuery.value.trim().toLowerCase() const isEn = /^[a-zA-Z\s]+$/.test(q) return recipeStore.recipes.filter(r => { + if (r.tags && r.tags.includes('已下架')) return false const nameMatch = r.name.toLowerCase().includes(q) const enNameMatch = isEn && (r.en_name || '').toLowerCase().includes(q) const oilEnMatch = isEn && r.ingredients.some(ing => (oilEn(ing.oil) || '').toLowerCase().includes(q)) @@ -336,6 +337,7 @@ const similarResults = computed(() => { const terms = expandQuery(q).filter(t => t.length >= 2 || t === q) return recipeStore.recipes.filter(r => { + if (r.tags && r.tags.includes('已下架')) return false if (exactIds.has(r._id)) return false const name = r.name // Match by expanded synonyms (name only, not ingredients) @@ -375,7 +377,7 @@ const myDiaryRecipes = computed(() => { const favoritesPreview = computed(() => { if (!auth.isLoggedIn) return [] - let list = recipeStore.recipes.filter(r => recipeStore.isFavorite(r)) + let list = recipeStore.recipes.filter(r => recipeStore.isFavorite(r) && !(r.tags && r.tags.includes('已下架'))) if (searchQuery.value.trim()) { const q = searchQuery.value.trim().toLowerCase() list = list.filter(r => {