Grant senior_editor oil editing, PDF export, and public recipe management
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 20s
Test / e2e-test (push) Failing after 1m2s
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 20s
Test / e2e-test (push) Failing after 1m2s
Add canManage computed (senior_editor + admin) to auth store and use it for oil edit/delete buttons, PDF export, and public recipe section visibility. Backend already allowed these operations for senior_editor. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -18,6 +18,9 @@ export const useAuthStore = defineStore('auth', () => {
|
||||
// Getters
|
||||
const isLoggedIn = computed(() => user.value.id !== null)
|
||||
const isAdmin = computed(() => user.value.role === 'admin')
|
||||
const canManage = computed(() =>
|
||||
['senior_editor', 'admin'].includes(user.value.role)
|
||||
)
|
||||
const canEdit = computed(() =>
|
||||
['editor', 'senior_editor', 'admin'].includes(user.value.role)
|
||||
)
|
||||
@@ -91,6 +94,7 @@ export const useAuthStore = defineStore('auth', () => {
|
||||
user,
|
||||
isLoggedIn,
|
||||
isAdmin,
|
||||
canManage,
|
||||
canEdit,
|
||||
isBusiness,
|
||||
initToken,
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
@click="viewMode = 'drop'"
|
||||
>滴价</button>
|
||||
</div>
|
||||
<button v-if="auth.isAdmin" class="btn-pdf" @click="exportPDF" title="导出PDF">
|
||||
<button v-if="auth.canManage" class="btn-pdf" @click="exportPDF" title="导出PDF">
|
||||
📄
|
||||
</button>
|
||||
</div>
|
||||
@@ -159,7 +159,7 @@
|
||||
<div class="oil-chip-volume" v-if="getMeta(name)?.dropCount">
|
||||
{{ volumeLabel(getMeta(name).dropCount) }}
|
||||
</div>
|
||||
<div class="oil-actions" v-if="auth.isAdmin" @click.stop>
|
||||
<div class="oil-actions" v-if="auth.canManage" @click.stop>
|
||||
<button class="btn-icon-sm" @click="editOil(name)" title="编辑">✏️</button>
|
||||
<button class="btn-icon-sm" @click="removeOil(name)" title="删除">🗑️</button>
|
||||
</div>
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
</div>
|
||||
|
||||
<!-- Public Recipes Section (admin/senior_editor only) -->
|
||||
<div v-if="auth.isAdmin || auth.user.role === 'senior_editor'" class="recipe-section">
|
||||
<div v-if="auth.canManage" class="recipe-section">
|
||||
<h3 class="section-title">🌿 公共配方库 ({{ publicRecipes.length }})</h3>
|
||||
<div class="recipe-list">
|
||||
<div
|
||||
|
||||
Reference in New Issue
Block a user