feat: 主体目录增加母版缩略图与紧凑图文布局
This commit is contained in:
1 parent
ad37c8ab7c
commit
9e3bff7997
8 files changed
+470
-8
No files matched your search
@@ -25,6 +25,8 @@ import IdentityEditor from './components/IdentityEditor.vue'
|
||||
import IdentityGallery from './components/IdentityGallery.vue'
|
||||
import IdentityImageDialog from './components/IdentityImageDialog.vue'
|
||||
import CastingCandidateDialog from './components/CastingCandidateDialog.vue'
|
||||
import IdentityThumbnail from './components/IdentityThumbnail.vue'
|
||||
import type { IdentitySubject } from './types'
|
||||
|
||||
/** 主体身份工作区按正式主体聚合,不把同一主体的多个 Form 当成不同身份。 */
|
||||
const route = useRoute()
|
||||
@@ -71,10 +73,21 @@ const imageOpen = ref(false)
|
||||
const castingOpen = ref(false)
|
||||
const pendingSelection = ref('')
|
||||
const anchor = computed(() => currentAnchor(images.value))
|
||||
const thumbnailRefreshKey = ref(0)
|
||||
const casting = computed(() => {
|
||||
const value = castingQuery.data.value
|
||||
return value && Array.isArray(value.items) ? value : null
|
||||
})
|
||||
const castingBySubject = computed(() => new Map(casting.value?.items.map(item => [item.subjectId, item]) ?? []))
|
||||
|
||||
/** 详情与选角数据已有母版地址时直接复用,避免对每个角色重复查询。 */
|
||||
function thumbnailSource(item: IdentitySubject): string | null | undefined {
|
||||
if (item.id === selectedId.value && detail.data.value) return anchor.value?.imageUrl ?? null
|
||||
const row = castingBySubject.value.get(item.id)
|
||||
if (row) return row.anchorImageUrl || (row.anchorImageId ? undefined : null)
|
||||
if (item.id === selectedId.value) return null
|
||||
return undefined
|
||||
}
|
||||
const filtered = computed(() =>
|
||||
subjects.value.filter(
|
||||
item =>
|
||||
@@ -121,6 +134,7 @@ function exportReceipt() {
|
||||
|
||||
/** 目录刷新同时读取正式形态和 Character Casting,避免无形态角色状态滞后。 */
|
||||
function refreshDirectory() {
|
||||
thumbnailRefreshKey.value++
|
||||
void Promise.all([catalog.refresh(), castingQuery.refresh()])
|
||||
}
|
||||
|
||||
@@ -438,16 +452,22 @@ watch(
|
||||
@click="select(item.id)"
|
||||
class="identity-subject-item"
|
||||
>{{ item.name }}
|
||||
<template #leading>
|
||||
<IdentityThumbnail
|
||||
:project-id="projectId"
|
||||
:subject-id="item.id"
|
||||
:name="item.name"
|
||||
:module="item.module"
|
||||
:identity-id="item.identity === null ? null : item.identity?.id"
|
||||
:source="thumbnailSource(item)"
|
||||
:refresh-key="thumbnailRefreshKey"
|
||||
/>
|
||||
</template>
|
||||
<template #eyebrow>{{ item.ref }}</template>
|
||||
<template #meta>
|
||||
<span>{{ item.forms.length }} 个形态</span
|
||||
><span
|
||||
v-if="casting?.items.find(row => row.subjectId === item.id)"
|
||||
class="directory-status"
|
||||
>
|
||||
{{
|
||||
castingStatusLabel(casting.items.find(row => row.subjectId === item.id)!.status)
|
||||
}}</span
|
||||
><span v-if="castingBySubject.has(item.id)" class="directory-status">
|
||||
{{ castingStatusLabel(castingBySubject.get(item.id)!.status) }}</span
|
||||
>
|
||||
</template></DirectoryItem
|
||||
>
|
||||
|
||||
Reference in new issue
Block a user