|
|
|
@ -27,11 +27,8 @@ |
|
|
|
<div class="record-row record-row--video"> |
|
|
|
<span class="record-label">云视频:</span> |
|
|
|
<div class="record-content"> |
|
|
|
<button type="button" class="video-preview" aria-label="播放云视频" @click="videoDialogVisible = true"> |
|
|
|
<span class="video-play"> |
|
|
|
<el-icon :size="32"><VideoPlay /></el-icon> |
|
|
|
</span> |
|
|
|
</button> |
|
|
|
<video v-if="record.videoUrl" :src="buildFileUrl(record.videoUrl)" class="record-video" controls /> |
|
|
|
<span v-else class="record-empty">暂无视频</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
@ -46,34 +43,49 @@ |
|
|
|
</div> |
|
|
|
</section> |
|
|
|
</article> |
|
|
|
|
|
|
|
<el-dialog v-model="videoDialogVisible" title="云视频" width="640px" class="video-dialog" append-to-body> |
|
|
|
<div class="video-dialog-content"> |
|
|
|
<div class="video-dialog-player"> |
|
|
|
<el-icon :size="72"><VideoPlay /></el-icon> |
|
|
|
</div> |
|
|
|
<p class="video-dialog-name">{{ record.videoName }}</p> |
|
|
|
<p class="video-dialog-tip">当前页面使用模拟数据,接入真实接口后可直接播放任务视频。</p> |
|
|
|
</div> |
|
|
|
<template #footer> |
|
|
|
<el-button type="primary" @click="videoDialogVisible = false">关闭</el-button> |
|
|
|
</template> |
|
|
|
</el-dialog> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script setup lang="ts" name="NosDetailTranscript"> |
|
|
|
import { computed, ref } from 'vue'; |
|
|
|
import { VideoPlay } from '@element-plus/icons-vue'; |
|
|
|
import { computed } from 'vue'; |
|
|
|
import { useRoute, useRouter } from 'vue-router'; |
|
|
|
import { getTranscriptById } from './mock'; |
|
|
|
|
|
|
|
const route = useRoute(); |
|
|
|
const router = useRouter(); |
|
|
|
const videoDialogVisible = ref(false); |
|
|
|
|
|
|
|
const record = computed(() => getTranscriptById(route.params.id)); |
|
|
|
const pageTitle = computed(() => `${record.value.taskName}`); |
|
|
|
const BASE_API = import.meta.env.VITE_APP_BASE_API || ''; |
|
|
|
const FILE_SERVER_PREFIX = import.meta.env.VITE_APP_FILE_SERVER_PREFIX || ''; |
|
|
|
|
|
|
|
const isOssId = (val: string) => /^[0-9]+$/.test(val.trim()); |
|
|
|
|
|
|
|
const toRelativeFilePath = (val: string) => { |
|
|
|
const raw = val.trim(); |
|
|
|
if (!raw) return ''; |
|
|
|
const prefix = FILE_SERVER_PREFIX.replace(/\/+$/, ''); |
|
|
|
let path = raw.startsWith('/') ? raw : `/${raw}`; |
|
|
|
const normalizedPrefix = prefix.startsWith('http') ? prefix : `/${prefix}`; |
|
|
|
while (path === normalizedPrefix || path.startsWith(`${normalizedPrefix}/`)) { |
|
|
|
path = path.slice(normalizedPrefix.length) || '/'; |
|
|
|
if (!path.startsWith('/')) path = `/${path}`; |
|
|
|
} |
|
|
|
return path; |
|
|
|
}; |
|
|
|
|
|
|
|
const buildFileUrl = (val: string) => { |
|
|
|
if (!val) return ''; |
|
|
|
const raw = val.trim(); |
|
|
|
if (raw.startsWith('http://') || raw.startsWith('https://') || raw.startsWith('blob:') || raw.startsWith('data:')) { |
|
|
|
return raw; |
|
|
|
} |
|
|
|
if (isOssId(raw)) { |
|
|
|
return `${BASE_API}/resource/oss/download/${raw}`; |
|
|
|
} |
|
|
|
const relative = toRelativeFilePath(raw); |
|
|
|
return `${FILE_SERVER_PREFIX.replace(/\/+$/, '')}${relative}`; |
|
|
|
}; |
|
|
|
|
|
|
|
const handleBack = () => { |
|
|
|
router.back(); |
|
|
|
@ -197,71 +209,15 @@ const handleBack = () => { |
|
|
|
word-break: break-all; |
|
|
|
} |
|
|
|
|
|
|
|
.video-preview { |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|
justify-content: center; |
|
|
|
width: 140px; |
|
|
|
height: 138px; |
|
|
|
padding: 0; |
|
|
|
border: 1px solid #8e8e8e; |
|
|
|
background: #cecece; |
|
|
|
cursor: pointer; |
|
|
|
transition: |
|
|
|
background-color 0.2s ease, |
|
|
|
box-shadow 0.2s ease; |
|
|
|
} |
|
|
|
|
|
|
|
.video-preview:hover, |
|
|
|
.video-preview:focus-visible { |
|
|
|
background: #c4c4c4; |
|
|
|
box-shadow: 0 0 0 3px rgba(23, 105, 224, 0.12); |
|
|
|
outline: none; |
|
|
|
} |
|
|
|
|
|
|
|
.video-play { |
|
|
|
display: inline-flex; |
|
|
|
align-items: center; |
|
|
|
justify-content: center; |
|
|
|
width: 56px; |
|
|
|
height: 56px; |
|
|
|
color: #ef4f9b; |
|
|
|
border: 3px solid #5149d8; |
|
|
|
border-radius: 50%; |
|
|
|
} |
|
|
|
|
|
|
|
.video-play :deep(.el-icon) { |
|
|
|
margin-left: 3px; |
|
|
|
} |
|
|
|
|
|
|
|
.video-dialog :deep(.el-dialog) { |
|
|
|
max-width: calc(100vw - 32px); |
|
|
|
} |
|
|
|
|
|
|
|
.video-dialog-content { |
|
|
|
text-align: center; |
|
|
|
} |
|
|
|
|
|
|
|
.video-dialog-player { |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|
justify-content: center; |
|
|
|
height: 320px; |
|
|
|
color: #fff; |
|
|
|
background: #1d1e20; |
|
|
|
border-radius: 4px; |
|
|
|
} |
|
|
|
|
|
|
|
.video-dialog-name { |
|
|
|
margin: 18px 0 6px; |
|
|
|
color: #303133; |
|
|
|
font-size: 15px; |
|
|
|
.record-video { |
|
|
|
width: 220px; |
|
|
|
height: 160px; |
|
|
|
background: #000; |
|
|
|
border-radius: 8px; |
|
|
|
} |
|
|
|
|
|
|
|
.video-dialog-tip { |
|
|
|
margin: 0; |
|
|
|
.record-empty { |
|
|
|
color: #909399; |
|
|
|
font-size: 13px; |
|
|
|
} |
|
|
|
|
|
|
|
@media (max-width: 768px) { |
|
|
|
@ -300,7 +256,7 @@ const handleBack = () => { |
|
|
|
padding-left: 0; |
|
|
|
} |
|
|
|
|
|
|
|
.video-preview { |
|
|
|
.record-video { |
|
|
|
width: min(240px, 100%); |
|
|
|
height: 180px; |
|
|
|
} |
|
|
|
|