<template> <div> <div v-for="(video) in videoList" :key="video" class="video-item"> <video :src="video" alt="" controls="controls"/> </div> <el-image v-for="(img, index) in imgList" :key="img" :src="img" :preview-src-list="imgList.slice(index,imgList.length).concat(imgList.slice(0,index))" fit="cover" class="image"/> <div v-for="(audio, index) in audioList" :key="audio" class="audio-item"> <span class="audio-title">录音{{ index + 1 }}</span> <audio-player ref="audio" :url="audio" :the-control-list="controlList" /> </div> </div> </template> <script> import AudioPlayer from '@/components/AudioPlayer/AudioPlayer' export default { name: 'CaseFile', components: { AudioPlayer }, props: { imgIds: { type: String, default: '' }, videoIds: { type: String, default: '' }, audioIds: { type: String, default: '' } }, data() { return { baseUrl: this.baseConfig.baseUrl + '/static/', videoDialogVisible: false, audioDialogVisible: false, dialogVideoUrl: '', dialogAudioUrl: '', dialogAudioName: '', controlList: 'onlyOnePlaying noMuted noVolume' } }, computed: { imgList() { return this.imgIds ? this.imgIds.split(',').map(item => this.baseUrl + item) : [] }, videoList() { return this.videoIds ? this.videoIds.split(',').map(item => this.baseUrl + item) : [] }, audioList() { return this.audioIds ? this.audioIds.split(',').map(item => this.baseUrl + item) : [] } }, methods: { handleShowVideo(video) { console.log('....') this.videoDialogVisible = true this.dialogVideoUrl = video }, handleShowAudio(audio, index) { this.audioDialogVisible = true this.dialogAudioUrl = audio this.dialogAudioName = `录音` + (index + 1) }, handleCloseAudio() { this.$refs.audio.pausePlay() } } } </script> <style rel="stylesheet/scss" lang="scss" scoped> .el-image.image { width: 150px; height: 150px; margin-right: 20px; } video { width: 150px; height: 150px; margin-right: 20px; object-fit: cover; } :fullscreen { object-fit: contain !important; } .video-item{ width: 150px; height: 150px; margin-right: 20px; position: relative; display: inline-block; overflow: hidden; } .audio-item{ font-size: 12px; .di.main-wrap{ padding: 0px !important; } } .audio-title{ font-weight: bolder; margin-right: 10px; } </style>