fix: 已审核标签对viewer完全不可见
Some checks failed
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 4s
Test / build-check (push) Successful in 3s
PR Preview / test (pull_request) Successful in 4s
PR Preview / deploy-preview (pull_request) Successful in 16s
Test / e2e-test (push) Has been cancelled
Some checks failed
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 4s
Test / build-check (push) Successful in 3s
PR Preview / test (pull_request) Successful in 4s
PR Preview / deploy-preview (pull_request) Successful in 16s
Test / e2e-test (push) Has been cancelled
- EDITOR_ONLY_TAGS常量从recipes store导出,统一引用 - RecipeCard: viewer不显示已审核标签 - RecipeSearch: viewer搜索不匹配已审核标签 - RecipeManager: 标签筛选栏、配方行标签对viewer隐藏 - 所有标签按字母排序(已有) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -20,11 +20,9 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
import { useOilsStore } from '../stores/oils'
|
import { useOilsStore } from '../stores/oils'
|
||||||
import { useRecipesStore } from '../stores/recipes'
|
import { useRecipesStore, EDITOR_ONLY_TAGS } from '../stores/recipes'
|
||||||
import { useAuthStore } from '../stores/auth'
|
import { useAuthStore } from '../stores/auth'
|
||||||
|
|
||||||
const EDITOR_ONLY_TAGS = ['已审核']
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
recipe: { type: Object, required: true },
|
recipe: { type: Object, required: true },
|
||||||
index: { type: Number, required: true },
|
index: { type: Number, required: true },
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ import { defineStore } from 'pinia'
|
|||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { api } from '../composables/useApi'
|
import { api } from '../composables/useApi'
|
||||||
|
|
||||||
|
export const EDITOR_ONLY_TAGS = ['已审核']
|
||||||
|
|
||||||
export const useRecipesStore = defineStore('recipes', () => {
|
export const useRecipesStore = defineStore('recipes', () => {
|
||||||
const recipes = ref([])
|
const recipes = ref([])
|
||||||
const allTags = ref([])
|
const allTags = ref([])
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div v-if="showTagFilter" class="tag-list-bar">
|
<div v-if="showTagFilter" class="tag-list-bar">
|
||||||
<span
|
<span
|
||||||
v-for="tag in recipeStore.allTags"
|
v-for="tag in visibleAllTags"
|
||||||
:key="tag"
|
:key="tag"
|
||||||
class="tag-chip"
|
class="tag-chip"
|
||||||
:class="{ active: selectedTags.includes(tag) }"
|
:class="{ active: selectedTags.includes(tag) }"
|
||||||
@@ -126,7 +126,7 @@
|
|||||||
<div class="row-info" @click="editDiaryRecipe(d)">
|
<div class="row-info" @click="editDiaryRecipe(d)">
|
||||||
<span class="row-name">{{ d.name }}</span>
|
<span class="row-name">{{ d.name }}</span>
|
||||||
<span class="row-tags">
|
<span class="row-tags">
|
||||||
<span v-for="t in (d.tags || [])" :key="t" class="mini-tag">{{ t }}</span>
|
<span v-for="t in (d.tags || []).filter(t => auth.canEdit || !EDITOR_ONLY_TAGS.includes(t))" :key="t" class="mini-tag">{{ t }}</span>
|
||||||
</span>
|
</span>
|
||||||
<span class="row-cost">{{ oils.fmtPrice(oils.calcCost(d.ingredients || [])) }}</span>
|
<span class="row-cost">{{ oils.fmtPrice(oils.calcCost(d.ingredients || [])) }}</span>
|
||||||
<span v-if="getDiaryShareStatus(d) === 'shared'" class="share-tag shared">已共享</span>
|
<span v-if="getDiaryShareStatus(d) === 'shared'" class="share-tag shared">已共享</span>
|
||||||
@@ -165,7 +165,7 @@
|
|||||||
<div class="row-info" @click="editRecipe(r)">
|
<div class="row-info" @click="editRecipe(r)">
|
||||||
<span class="row-name">{{ r.name }}</span>
|
<span class="row-name">{{ r.name }}</span>
|
||||||
<span class="row-tags">
|
<span class="row-tags">
|
||||||
<span v-for="t in r.tags" :key="t" class="mini-tag">{{ t }}</span>
|
<span v-for="t in (r.tags || []).filter(t => auth.canEdit || !EDITOR_ONLY_TAGS.includes(t))" :key="t" class="mini-tag">{{ t }}</span>
|
||||||
</span>
|
</span>
|
||||||
<span class="row-cost">{{ oils.fmtPrice(oils.calcCost(r.ingredients)) }}</span>
|
<span class="row-cost">{{ oils.fmtPrice(oils.calcCost(r.ingredients)) }}</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -397,7 +397,7 @@
|
|||||||
import { ref, computed, reactive, onMounted, watch } from 'vue'
|
import { ref, computed, reactive, onMounted, watch } from 'vue'
|
||||||
import { useAuthStore } from '../stores/auth'
|
import { useAuthStore } from '../stores/auth'
|
||||||
import { useOilsStore } from '../stores/oils'
|
import { useOilsStore } from '../stores/oils'
|
||||||
import { useRecipesStore } from '../stores/recipes'
|
import { useRecipesStore, EDITOR_ONLY_TAGS } from '../stores/recipes'
|
||||||
import { useDiaryStore } from '../stores/diary'
|
import { useDiaryStore } from '../stores/diary'
|
||||||
import { useUiStore } from '../stores/ui'
|
import { useUiStore } from '../stores/ui'
|
||||||
import { api } from '../composables/useApi'
|
import { api } from '../composables/useApi'
|
||||||
@@ -1128,6 +1128,11 @@ async function loadContribution() {
|
|||||||
const previewRecipeIndex = ref(null)
|
const previewRecipeIndex = ref(null)
|
||||||
const previewRecipeData = ref(null)
|
const previewRecipeData = ref(null)
|
||||||
const showBatchMenu = ref(false)
|
const showBatchMenu = ref(false)
|
||||||
|
const visibleAllTags = computed(() => {
|
||||||
|
const tags = recipeStore.allTags
|
||||||
|
if (auth.canEdit) return tags
|
||||||
|
return tags.filter(t => !EDITOR_ONLY_TAGS.includes(t))
|
||||||
|
})
|
||||||
const showBatchTagPicker = ref(false)
|
const showBatchTagPicker = ref(false)
|
||||||
const batchTagsSelected = ref([])
|
const batchTagsSelected = ref([])
|
||||||
const batchNewTag = ref('')
|
const batchNewTag = ref('')
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ import { ref, computed, onMounted, nextTick, watch } from 'vue'
|
|||||||
import { useRoute, useRouter } from 'vue-router'
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
import { useAuthStore } from '../stores/auth'
|
import { useAuthStore } from '../stores/auth'
|
||||||
import { useOilsStore } from '../stores/oils'
|
import { useOilsStore } from '../stores/oils'
|
||||||
import { useRecipesStore } from '../stores/recipes'
|
import { useRecipesStore, EDITOR_ONLY_TAGS } from '../stores/recipes'
|
||||||
import { useDiaryStore } from '../stores/diary'
|
import { useDiaryStore } from '../stores/diary'
|
||||||
import { useUiStore } from '../stores/ui'
|
import { useUiStore } from '../stores/ui'
|
||||||
import { api } from '../composables/useApi'
|
import { api } from '../composables/useApi'
|
||||||
@@ -315,7 +315,8 @@ const exactResults = computed(() => {
|
|||||||
const q = searchQuery.value.trim().toLowerCase()
|
const q = searchQuery.value.trim().toLowerCase()
|
||||||
return recipeStore.recipes.filter(r => {
|
return recipeStore.recipes.filter(r => {
|
||||||
const nameMatch = r.name.toLowerCase().includes(q)
|
const nameMatch = r.name.toLowerCase().includes(q)
|
||||||
const tagMatch = r.tags && r.tags.some(t => t.toLowerCase().includes(q))
|
const visibleTags = auth.canEdit ? (r.tags || []) : (r.tags || []).filter(t => !EDITOR_ONLY_TAGS.includes(t))
|
||||||
|
const tagMatch = visibleTags.some(t => t.toLowerCase().includes(q))
|
||||||
return nameMatch || tagMatch
|
return nameMatch || tagMatch
|
||||||
}).sort((a, b) => a.name.localeCompare(b.name, 'zh'))
|
}).sort((a, b) => a.name.localeCompare(b.name, 'zh'))
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user