fix(short-drama-agent-front): 优化工作区提示与弹窗布局
This commit is contained in:
1 parent
5b134207b8
commit
72a86171dc
35 files changed
+586
-378
No files matched your search
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, inject, onScopeDispose, provide, ref, watch, watchEffect } from 'vue'
|
||||
import { computed, h, inject, onScopeDispose, provide, ref, watch, watchEffect } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { NScrollbar, NAlert, NButton, NPageHeader, NSpin, NEllipsis } from 'naive-ui'
|
||||
import { EmptyState } from '../../components/ui'
|
||||
@@ -9,6 +9,8 @@ import { projectAccessKey, projectSectionFromPath, type ProjectAccess } from './
|
||||
import { useProjectStageAccess } from './useProjectStageAccess'
|
||||
import { useWorkflowExecution } from '../workflows/execution'
|
||||
import { clearEpisodeSourceInvalidations, invalidateEpisodeSource } from '../storyboard/model'
|
||||
import { useActionMessage } from '../../components/ui/useActionMessage'
|
||||
import { productionMessage } from '../production/production-messages'
|
||||
import ProjectSettingsDialog from '../generation-config/components/ProjectSettingsDialog.vue'
|
||||
import { projectGenerationRevisionKey } from '../generation-config/context'
|
||||
import WorkflowExecutionPanel from '../workflows/WorkflowExecutionPanel.vue'
|
||||
@@ -140,6 +142,48 @@ const operationGuide = computed<OperationGuide | null>(() => {
|
||||
return { title: '操作未完成', description: error }
|
||||
})
|
||||
|
||||
/** 镜头工作区的操作结果只在用户发起操作后显示,不在进入页面时重放旧提示。 */
|
||||
const actionMessage = useActionMessage()
|
||||
/** 分镜和生产页保留必要进度,操作成功或失败改用临时消息。 */
|
||||
const quietFeedback = computed(() => currentSection.value === 'production' || currentSection.value === 'storyboard')
|
||||
/** 只通知仍在当前项目的真实新结果,不把任务提交当作素材生成完成。 */
|
||||
watch(
|
||||
() => [id.value, operation.value.error, operation.value.notice] as const,
|
||||
([projectId, error, notice], [previousProject, previousError, previousNotice]) => {
|
||||
if (!quietFeedback.value || projectId !== previousProject) return
|
||||
if (error && error !== previousError) {
|
||||
const guide = operationGuide.value
|
||||
const content = productionMessage(error)
|
||||
actionMessage?.error(
|
||||
() =>
|
||||
h('div', { class: 'flex max-w-[min(600px,calc(100vw-48px))] flex-wrap items-center gap-3' }, [
|
||||
h('span', content),
|
||||
guide?.action
|
||||
? h(
|
||||
NButton,
|
||||
{
|
||||
text: true,
|
||||
size: 'small',
|
||||
onClick: () => {
|
||||
if (id.value === projectId && operation.value.error === error)
|
||||
resolveOperationError()
|
||||
}
|
||||
},
|
||||
() => guide.action
|
||||
)
|
||||
: null
|
||||
]),
|
||||
{ duration: 8000, closable: true }
|
||||
)
|
||||
} else if (notice && notice !== previousNotice) {
|
||||
if (/生成|提交/.test(operation.value.label))
|
||||
actionMessage?.info('任务已提交,完成后会显示结果。', { duration: 4000 })
|
||||
else actionMessage?.success('操作已完成。', { duration: 3000 })
|
||||
}
|
||||
},
|
||||
{ flush: 'post' }
|
||||
)
|
||||
|
||||
/** 已知前置条件直接送达对应工作区;保留当前页面,修复后可继续原操作。 */
|
||||
function resolveOperationError() {
|
||||
const target = operationGuide.value?.target
|
||||
@@ -191,7 +235,7 @@ onScopeDispose(() => {
|
||||
</NPageHeader>
|
||||
</header>
|
||||
<NScrollbar
|
||||
v-if="context.error.value || operation.pending || operation.error || operation.notice"
|
||||
v-if="context.error.value || operation.pending || (!quietFeedback && (operation.error || operation.notice))"
|
||||
class="project-notices"
|
||||
content-class="project-notices-content"
|
||||
>
|
||||
@@ -204,7 +248,7 @@ onScopeDispose(() => {
|
||||
<NAlert v-if="operation.pending" :show-icon="false" role="status"
|
||||
>{{ operation.label || '后台制作任务执行中' }}。可切换页面查看结果,请勿重复提交。</NAlert
|
||||
>
|
||||
<NAlert v-if="operationGuide" type="error" :show-icon="false" class="operation-guide">
|
||||
<NAlert v-if="operationGuide && !quietFeedback" type="error" :show-icon="false" class="operation-guide">
|
||||
<div class="operation-guide-content">
|
||||
<div>
|
||||
<strong>{{ operationGuide.title }}</strong>
|
||||
@@ -215,7 +259,9 @@ onScopeDispose(() => {
|
||||
}}</NButton>
|
||||
</div>
|
||||
</NAlert>
|
||||
<NAlert v-if="operation.notice" :show-icon="false" role="status">{{ operation.notice }}</NAlert>
|
||||
<NAlert v-if="operation.notice && !quietFeedback" :show-icon="false" role="status">{{
|
||||
operation.notice
|
||||
}}</NAlert>
|
||||
</NScrollbar>
|
||||
<WorkflowExecutionPanel
|
||||
v-if="isCreation && createDramaExecution.executionId.value"
|
||||
|
||||
Reference in new issue
Block a user