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