perf(short-drama-agent-front): 优化制作工作台交互与移动端布局

This commit is contained in:
GJ committed 2026-10-10 19:28:47 +08:00
1 parent b5eaed3981
commit 54a381ebd3
37 files changed
+1217 -426

No files matched your search

+5 -1
View File
@@ -13,6 +13,8 @@ withDefaults(
busy?: boolean
/** 使用宽弹窗布局。 */
wide?: boolean
/** 指定弹窗宽度,单位为像素;实际宽度仍受视口限制。 */
width?: number
}>(),
{ description: '', busy: false, wide: false }
)
@@ -78,13 +80,15 @@ onBeforeUnmount(() => {
<template>
<slot name="trigger" />
<!-- 以下是关闭打开时自动聚焦的公共弹窗模块 -->
<NModal
v-model:show="open"
preset="card"
:auto-focus="false"
:closable="!busy"
:mask-closable="!busy"
:close-on-esc="!busy"
:style="{ width: wide ? '1040px' : '600px' }"
:style="{ width: `${width ?? (wide ? 1040 : 600)}px` }"
class="app-dialog"
role="dialog"
:aria-label="title"
+41
View File
@@ -0,0 +1,41 @@
<script setup lang="ts">
import { computed } from 'vue'
import { ExternalLink } from '@lucide/vue'
import { mediaAssetUrl } from '../../lib/assets'
/** 图片与视频共用的右上角原文件入口参数。 */
const props = defineProps<{
/** 原始素材地址,为空或不安全时隐藏入口。 */
src: string | null
/** 无障碍名称与悬停说明,界面仅显示图标。 */
label: string
}>()
/** 外链沿用素材地址的协议与存储路径校验。 */
const href = computed(() => (props.src ? mediaAssetUrl(props.src) : null))
</script>
<template>
<!-- 以下是素材画面右上角打开原文件的图标模块,点击不触发图片预览 -->
<a
v-if="href"
:href="href"
target="_blank"
rel="noopener noreferrer"
:aria-label="label"
:title="label"
class="asset-open-link absolute right-2 top-2 z-10 flex size-7 items-center justify-center bg-black/65 text-white hover:bg-black/85 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white"
@click.stop
>
<ExternalLink :size="14" />
</a>
</template>
<style>
/* 手机端扩大点击区域,桌面继续使用紧凑图标。 */
@reference "../../styles/styles.css";
@media (max-width: 760px) {
.asset-open-link {
@apply size-11;
}
}
</style>
+3 -1
View File
@@ -12,6 +12,8 @@ const props = withDefaults(
label?: string
/** 问题对应的反馈级别。 */
type?: 'warning' | 'error' | 'info'
/** 与状态同行展示时移除独立模块的顶部间距。 */
inline?: boolean
}>(),
{ label: '查看原因', type: 'warning' }
)
@@ -31,7 +33,7 @@ function showReasons() {
<template>
<!-- 以下是按需查看问题说明的操作模块 -->
<div v-if="messages.length" class="mt-3 flex items-center gap-2">
<div v-if="messages.length" class="flex items-center gap-2" :class="{ 'mt-3': !inline }">
<NButton text size="small" @click="showReasons">{{ label }}</NButton>
</div>
</template>
+15 -5
View File
@@ -12,9 +12,13 @@ interface Props {
loading?: boolean
/** 当前查询错误。 */
error?: string
/** 是否允许折叠;关闭时直接展示内容,适用于独立弹窗。 */
collapsible?: boolean
/** 是否显示标题、说明与操作栏;独立弹窗可隐藏重复标题。 */
showHeader?: boolean
}
/** 多个历史和诊断入口共用折叠、刷新与错误展示。 */
defineProps<Props>()
withDefaults(defineProps<Props>(), { collapsible: true, showHeader: true })
/** 展开状态由调用方决定,只在展开后读取诊断。 */
const open = defineModel<boolean>('open', { default: false })
/** 显式刷新只发出读取事件,不产生任何生成或修复操作。 */
@@ -24,14 +28,20 @@ const emit = defineEmits<{ refresh: [] }>()
<template>
<!-- 以下是只读诊断的标题、展开与手动刷新模块 -->
<section class="workspace-panel text-xs leading-6" :aria-label="title">
<div class="flex flex-wrap items-center justify-between gap-3">
<div v-if="showHeader" class="flex flex-wrap items-center justify-between gap-3">
<strong><FieldLabel :label="title" :description="description" /></strong>
<div class="flex items-center gap-3">
<NButton text size="small" :aria-label="`${open ? '收起' : '查看'}${title}`" @click="open = !open">
<NButton
v-if="collapsible !== false"
text
size="small"
:aria-label="`${open ? '收起' : '查看'}${title}`"
@click="open = !open"
>
{{ open ? '收起' : '查看' }}
</NButton>
<NButton
v-if="open"
v-if="open || collapsible === false"
text
size="small"
:loading="loading"
@@ -43,7 +53,7 @@ const emit = defineEmits<{ refresh: [] }>()
</div>
</div>
<!-- 以下是读取状态、错误与实际诊断结果模块 -->
<div v-if="open" class="mt-3">
<div v-if="open || collapsible === false" :class="{ 'mt-3': showHeader }">
<NAlert v-if="error" type="error" :show-icon="false" role="alert">{{ error }}</NAlert>
<p v-if="loading" class="text-muted" role="status">正在加载…</p>
<slot v-else />
+13 -3
View File
@@ -1,10 +1,20 @@
<script setup lang="ts">
import { NScrollbar } from 'naive-ui'
/** 工作区固定标题和操作区;仅内容容器滚动,不向 document 传播滚动。 */
defineProps<{ split?: boolean; compact?: boolean }>()
/** 工作区默认固定标题和操作区,可让手机提示、目录与正文在项目内容区一起滚动。 */
defineProps<{
/** 是否采用目录与详情分栏。 */
split?: boolean
/** 是否使用紧凑内容布局。 */
compact?: boolean
/** 手机是否让提示、工具、目录和正文一起滚动,项目顶栏仍固定。 */
mobileScroll?: boolean
}>()
</script>
<template>
<section class="workspace-page" :class="{ 'content-first-workspace': compact }">
<section
class="workspace-page"
:class="{ 'content-first-workspace': compact, 'mobile-reading-workspace': mobileScroll }"
>
<!-- 以下是统一对齐的页面提示、标题与正文模块 -->
<div v-if="$slots.notice" class="workspace-notice"><slot name="notice" /></div>
<NScrollbar v-if="$slots.header" class="workspace-heading-scroll"
+2 -1
View File
@@ -17,13 +17,14 @@ const open = defineModel<boolean>('open', { default: false })
class="workspace-tools-trigger"
data-workspace-tools
:aria-label="label"
:title="label"
aria-haspopup="dialog"
:aria-expanded="open"
@click="open = true"
>
<template #icon><Settings2 :size="15" /></template>
<span class="workspace-tools-label">{{ label }}</span
><span v-if="hasReceipt" class="text-xs text-muted"> · 有回执</span>
><span v-if="hasReceipt" class="workspace-tools-receipt text-xs text-muted"> · 有回执</span>
</NButton>
<AppDialog v-model:open="open" :title="title" description="" wide>
<div class="workspace-tools-body"><slot /></div>
+1
View File
@@ -5,6 +5,7 @@ export { default as EmptyState } from './EmptyState.vue'
export { default as StatusBadge } from './StatusBadge.vue'
export { default as StudioLogo } from './StudioLogo.vue'
export { default as AssetImage } from './AssetImage.vue'
export { default as AssetOpenLink } from './AssetOpenLink.vue'
export { default as RevealImage } from './RevealImage.vue'
export { default as DirectoryItem } from './DirectoryItem.vue'
export { default as WorkspaceTools } from './WorkspaceTools.vue'