feat: 调整微信风格明暗主题并完整展示详情图片

This commit is contained in:
GouJ
2026-09-01 19:09:35 +08:00
parent 3a60eebae0
commit 565442c9b1
11 changed files with 202 additions and 70 deletions
@@ -64,6 +64,7 @@ function chooseAnchor() {
:src="selected.status === 'completed' ? selected.imageUrl : null"
:alt="`${subjectName} · ${identityViewLabels[selected.viewType]}`"
class="asset-image-preview mt-4"
object-fit="contain"
preview
:empty-text="selected.status === 'failed' ? '本次生成失败' : '等待后端图片结果'"
/>
@@ -45,7 +45,7 @@ function input(selector: string, value: string) {
}
describe('身份图与母版契约', () => {
it('大图和历史统一 cover,缩略图只切换记录,大图单独打开完整原图', async () => {
it('详情大图 contain 完整显示,历史仍为 cover,缩略图只切换记录', async () => {
wrapper = mount(IdentityGallery, {
attachTo: document.body,
props: {
@@ -66,13 +66,14 @@ describe('身份图与母版契约', () => {
})
const images = wrapper.findAllComponents(NImage)
expect(images).toHaveLength(3)
expect(images.every(image => image.props('objectFit') === 'cover')).toBe(true)
expect(images.map(image => image.props('objectFit'))).toEqual(['contain', 'cover', 'cover'])
expect(images.map(image => image.props('previewDisabled'))).toEqual([false, true, true])
await wrapper.get('[aria-label="查看身份图片 front"] img').trigger('click')
await flushPromises()
expect(wrapper.get('[aria-label="查看身份图片 front"]').attributes('aria-pressed')).toBe('true')
expect(document.querySelector('.n-image-preview-container')).toBeNull()
const main = wrapper.get('.asset-image-preview img')
expect((main.element as HTMLImageElement).style.objectFit).toBe('contain')
expect(main.attributes('src')).toContain('/storage/front.png')
await main.trigger('click')
await flushPromises()