fix(short-drama-agent-front): 统一全屏布局与问题处理交互
This commit is contained in:
1 parent
db91a4b871
commit
cc27d463e0
25 files changed
+838
-316
No files matched your search
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { NModal, NScrollbar } from 'naive-ui'
|
||||
import { NButton, NModal, NScrollbar } from 'naive-ui'
|
||||
import { onBeforeUnmount, onMounted, ref, watch } from 'vue'
|
||||
|
||||
/** 公共弹窗的标题、说明、操作状态和宽度。 */
|
||||
@@ -113,8 +113,11 @@ onBeforeUnmount(() => {
|
||||
>
|
||||
<div ref="bodyContent" class="flow-root"><slot /></div>
|
||||
</NScrollbar>
|
||||
<template v-if="$slots.footer" #footer>
|
||||
<div class="dialog-footer"><slot name="footer" /></div>
|
||||
<!-- 以下是固定操作底栏,未自定义操作时仍保留关闭入口 -->
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<slot name="footer"><NButton type="default" :disabled="busy" @click="open = false">关闭</NButton></slot>
|
||||
</div>
|
||||
</template>
|
||||
</NModal>
|
||||
</template>
|
||||
@@ -172,11 +175,6 @@ onBeforeUnmount(() => {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
/* 没有按钮底栏时,正文保留与左右内边距一致的底部留白。 */
|
||||
.app-dialog.n-card:not(:has(> .n-card__footer)) > .n-card-content {
|
||||
padding-bottom: var(--n-padding-left);
|
||||
}
|
||||
|
||||
.app-dialog.n-card > .n-card__footer {
|
||||
padding-top: var(--n-padding-left);
|
||||
padding-bottom: var(--n-padding-left);
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
<script setup lang="ts">
|
||||
import { NButton, NDrawer, NDrawerContent } from 'naive-ui'
|
||||
|
||||
/** 全屏抽屉共用标题、说明和保存期间的关闭锁定。 */
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
/** 抽屉标题,同时作为可访问名称。 */
|
||||
title: string
|
||||
/** 标题下的说明,可使用同名插槽覆盖。 */
|
||||
description?: string
|
||||
/** 提交期间禁止关闭抽屉。 */
|
||||
busy?: boolean
|
||||
}>(),
|
||||
{ description: '', busy: false }
|
||||
)
|
||||
/** 全屏抽屉显隐状态,由调用方保留业务草稿。 */
|
||||
const open = defineModel<boolean>('open', { default: false })
|
||||
/** 关闭动画结束后通知调用方,便于交接焦点。 */
|
||||
const emit = defineEmits<{ closed: [] }>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- 以下是从右侧展开、内容同步铺满视口的公共全屏抽屉模块 -->
|
||||
<NDrawer
|
||||
v-model:show="open"
|
||||
placement="right"
|
||||
width="100vw"
|
||||
:auto-focus="false"
|
||||
:mask-closable="!busy"
|
||||
:close-on-esc="!busy"
|
||||
class="app-drawer"
|
||||
:aria-label="title"
|
||||
@after-leave="emit('closed')"
|
||||
>
|
||||
<NDrawerContent :closable="!busy" :native-scrollbar="false">
|
||||
<!-- 以下是固定标题与说明模块,与正文共用左右边界 -->
|
||||
<template #header>
|
||||
<div class="app-drawer-heading">
|
||||
<div class="text-lg font-semibold">{{ title }}</div>
|
||||
<div v-if="description || $slots.description" class="mt-2 text-sm font-normal leading-6 text-muted">
|
||||
<slot name="description">{{ description }}</slot>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<!-- 以下是独立滚动的正文模块 -->
|
||||
<slot />
|
||||
<!-- 以下是固定底部操作模块,未自定义底栏时默认显示关闭按钮 -->
|
||||
<template #footer>
|
||||
<div class="app-drawer-footer">
|
||||
<slot name="footer"
|
||||
><NButton type="default" :disabled="busy" @click="open = false">关闭</NButton></slot
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
</NDrawerContent>
|
||||
</NDrawer>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
/* 全屏抽屉沿用项目表面和输入底色,不对正文设置最大宽度。 */
|
||||
.app-drawer.n-drawer {
|
||||
--app-field: var(--app-control);
|
||||
--app-field-hover: var(--app-control-hover);
|
||||
max-width: 100vw;
|
||||
background: var(--app-surface);
|
||||
}
|
||||
.app-drawer.n-drawer .n-drawer-content .n-drawer-header {
|
||||
position: relative;
|
||||
padding: 24px;
|
||||
}
|
||||
/* 关闭入口独立定位,避免占据标题列后造成正文边界错位。 */
|
||||
.app-drawer .n-drawer-header__close {
|
||||
position: absolute;
|
||||
top: 24px;
|
||||
right: 24px;
|
||||
}
|
||||
.app-drawer.n-drawer .n-drawer-content .n-drawer-header__main {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
}
|
||||
.app-drawer-heading {
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
padding-right: 40px;
|
||||
}
|
||||
/* 正文顶部不再叠加留白,保留左右边界和滚动到底部时的间距。 */
|
||||
.app-drawer.n-drawer .n-drawer-content .n-drawer-body-content-wrapper {
|
||||
padding: 0 24px 32px;
|
||||
}
|
||||
.app-drawer.n-drawer .n-drawer-content .n-drawer-footer {
|
||||
display: block;
|
||||
padding: 20px 24px max(20px, env(safe-area-inset-bottom));
|
||||
}
|
||||
.app-drawer-footer {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* 窄屏缩小外层留白,正文布局由各业务表单控制。 */
|
||||
@media (max-width: 639px) {
|
||||
.app-drawer.n-drawer .n-drawer-content .n-drawer-header {
|
||||
padding: 20px 16px;
|
||||
}
|
||||
.app-drawer .n-drawer-header__close {
|
||||
top: 20px;
|
||||
right: 16px;
|
||||
}
|
||||
.app-drawer.n-drawer .n-drawer-content .n-drawer-body-content-wrapper {
|
||||
padding: 0 16px 24px;
|
||||
}
|
||||
.app-drawer.n-drawer .n-drawer-content .n-drawer-footer {
|
||||
padding-inline: 16px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -7,10 +7,11 @@ defineProps<{ title: string; description: string }>()
|
||||
<template>
|
||||
<NEmpty class="empty-state" :description="title">
|
||||
<template #icon><FileText :size="30" :stroke-width="1.4" /></template>
|
||||
<template #extra
|
||||
><p class="max-w-md text-sm leading-6 text-muted">{{ description }}</p>
|
||||
<div class="mt-5"><slot /></div
|
||||
></template>
|
||||
<template #extra>
|
||||
<p class="max-w-md text-sm leading-6 text-muted">{{ description }}</p>
|
||||
<!-- 以下是统一居中、换行和间距的空态操作模块,加载图标不再影响按钮基线 -->
|
||||
<div class="empty-state-actions mt-5 flex flex-wrap items-center justify-center gap-3"><slot /></div>
|
||||
</template>
|
||||
</NEmpty>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -1,15 +1,22 @@
|
||||
<script setup lang="ts">
|
||||
import { NButton } from 'naive-ui'
|
||||
import AppDialog from './AppDialog.vue'
|
||||
import AppDrawer from './AppDrawer.vue'
|
||||
import { LoaderCircle, Settings2 } from '@lucide/vue'
|
||||
|
||||
/** 批量设置与回执属于临时操作,统一使用大尺寸弹窗;完整制作流程继续保留独立页面。 */
|
||||
/** 工作区设置与回执按需使用宽弹窗或全屏抽屉,正文与任务状态仍由工作区持有。 */
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
/** 设置容器的标题。 */
|
||||
title: string
|
||||
/** 工作区中的入口文案。 */
|
||||
label?: string
|
||||
/** 是否提示存在任务回执。 */
|
||||
hasReceipt?: boolean
|
||||
/** 是否由调用方提供入口。 */
|
||||
triggerless?: boolean
|
||||
/** 使用内容铺满视口的全屏抽屉。 */
|
||||
fullscreen?: boolean
|
||||
/** 当前工作区存在运行中的请求或持久化任务。 */
|
||||
pending?: boolean
|
||||
/** 在操作入口原位置展示真实任务名称。 */
|
||||
@@ -17,11 +24,13 @@ withDefaults(
|
||||
}>(),
|
||||
{
|
||||
label: '操作与回执',
|
||||
triggerless: false
|
||||
triggerless: false,
|
||||
fullscreen: false
|
||||
}
|
||||
)
|
||||
/** 工具区容器显隐状态,关闭时保留调用方的配置草稿。 */
|
||||
const open = defineModel<boolean>('open', { default: false })
|
||||
/** 工具弹窗完全关闭后通知调用方,便于切换独立的问题弹窗。 */
|
||||
/** 工具容器完全关闭后通知调用方,便于切换独立的问题弹窗。 */
|
||||
const emit = defineEmits<{ closed: [] }>()
|
||||
</script>
|
||||
|
||||
@@ -43,9 +52,17 @@ const emit = defineEmits<{ closed: [] }>()
|
||||
<span class="workspace-tools-label">{{ pending ? pendingLabel || '任务执行中' : label }}</span
|
||||
><span v-if="hasReceipt" class="workspace-tools-receipt text-xs text-muted"> · 有回执</span>
|
||||
</NButton>
|
||||
<AppDialog v-model:open="open" :title="title" description="" wide @closed="emit('closed')">
|
||||
<!-- 以下是按工作区要求切换的工具容器模块,共用关闭后的交接事件 -->
|
||||
<component
|
||||
:is="fullscreen ? AppDrawer : AppDialog"
|
||||
v-model:open="open"
|
||||
:title="title"
|
||||
description=""
|
||||
v-bind="fullscreen ? {} : { wide: true }"
|
||||
@closed="emit('closed')"
|
||||
>
|
||||
<div class="workspace-tools-body"><slot /></div>
|
||||
</AppDialog>
|
||||
</component>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/** 公共 UI 的统一导出入口。 */
|
||||
export { default as FieldLabel } from './FieldLabel.vue'
|
||||
export { default as AppDialog } from './AppDialog.vue'
|
||||
export { default as AppDrawer } from './AppDrawer.vue'
|
||||
export { default as EmptyState } from './EmptyState.vue'
|
||||
export { default as StatusBadge } from './StatusBadge.vue'
|
||||
export { default as StudioLogo } from './StudioLogo.vue'
|
||||
|
||||
Reference in new issue
Block a user