feat(short-drama-agent-front): 新增剧本骨架屏并优化阅读导出
This commit is contained in:
1 parent
54a381ebd3
commit
3cc65aa056
16 files changed
+792
-167
No files matched your search
@@ -3,7 +3,7 @@ import AppForm from '../../components/ui/AppForm.vue'
|
||||
import { NFormItem } from 'naive-ui'
|
||||
import { integerRule, fieldRule } from '../../lib/form-rules'
|
||||
import WorkspacePage from '../../components/ui/WorkspacePage.vue'
|
||||
import ActionMenu from '../../components/ui/ActionMenu.vue'
|
||||
import WorkspaceExportButton from '../../components/ui/WorkspaceExportButton.vue'
|
||||
import { NScrollbar, NAlert, NButton, NCheckbox, NInputNumber, NProgress, NTab, NTable, NTabs } from 'naive-ui'
|
||||
import { computed, onScopeDispose, ref, watch } from 'vue'
|
||||
import { Layers, LoaderCircle, ArrowRight, Settings2 } from '@lucide/vue'
|
||||
@@ -14,7 +14,6 @@ import type { BreakdownAction, BreakdownInput, BreakdownModule, BreakdownPreview
|
||||
import { breakdownSnapshot, recoveryOptions, workflowCheckpoints } from '../workflows/selectors'
|
||||
import { getOperation, runOperation } from '../workflows/operations'
|
||||
import ConfirmAction from '../workflows/ConfirmAction.vue'
|
||||
import HistoryPanel from '../workflows/HistoryPanel.vue'
|
||||
import WorkflowExecutionPanel from '../workflows/WorkflowExecutionPanel.vue'
|
||||
import { useWorkflowExecution } from '../workflows/execution'
|
||||
import SubjectList from './components/SubjectList.vue'
|
||||
@@ -31,7 +30,6 @@ const previewBusy = ref(false)
|
||||
const previewError = ref('')
|
||||
const tab = ref('character')
|
||||
const toolsOpen = ref(false)
|
||||
const showHistory = ref(false)
|
||||
const moduleOptions: { value: BreakdownModule; label: string; description: string }[] = [
|
||||
{ value: 'character', label: '人物', description: '人物身份、外观与形态' },
|
||||
{ value: 'scene', label: '场景', description: '故事空间与环境特征' },
|
||||
@@ -447,16 +445,17 @@ const rules = {
|
||||
<section class="breakdown-results-section">
|
||||
<div class="result-toolbar tabs-toolbar">
|
||||
<NTabs v-model:value="tab" class="workspace-tabs" type="line" size="small" aria-label="拆解结果"
|
||||
><NTab v-for="option in moduleOptions" :key="option.value" :name="option.value"
|
||||
>{{ option.label
|
||||
}}<span>{{ subjects.filter(item => item.module === option.value).length }}</span></NTab
|
||||
><!-- 以下是仅显示分类名称的拆解标签模块,主体数量保留在搜索统计中 -->
|
||||
<NTab v-for="option in moduleOptions" :key="option.value" :name="option.value">{{
|
||||
option.label
|
||||
}}</NTab
|
||||
><NTab name="storyboard">分镜</NTab
|
||||
><NTab name="tasks"
|
||||
><span class="breakdown-task-label-desktop">任务明细</span
|
||||
><span class="breakdown-task-label-mobile">任务</span></NTab
|
||||
>
|
||||
<template #suffix
|
||||
><div class="tabs-toolbar-actions">
|
||||
><div class="tabs-toolbar-actions breakdown-toolbar-actions">
|
||||
<!-- 以下是手机分类导航中的拆解设置入口,共用原有设置弹窗 -->
|
||||
<NButton
|
||||
quaternary
|
||||
@@ -469,21 +468,17 @@ const rules = {
|
||||
>
|
||||
<template #icon><Settings2 :size="15" /></template>
|
||||
</NButton>
|
||||
<!-- 以下是桌面低频操作入口,手机不显示省略号菜单 -->
|
||||
<span class="breakdown-more-actions"
|
||||
><ActionMenu
|
||||
label="拆解更多操作"
|
||||
:items="[
|
||||
{ key: 'history', label: showHistory ? '收起执行记录' : '执行记录' },
|
||||
{ key: 'export', label: '导出 JSON', disabled: !snapshot }
|
||||
]"
|
||||
@select="$event === 'history' ? (showHistory = !showHistory) : exportResult()"
|
||||
/></span></div
|
||||
<!-- 以下是拆解快照直接导出模块,与剧本创作共用图标和悬浮说明 -->
|
||||
<WorkspaceExportButton
|
||||
label="导出拆解结果"
|
||||
:disabled="!snapshot"
|
||||
@export="exportResult"
|
||||
/></div
|
||||
></template>
|
||||
</NTabs>
|
||||
</div>
|
||||
<div class="content-with-history panel" :class="{ 'history-hidden': !showHistory }">
|
||||
<main class="min-w-0">
|
||||
<div class="breakdown-content panel">
|
||||
<main class="min-w-0 min-h-0 overflow-hidden">
|
||||
<!-- 所有结果标签共用有界的内容滚动;切换标签回到顶部,不继承上一列表的位置。 -->
|
||||
<NScrollbar :key="tab" class="panel-scroll breakdown-results-scroll">
|
||||
<template v-for="option in moduleOptions" :key="option.value"
|
||||
@@ -557,13 +552,6 @@ const rules = {
|
||||
</div>
|
||||
</NScrollbar>
|
||||
</main>
|
||||
<HistoryPanel
|
||||
v-if="showHistory"
|
||||
:project-id="project?.id"
|
||||
:checkpoints="checkpoints"
|
||||
workflow="breakdown"
|
||||
@close="showHistory = false"
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
@@ -650,8 +638,9 @@ const rules = {
|
||||
.breakdown-results-section > .result-toolbar {
|
||||
@apply shrink-0;
|
||||
}
|
||||
.breakdown-results-section > .content-with-history {
|
||||
@apply flex-1 h-auto min-h-0 grid-rows-[minmax(0,_1fr)];
|
||||
.breakdown-results-section > .breakdown-content {
|
||||
/* 移除执行记录分栏,结果独占剩余宽高。 */
|
||||
@apply grid flex-1 h-auto min-h-0 grid-cols-[minmax(0,_1fr)] grid-rows-[minmax(0,_1fr)];
|
||||
/* 外层透明,搜索框和各条目使用自身背景,模块间距不再铺底色。 */
|
||||
background: transparent;
|
||||
}
|
||||
@@ -665,8 +654,13 @@ const rules = {
|
||||
.breakdown-result-pad .subject-list-toolbar {
|
||||
margin-bottom: var(--app-content-gap);
|
||||
}
|
||||
.breakdown-results-section > .content-with-history.history-hidden {
|
||||
@apply grid-cols-[minmax(0,_1fr)] grid-rows-[minmax(0,_1fr)];
|
||||
.breakdown-workspace-page .workspace-tabs .n-tabs-nav__suffix,
|
||||
.breakdown-workspace-page .breakdown-toolbar-actions {
|
||||
/* 设置与导出入口共用标签栏高度,导出按钮保持正方形。 */
|
||||
align-items: stretch;
|
||||
}
|
||||
.breakdown-workspace-page .breakdown-toolbar-actions {
|
||||
gap: 0;
|
||||
}
|
||||
.breakdown-workspace-page .breakdown-mobile-tools.n-button {
|
||||
display: none;
|
||||
@@ -679,7 +673,6 @@ const rules = {
|
||||
.breakdown-workspace-page .workspace-heading-scroll.n-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
.breakdown-more-actions,
|
||||
.breakdown-task-label-desktop {
|
||||
display: none;
|
||||
}
|
||||
@@ -709,8 +702,8 @@ const rules = {
|
||||
flex: none;
|
||||
overflow: visible;
|
||||
}
|
||||
.breakdown-workspace-page .content-with-history,
|
||||
.breakdown-workspace-page .content-with-history > main,
|
||||
.breakdown-workspace-page .breakdown-content,
|
||||
.breakdown-workspace-page .breakdown-content > main,
|
||||
.breakdown-workspace-page .breakdown-results-scroll,
|
||||
.breakdown-workspace-page .breakdown-results-scroll > .n-scrollbar-container {
|
||||
height: auto;
|
||||
@@ -768,13 +761,5 @@ const rules = {
|
||||
.breakdown-results-section .tabs-toolbar-actions {
|
||||
@apply min-h-0 flex-nowrap;
|
||||
}
|
||||
.breakdown-results-section .content-with-history:not(.history-hidden) {
|
||||
@apply relative;
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
grid-template-rows: minmax(0, 1fr);
|
||||
}
|
||||
.breakdown-results-section .content-with-history:not(.history-hidden) .history-panel {
|
||||
@apply absolute inset-0 z-30;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,149 @@
|
||||
<script setup lang="ts">
|
||||
import { NScrollbar, NSkeleton } from 'naive-ui'
|
||||
import WorkspacePage from '../../components/ui/WorkspacePage.vue'
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<WorkspacePage
|
||||
split
|
||||
compact
|
||||
mobile-scroll
|
||||
class="breakdown-skeleton"
|
||||
role="status"
|
||||
aria-label="正在读取剧本拆解内容"
|
||||
aria-busy="true"
|
||||
>
|
||||
<template #header>
|
||||
<!-- 以下是拆解状态与设置占位模块,不展示未经读取的统计或完成状态 -->
|
||||
<div class="breakdown-skeleton-summary" aria-hidden="true">
|
||||
<NSkeleton class="breakdown-skeleton-heading" :width="80" :height="18" />
|
||||
<NSkeleton :width="108" :height="12" />
|
||||
<NSkeleton :width="132" :height="12" />
|
||||
<NSkeleton :width="86" :height="22" />
|
||||
<NSkeleton class="breakdown-skeleton-settings" :width="34" :height="34" />
|
||||
</div>
|
||||
</template>
|
||||
<div class="breakdown-skeleton-results" aria-hidden="true">
|
||||
<!-- 以下是分类标签与操作入口占位模块 -->
|
||||
<div class="breakdown-skeleton-tabs">
|
||||
<NSkeleton v-for="tab in 5" :key="tab" :width="28" :height="14" />
|
||||
<NSkeleton class="breakdown-skeleton-mobile-settings" :width="44" :height="44" />
|
||||
<NSkeleton class="breakdown-skeleton-settings" :width="40" :height="40" />
|
||||
</div>
|
||||
<NScrollbar class="breakdown-skeleton-scroll">
|
||||
<!-- 以下是搜索框与主体统计占位模块 -->
|
||||
<div class="breakdown-skeleton-search">
|
||||
<NSkeleton class="breakdown-skeleton-input" :height="34" />
|
||||
<NSkeleton :width="70" :height="12" />
|
||||
</div>
|
||||
<!-- 以下是主体名称、描述、关联入口与形态折叠区占位模块 -->
|
||||
<div class="breakdown-skeleton-records">
|
||||
<div v-for="record in 3" :key="record" class="breakdown-skeleton-record">
|
||||
<div class="breakdown-skeleton-record-heading">
|
||||
<NSkeleton :width="96" :height="16" />
|
||||
<NSkeleton :width="56" :height="18" />
|
||||
</div>
|
||||
<div class="breakdown-skeleton-description">
|
||||
<NSkeleton :width="'96%'" :height="14" />
|
||||
<NSkeleton :width="'72%'" :height="14" />
|
||||
</div>
|
||||
<div class="breakdown-skeleton-links">
|
||||
<NSkeleton :width="112" :height="12" />
|
||||
<NSkeleton :width="100" :height="12" />
|
||||
</div>
|
||||
<NSkeleton :width="124" :height="14" />
|
||||
</div>
|
||||
</div>
|
||||
</NScrollbar>
|
||||
</div>
|
||||
</WorkspacePage>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
/* 拆解占位沿用工作区留白和主题配色,手机与真实页面使用同一断点。 */
|
||||
@reference "../../styles/styles.css";
|
||||
.breakdown-skeleton-summary {
|
||||
@apply flex items-center flex-wrap gap-x-4 gap-y-2 min-h-[34px];
|
||||
}
|
||||
.breakdown-skeleton-settings {
|
||||
@apply ml-auto shrink-0;
|
||||
}
|
||||
.breakdown-skeleton-mobile-settings {
|
||||
/* 手机标签栏右侧保留设置和导出两个独立图标位置。 */
|
||||
@apply hidden shrink-0;
|
||||
}
|
||||
.breakdown-skeleton-results {
|
||||
@apply flex flex-col flex-1 min-h-0 min-w-0;
|
||||
gap: var(--app-content-gap);
|
||||
}
|
||||
.breakdown-skeleton-tabs {
|
||||
@apply flex items-center shrink-0 gap-8 pl-4 min-h-10 bg-(--app-surface);
|
||||
}
|
||||
:root:not([data-theme='dark']) .breakdown-skeleton-tabs {
|
||||
@apply bg-(--app-subtle);
|
||||
}
|
||||
.breakdown-skeleton-scroll {
|
||||
@apply flex-1 min-h-0 min-w-0;
|
||||
}
|
||||
.breakdown-skeleton-search {
|
||||
@apply flex items-center gap-3;
|
||||
margin-bottom: var(--app-content-gap);
|
||||
}
|
||||
.breakdown-skeleton-input {
|
||||
@apply basis-[260px] shrink min-w-0;
|
||||
}
|
||||
.breakdown-skeleton-record {
|
||||
@apply p-5 min-w-0 bg-(--app-control);
|
||||
}
|
||||
.breakdown-skeleton-record:nth-child(even) {
|
||||
@apply bg-(--app-subtle);
|
||||
}
|
||||
.breakdown-skeleton-record :deep(.n-skeleton) {
|
||||
/* 占位条与斑马纹底色保持层次,避免浅色卡片内的默认骨架颜色融入背景。 */
|
||||
--n-color-start: var(--app-border) !important;
|
||||
--n-color-end: var(--app-field-hover) !important;
|
||||
}
|
||||
.breakdown-skeleton-record-heading {
|
||||
@apply flex flex-wrap items-center gap-3 mb-3;
|
||||
}
|
||||
.breakdown-skeleton-description {
|
||||
@apply flex flex-col gap-3 mb-4;
|
||||
}
|
||||
.breakdown-skeleton-links {
|
||||
@apply flex flex-wrap items-center gap-4 mb-4;
|
||||
}
|
||||
@media (max-width: 800px) {
|
||||
.breakdown-skeleton-heading {
|
||||
@apply hidden;
|
||||
}
|
||||
.breakdown-skeleton-summary {
|
||||
@apply flex-nowrap overflow-hidden;
|
||||
}
|
||||
.breakdown-skeleton-input {
|
||||
@apply flex-1;
|
||||
}
|
||||
}
|
||||
@media (max-width: 760px) {
|
||||
.breakdown-skeleton :deep(.workspace-heading-scroll) {
|
||||
@apply hidden;
|
||||
}
|
||||
.breakdown-skeleton-tabs {
|
||||
@apply gap-2 pl-2 min-h-11;
|
||||
}
|
||||
.breakdown-skeleton-mobile-settings {
|
||||
@apply block;
|
||||
}
|
||||
.breakdown-skeleton-tabs .breakdown-skeleton-settings {
|
||||
@apply w-11! h-11!;
|
||||
}
|
||||
.breakdown-skeleton-results,
|
||||
.breakdown-skeleton-scroll {
|
||||
@apply flex-none overflow-visible;
|
||||
}
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.breakdown-skeleton :deep(.n-skeleton) {
|
||||
animation: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user