fix: 管理配方tab所有人可见,未登录时显示登录引导
All checks were successful
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 5s
Test / build-check (push) Successful in 4s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 22s
Test / e2e-test (push) Successful in 51s

撤回之前的editor-only限制,改为tab可见但页面内容需登录。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-12 10:20:45 +00:00
parent f149154a56
commit 0f7ae6ecc7
2 changed files with 13 additions and 1 deletions

View File

@@ -78,7 +78,7 @@ const navTabsRef = ref(null)
// hide: 完全隐藏(只有满足条件才显示) // hide: 完全隐藏(只有满足条件才显示)
const allTabs = [ const allTabs = [
{ key: 'search', icon: '🔍', label: '配方查询' }, { key: 'search', icon: '🔍', label: '配方查询' },
{ key: 'manage', icon: '📋', label: '管理配方', hide: 'editor' }, { key: 'manage', icon: '📋', label: '管理配方', require: 'login' },
{ key: 'inventory', icon: '📦', label: '个人库存', require: 'login' }, { key: 'inventory', icon: '📦', label: '个人库存', require: 'login' },
{ key: 'oils', icon: '💧', label: '精油价目' }, { key: 'oils', icon: '💧', label: '精油价目' },
{ key: 'projects', icon: '💼', label: '商业核算', require: 'login' }, { key: 'projects', icon: '💼', label: '商业核算', require: 'login' },

View File

@@ -1,5 +1,11 @@
<template> <template>
<div class="recipe-manager"> <div class="recipe-manager">
<!-- Login prompt for non-logged-in users -->
<div v-if="!auth.isLoggedIn" class="login-prompt">
<p>登录后可管理配方创建个人配方集</p>
<button class="btn-primary" @click="ui.openLogin()">登录 / 注册</button>
</div>
<template v-else>
<!-- Review Bar (admin + senior_editor with assigned reviews) --> <!-- Review Bar (admin + senior_editor with assigned reviews) -->
<div v-if="(auth.isAdmin || auth.canManage) && pendingCount > 0" class="review-bar" @click="showPending = !showPending" > <div v-if="(auth.isAdmin || auth.canManage) && pendingCount > 0" class="review-bar" @click="showPending = !showPending" >
📝 待审核配方: {{ pendingCount }} 📝 待审核配方: {{ pendingCount }}
@@ -388,6 +394,7 @@
@save="onTagPickerSave" @save="onTagPickerSave"
@close="showTagPicker = false" @close="showTagPicker = false"
/> />
</template>
</div> </div>
</template> </template>
@@ -1672,6 +1679,11 @@ watch(() => recipeStore.recipes, () => {
padding: 0 12px 24px; padding: 0 12px 24px;
} }
.login-prompt {
text-align: center; padding: 60px 20px; color: #6b6375;
}
.login-prompt p { margin-bottom: 16px; font-size: 15px; }
.review-bar { .review-bar {
background: linear-gradient(135deg, #fff3e0, #ffe0b2); background: linear-gradient(135deg, #fff3e0, #ffe0b2);
padding: 12px 16px; padding: 12px 16px;