feat(short-drama-agent-front): 接入关系修复并优化配置与弹窗

This commit is contained in:
GJ committed 2026-10-31 22:37:22 +08:00
1 parent 2db8549818
commit 41d1cfe3ed
15 files changed
+1134 -323

No files matched your search

+36 -4
View File
@@ -1,5 +1,6 @@
<script setup lang="ts">
import { NButton, NModal, NScrollbar } from 'naive-ui'
import { NButton, NModal, NScrollbar, useThemeVars } from 'naive-ui'
import { CircleAlert, CircleCheck, CircleX } from '@lucide/vue'
import { onBeforeUnmount, onMounted, ref, watch } from 'vue'
/** 公共弹窗的标题、说明、操作状态和宽度。 */
@@ -7,8 +8,10 @@ withDefaults(
defineProps<{
/** 弹窗标题,同时作为可访问名称。 */
title: string
/** 标题下的默认说明,可使用 description slot 覆盖。 */
/** 可选的简短标题补充,尽量一句话;完整说明与操作影响应放入默认正文插槽。 */
description?: string
/** 展示语义状态;默认保持中性,警告、成功和错误仅在标题旁显示对应图标。 */
status?: 'default' | 'warning' | 'success' | 'error'
/** 提交期间锁定关闭操作。 */
busy?: boolean
/** 使用宽弹窗布局。 */
@@ -16,8 +19,10 @@ withDefaults(
/** 指定弹窗宽度,单位为像素;实际宽度仍受视口限制。 */
width?: number
}>(),
{ description: '', busy: false, wide: false }
{ description: '', busy: false, wide: false, status: 'default' }
)
/** 状态图标使用当前 Naive 主题颜色,随深浅主题切换,不改变弹窗和按钮配色。 */
const themeVars = useThemeVars()
/** 关闭动画结束后通知调用方,便于在焦点陷阱释放后定位正文。 */
const emit = defineEmits<{ closed: [] }>()
/** 弹窗显隐状态,关闭行为由 Naive 管理。 */
@@ -100,7 +105,34 @@ onBeforeUnmount(() => {
<!-- 以下是固定标题与说明模块,无说明时标题与关闭按钮垂直居中对齐 -->
<template #header>
<div class="min-w-0">
<div class="text-lg font-semibold">{{ title }}</div>
<div class="flex items-center gap-2 text-lg font-semibold">
<!-- 以下是可被读屏识别的状态提示,颜色之外保留不同图形 -->
<CircleAlert
v-if="status === 'warning'"
:size="20"
class="shrink-0"
role="img"
aria-label="警告"
:style="{ color: themeVars.warningColor }"
/>
<CircleCheck
v-else-if="status === 'success'"
:size="20"
class="shrink-0"
role="img"
aria-label="成功"
:style="{ color: themeVars.successColor }"
/>
<CircleX
v-else-if="status === 'error'"
:size="20"
class="shrink-0"
role="img"
aria-label="错误"
:style="{ color: themeVars.errorColor }"
/>
<span class="min-w-0 wrap-anywhere">{{ title }}</span>
</div>
<div v-if="description || $slots.description" class="mt-[2px] text-sm leading-6 font-normal text-muted">
<slot name="description">{{ description }}</slot>
</div>