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

+7 -15
View File
@@ -46,31 +46,23 @@ describe('镜头生产数据契约', () => {
expect(source).toMatch(/\.generation-input-mode-label\s*\{[^}]*mb-\[7px\][^}]*text-xs/)
})
it('主首帧、素材引用和视频使用固定上限的正方形网格,不随少量记录撑满整行', () => {
it('主首帧与主视频共用固定宽度,素材引用保留正方形网格', () => {
const source = readFileSync('src/features/production/components/ShotProductionAssets.vue', 'utf8')
expect(source).toContain('v-if="videos.length" class="video-grid mt-4"')
expect(source).toContain('v-if="currentVideo" class="video-grid mt-4"')
expect(source).toMatch(/\.keyframe-grid,\s*\.video-grid\s*\{[^}]*max-w-\[260px\][^}]*grid-cols-1/)
expect(source).toMatch(
/\.keyframe-grid\s*\{[^}]*grid-template-columns:\s*repeat\(auto-fill, minmax\(180px, 220px\)\)/
)
expect(source).toMatch(
/\.video-input-grid,[\s\S]*?\.video-grid\s*\{[^}]*grid-template-columns:\s*repeat\(auto-fill, minmax\(180px, 220px\)\)/
/\.video-input-grid\s*\{[^}]*grid-template-columns:\s*repeat\(auto-fill, minmax\(180px, 220px\)\)/
)
expect(source).toMatch(/\.keyframe-card \.asset-image\s*\{[^}]*aspect-square/)
expect(source).toMatch(/\.production-video\s*\{[^}]*aspect-square/)
const videoCard = readFileSync('src/features/production/components/VideoCard.vue', 'utf8')
expect(videoCard).toContain('class="block aspect-square w-full bg-[#080808] object-contain"')
expect(source).toMatch(/\.video-input-card\s*\{[^}]*bg-\(--app-control\)/)
expect(source).toMatch(/\.video-input-image\s*\{[^}]*aspect-square/)
expect(source).toContain('object-fit="cover"')
expect(source).not.toContain('class="video-input-ref"')
expect(source).not.toContain('{{ reference.subjectFormName }} · {{ reference.subjectRef }}')
expect(source).toMatch(
/@media \(max-width: 760px\)[\s\S]*?\.video-grid\s*\{[^}]*grid-cols-\[repeat\(2,_minmax\(0,_1fr\)\)\]/
)
})
it('主首帧角标使用深色强调背景并在图片上保持清晰边界', () => {
const source = readFileSync('src/features/production/components/ShotProductionAssets.vue', 'utf8')
expect(source).toMatch(
/\.primary-keyframe-mark\s*\{[^}]*color:\s*var\(--app-on-accent\)[^}]*background:\s*var\(--app-button-primary\)[^}]*box-shadow:/
/@media \(max-width: 760px\)[\s\S]*?\.video-input-grid\s*\{[^}]*grid-cols-\[repeat\(2,_minmax\(0,_1fr\)\)\]/
)
})
@@ -84,19 +84,33 @@ describe('精简公开资产回归', () => {
const wrapper = mount(ShotProductionAssets, { props: { projectId, shot, disabled: false } })
try {
await flushPromises()
expect(wrapper.find('video').exists()).toBe(true)
/** 未确认的候选不出现在主区,只在管理弹窗中播放和检查。 */
expect(wrapper.find('video').exists()).toBe(false)
expect(wrapper.text()).toContain('尚无已确认主视频')
await wrapper
.findAll('button')
.find(button => button.text() === '管理候选(1)')!
.trigger('click')
await flushPromises()
expect(document.querySelector('video')).not.toBeNull()
expect(wrapper.text()).not.toContain('自动校验中')
expect(wrapper.findAll('button').some(button => button.text() === '设为主视频')).toBe(false)
expect(
[...document.querySelectorAll('button')].some(button => button.textContent?.trim() === '设为主视频')
).toBe(false)
const session = qualitySession(
qualityKey(projectId, { kind: 'video', shotId: shot.shotId, assetId: video.id, title: '' })
)
session.videoValidation = validation
await flushPromises()
expect(wrapper.findAll('button').some(button => button.text() === '设为主视频')).toBe(true)
expect(
[...document.querySelectorAll('button')].some(button => button.textContent?.trim() === '设为主视频')
).toBe(true)
expect(sessionVideoValidation('other-project', shot.shotId, video.id)).toBeNull()
session.videoValidation = { ...validation, passed: false }
await flushPromises()
expect(wrapper.findAll('button').some(button => button.text() === '设为主视频')).toBe(false)
expect(
[...document.querySelectorAll('button')].some(button => button.textContent?.trim() === '设为主视频')
).toBe(false)
expect(fetcher.mock.calls.every(([, options]) => options?.method === 'GET')).toBe(true)
} finally {
wrapper.unmount()
@@ -170,7 +184,7 @@ describe('精简公开资产回归', () => {
try {
await flushPromises()
expect(wrapper.findAll('.keyframe-card')).toHaveLength(1)
expect(wrapper.find('.primary-keyframe-mark').attributes('aria-label')).toBe('当前主首帧')
expect(wrapper.find('.keyframe-card').text()).toContain('主首帧')
expect(wrapper.findAll('button').some(item => item.text().includes('设为主首帧'))).toBe(false)
await wrapper
@@ -0,0 +1,61 @@
import { describe, expect, it } from 'vitest'
import { videoRecordedValidation } from '@/features/production/model'
import type { ShotVideoQualityStatus } from '@/features/production/types'
/** 两条候选拥有不同检查结果,用于验证结果不能跨视频归属。 */
const qualityStatus: ShotVideoQualityStatus = {
shotId: 'shot-1',
status: 'passed',
primaryVideoId: 'video-passed',
latestVideoId: 'video-passed',
repairAttempt: 1,
maxRepairAttempts: 2,
validationPassed: true,
issues: [],
chain: [
{
videoId: 'video-failed',
providerStatus: 'completed',
isPrimary: false,
repairAttempt: 0,
maxRepairAttempts: 2,
validationPassed: false,
createdAt: '2026-10-10T00:00:00Z',
updatedAt: '2026-10-10T00:01:00Z'
},
{
videoId: 'video-passed',
providerStatus: 'completed',
isPrimary: true,
repairAttempt: 1,
maxRepairAttempts: 2,
validationPassed: true,
createdAt: '2026-10-10T00:02:00Z',
updatedAt: '2026-10-10T00:03:00Z'
}
]
}
describe('视频检查记录归属', () => {
it('流程通过时仍保留另一个候选未通过的结果', () => {
expect(videoRecordedValidation(qualityStatus, 'shot-1', 'video-failed')).toBe(false)
expect(videoRecordedValidation(qualityStatus, 'shot-1', 'video-passed')).toBe(true)
})
it('其它镜头的同名视频不能提供当前检查结论', () => {
expect(videoRecordedValidation(qualityStatus, 'shot-2', 'video-passed')).toBeNull()
})
it('没有匹配记录时不能用流程级通过结果兜底', () => {
expect(videoRecordedValidation(qualityStatus, 'shot-1', 'video-missing')).toBeNull()
expect(videoRecordedValidation(null, 'shot-1', 'video-passed')).toBeNull()
})
it('尚未检查的候选保持未知状态', () => {
const unchecked: ShotVideoQualityStatus = {
...qualityStatus,
chain: [{ ...qualityStatus.chain[0]!, validationPassed: null }]
}
expect(videoRecordedValidation(unchecked, 'shot-1', 'video-failed')).toBeNull()
})
})