[功能] 人物管理按运动视频重设计 - 人物卡新增「运动片段」区块(缩略图/时间/摘要/事件数,点击跳时间轴定位); 新增 GET /api/ui/people/clips 后端接口(按 label/canonical_name 查关联运动片段,含 first_ts/clip_events); Timeline 支持 ?video= 定位

This commit is contained in:
ericwyuan
2026-08-22 12:55:30 +08:00
parent ffcc292cce
commit 4cf4fc4bc2
5 changed files with 121 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
<script setup>
import { computed, onMounted, ref, watch } from 'vue'
import { useRoute } from 'vue-router'
import { api, fmtDateOnly, fmtMonthDayTime, fmtDateTime, parseTs } from '../api.js'
import PageHeader from '../components/PageHeader.vue'
import StatCard from '../components/StatCard.vue'
@@ -8,11 +9,14 @@ import EventItem from '../components/EventItem.vue'
import Badge from '../components/Badge.vue'
import Spinner from '../components/Spinner.vue'
const route = useRoute()
const dateFilter = ref('')
const page = ref(0)
const videos = ref([])
const stats = ref(null)
const selectedId = ref(null)
// 支持 ?video=<id> 定位(人物卡/其他页跳转);非 null 时不因列表重置选中
const selectedId = ref(Number(route.query.video) || null)
const detail = ref(null)
const loadError = ref('')
const videosLoading = ref(true)
@@ -32,7 +36,8 @@ async function loadVideos() {
try {
const data = await api.videos({ date: dateFilter.value || undefined, page: page.value })
videos.value = data.videos
if (videos.value.length && !videos.value.some(v => v.id === selectedId.value)) {
// 仅当没有 query 定位且当前选中不在列表时,才默认选第一条
if (videos.value.length && !videos.value.some(v => v.id === selectedId.value) && !route.query.video) {
selectedId.value = videos.value[0].id
}
} catch (e) {