feat: 主导航按制作阶段显示可用入口
This commit is contained in:
1 parent
f0cbacb888
commit
64aa048807
1 file changed
+8
-7
+8
-7
@@ -99,8 +99,8 @@ const { preference, theme, overrides } = useTheme()
|
||||
const projectId = computed(() => String(route.params.projectId || ''))
|
||||
const projectAccess = shallowRef<ProjectAccess | null>(null)
|
||||
provide(projectAccessKey, projectAccess)
|
||||
const workflowsUnlocked = computed(
|
||||
() => projectAccess.value?.projectId === projectId.value && projectAccess.value.completed
|
||||
const currentProjectAccess = computed(() =>
|
||||
projectAccess.value?.projectId === projectId.value ? projectAccess.value : null
|
||||
)
|
||||
const apiBase = import.meta.env.VITE_API_BASE_URL || '/api'
|
||||
const workflowItems = [
|
||||
@@ -135,7 +135,8 @@ const menuOptions = computed<MenuOption[]>(() => {
|
||||
? [
|
||||
{ type: 'divider' as const, key: 'divider' },
|
||||
...workflowItems.map(([path, label, icon]) => {
|
||||
const disabled = path !== 'create-drama' && !workflowsUnlocked.value
|
||||
const sectionAccess = currentProjectAccess.value?.sections[path]
|
||||
const disabled = sectionAccess ? !sectionAccess.enabled : path !== 'create-drama'
|
||||
const target = '/projects/' + projectId.value + '/' + path
|
||||
return {
|
||||
key: target,
|
||||
@@ -144,7 +145,7 @@ const menuOptions = computed<MenuOption[]>(() => {
|
||||
disabled
|
||||
? h(
|
||||
'span',
|
||||
{ class: 'admin-menu-label', title: '剧本完成后可用', 'aria-disabled': 'true' },
|
||||
{ class: 'admin-menu-label', title: sectionAccess?.reason || '请先完成前面的制作步骤', 'aria-disabled': 'true' },
|
||||
label
|
||||
)
|
||||
: h(RouterLink, { to: target }, () =>
|
||||
@@ -229,11 +230,11 @@ const menuOptions = computed<MenuOption[]>(() => {
|
||||
block
|
||||
class="admin-settings-button"
|
||||
:class="{ 'is-collapsed': collapsed }"
|
||||
aria-label="后端连接"
|
||||
aria-label="连接设置"
|
||||
@click="openSettings"
|
||||
>
|
||||
<template #icon><Settings2 :size="18" /></template>
|
||||
<span class="admin-settings-label">后端连接</span>
|
||||
<span class="admin-settings-label">连接设置</span>
|
||||
</NButton>
|
||||
</footer>
|
||||
</aside>
|
||||
@@ -261,7 +262,7 @@ const menuOptions = computed<MenuOption[]>(() => {
|
||||
<main id="main-content" tabindex="-1" class="admin-content"><RouterView /></main>
|
||||
</NLayout>
|
||||
</div>
|
||||
<AppDialog v-model:open="settingsOpen" title="后端连接" description="查看当前 API 地址与代理配置。">
|
||||
<AppDialog v-model:open="settingsOpen" title="连接设置" description="查看当前服务地址。">
|
||||
<dl class="detail-grid mt-6">
|
||||
<dt>API 地址</dt>
|
||||
<dd>
|
||||
|
||||
Reference in new issue
Block a user