feat: 优化

This commit is contained in:
2026-02-24 23:58:17 +08:00
parent caa69d7353
commit cfaf8cab49
8 changed files with 754 additions and 609 deletions

View File

@@ -176,7 +176,7 @@ const fetchVideoList = async () => {
const params = {
page: currentPage.value,
pageSize: pageSize.value,
fileCategory: 'video',
fileCategory: 'digital_human',
fileName: searchKeyword.value.trim() || undefined
}
@@ -239,32 +239,18 @@ const formatDuration = (seconds) => {
const formatFileSize = (bytes) => {
if (!bytes) return '0 B'
const units = ['B', 'KB', 'MB', 'GB']
let size = bytes
let unitIndex = 0
while (size >= 1024 && unitIndex < units.length - 1) {
size /= 1024
unitIndex++
}
return `${size.toFixed(1)} ${units[unitIndex]}`
const index = Math.floor(Math.log2(bytes) / 10)
const size = bytes / Math.pow(1024, index)
return `${size.toFixed(1)} ${units[index]}`
}
const getVideoPreviewUrl = (video) => {
if (video.coverBase64) {
if (!video.coverBase64.startsWith('data:')) {
return `data:image/jpeg;base64,${video.coverBase64}`
}
return video.coverBase64
return video.coverBase64.startsWith('data:')
? video.coverBase64
: `data:image/jpeg;base64,${video.coverBase64}`
}
if (video.previewUrl) {
return video.previewUrl
}
if (video.coverUrl) {
return video.coverUrl
}
return defaultCover
return video.previewUrl || video.coverUrl || defaultCover
}
const handleCancel = () => {