Restructure backend and frontend modules; add story, library, and editor schema migrations. Support editable automatic production, manual confirmation modes, account and user lifecycle management, compact container scrolling, consistent forms, and per-task result previews. Update inference and TTS scheduling, deployment guidance, and regression coverage; remove obsolete standalone pages and temporary acceptance artifacts.
104 lines
2.8 KiB
Vue
104 lines
2.8 KiB
Vue
<script setup lang="ts">
|
||
import { computed } from 'vue'
|
||
import DeleteRecordButton from './DeleteRecordButton.vue'
|
||
import {
|
||
Picture,
|
||
VideoPlay,
|
||
MoreFilled,
|
||
Clock,
|
||
Document,
|
||
Warning,
|
||
Loading,
|
||
} from '@element-plus/icons-vue'
|
||
import type { Asset, Job } from '../types'
|
||
import { formatDate, isActive, phaseLabel, stateLabel, taskLabels } from '../utils/format'
|
||
const props = defineProps<{ job: Job }>()
|
||
const emit = defineEmits<{ open: [string]; preview: [Asset] }>()
|
||
const cover = computed(() =>
|
||
props.job.result_assets?.find((asset) => ['image', 'video'].includes(asset.kind)),
|
||
)
|
||
function open() {
|
||
if (cover.value && props.job.state === 'succeeded') emit('preview', cover.value)
|
||
else emit('open', props.job.id)
|
||
}
|
||
</script>
|
||
<template>
|
||
<article
|
||
class="result-card"
|
||
:class="{ working: isActive(job), failed: ['failed', 'timed_out'].includes(job.state) }"
|
||
>
|
||
<button
|
||
class="result-media"
|
||
@click="open"
|
||
>
|
||
<img
|
||
v-if="cover?.kind === 'image' || cover?.thumbnail_url"
|
||
:src="cover.thumbnail_url || cover.preview_url"
|
||
:alt="job.prompt"
|
||
loading="lazy"
|
||
/>
|
||
<video
|
||
v-else-if="cover?.kind === 'video'"
|
||
:src="cover.preview_url"
|
||
preload="metadata"
|
||
muted
|
||
playsinline
|
||
/>
|
||
<div
|
||
v-else
|
||
class="pending-art"
|
||
>
|
||
<div
|
||
v-if="isActive(job)"
|
||
class="generation-orbit"
|
||
/>
|
||
<el-icon
|
||
v-else
|
||
:size="34"
|
||
><Warning v-if="job.error" /><Document v-else /></el-icon
|
||
><strong>{{ stateLabel(job) }}</strong
|
||
><span>{{ phaseLabel(job) }}</span>
|
||
</div>
|
||
<span
|
||
class="media-badge"
|
||
:class="job.state"
|
||
><i :class="{ pulse: isActive(job) }" />{{ stateLabel(job) }}</span
|
||
>
|
||
<span
|
||
v-if="cover?.kind === 'video'"
|
||
class="play-circle"
|
||
><el-icon><VideoPlay /></el-icon
|
||
></span>
|
||
</button>
|
||
<div class="result-caption">
|
||
<div class="result-kicker">
|
||
<span>{{ taskLabels[job.task_type] }}</span
|
||
><button
|
||
class="icon-button"
|
||
aria-label="查看任务详情"
|
||
@click="emit('open', job.id)"
|
||
>
|
||
<el-icon><MoreFilled /></el-icon>
|
||
</button>
|
||
</div>
|
||
<button
|
||
class="result-prompt"
|
||
@click="emit('open', job.id)"
|
||
>
|
||
{{ job.prompt || taskLabels[job.task_type] }}
|
||
</button>
|
||
<div class="result-footnote">
|
||
<span>{{ formatDate(job.created_at) }}</span
|
||
><span v-if="job.preemptions">让行 {{ job.preemptions }} 次</span
|
||
><span v-else-if="job.parameters.width"
|
||
>{{ job.parameters.width }} × {{ job.parameters.height }}</span
|
||
>
|
||
</div>
|
||
<DeleteRecordButton
|
||
kind="job"
|
||
:record="job"
|
||
/>
|
||
</div>
|
||
</article>
|
||
</template>
|