|
|
@@ -1,25 +1,42 @@
|
|
|
<template>
|
|
|
<div class="audio-wrapper">
|
|
|
<div v-if="'big' === viewSize" class="audio-big">
|
|
|
- <div class="audio-name">{{ audioIndex + 1 }}. {{ fileName }}</div>
|
|
|
- <div v-if="showSlider" class="slider-area">
|
|
|
- <span class="audio-time">{{ secondFormatConversion(audio.current_time) }}</span>
|
|
|
- <el-slider
|
|
|
- v-model="play_value"
|
|
|
- class="audio-slider"
|
|
|
- :format-tooltip="formatProcessToolTip"
|
|
|
- @change="changeCurrentTime"
|
|
|
- />
|
|
|
- <span class="audio-time">{{ audio_allTime }}</span>
|
|
|
+ <div v-if="'list' === viewMethod">
|
|
|
+ <div v-if="fileNameDisplay == 'true'" class="audio-name">{{ curAudioIndex + 1 }}. {{ fileName }}</div>
|
|
|
+ <div v-if="showSlider" class="slider-area">
|
|
|
+ <span class="audio-time">{{ secondFormatConversion(audio.current_time) }}</span>
|
|
|
+ <el-slider
|
|
|
+ v-model="play_value"
|
|
|
+ class="audio-slider"
|
|
|
+ :format-tooltip="formatProcessToolTip"
|
|
|
+ @change="changeCurrentTime"
|
|
|
+ />
|
|
|
+ <span class="audio-time">{{ audio_allTime }}</span>
|
|
|
+ </div>
|
|
|
+ <div class="audio-icon">
|
|
|
+ <SvgIcon icon-class="pre" size="12" :color="topicColor" @click="changeFile('prev')" />
|
|
|
+ <SvgIcon :icon-class="iconClass" size="26" @click="playAudio" />
|
|
|
+ <SvgIcon icon-class="next" size="12" :color="topicColor" @click="changeFile('next')" />
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- <div class="audio-icon">
|
|
|
- <SvgIcon icon-class="pre" size="12" @click="changeFile('prev')" />
|
|
|
- <SvgIcon :icon-class="iconClass" size="26" @click="playAudio" />
|
|
|
- <SvgIcon icon-class="next" size="12" @click="changeFile('next')" />
|
|
|
+ <div v-else class="independent-big">
|
|
|
+ <div v-if="fileNameDisplay == 'true'" class="audio-name">{{ audioIndex + 1 }}. {{ fileName }}</div>
|
|
|
+ <div class="slider-area">
|
|
|
+ <SvgIcon :icon-class="iconClass" size="18" :color="topicColor" @click="playAudio" />
|
|
|
+ <span class="audio-time">{{ secondFormatConversion(audio.current_time) }}</span>
|
|
|
+ <el-slider
|
|
|
+ v-model="play_value"
|
|
|
+ class="audio-slider"
|
|
|
+ :format-tooltip="formatProcessToolTip"
|
|
|
+ :style="{ '--slider-color': topicColor }"
|
|
|
+ @change="changeCurrentTime"
|
|
|
+ />
|
|
|
+ <span class="audio-time">{{ audio_allTime }}</span>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div v-else-if="'middle' === viewSize" class="audio-middle">
|
|
|
- <div class="audio-name">{{ audioIndex + 1 }}. {{ fileName }}</div>
|
|
|
+ <div v-if="fileNameDisplay == 'true'" class="audio-name">{{ audioIndex + 1 }}. {{ fileName }}</div>
|
|
|
<div class="slider-area">
|
|
|
<SvgIcon :icon-class="iconClass" size="18" @click="playAudio" />
|
|
|
<span class="audio-time">{{ secondFormatConversion(audio.current_time) }}</span>
|
|
|
@@ -33,7 +50,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div v-else-if="'small' === viewSize" class="audio-icons">
|
|
|
- <span>{{ audioIndex + 1 }}.</span>
|
|
|
+ <div v-if="fileNameDisplay == 'true'" class="audio-name">{{ audioIndex + 1 }}. {{ fileName }}</div>
|
|
|
<span class="icon-box">
|
|
|
<SvgIcon
|
|
|
:icon-class="iconClass"
|
|
|
@@ -66,7 +83,6 @@
|
|
|
<script>
|
|
|
import { GetFileURLMap } from '@/api/app';
|
|
|
import { secondFormatConversion } from '@/utils/transform';
|
|
|
-
|
|
|
export default {
|
|
|
name: 'AudioPlay',
|
|
|
props: {
|
|
|
@@ -80,7 +96,7 @@ export default {
|
|
|
},
|
|
|
viewSize: {
|
|
|
type: String,
|
|
|
- required: true,
|
|
|
+ default: 'big',
|
|
|
},
|
|
|
viewMethod: {
|
|
|
type: String,
|
|
|
@@ -103,6 +119,14 @@ export default {
|
|
|
type: Boolean,
|
|
|
default: true,
|
|
|
},
|
|
|
+ fileNameDisplay: {
|
|
|
+ type: String,
|
|
|
+ default: 'true',
|
|
|
+ },
|
|
|
+ topicColor: {
|
|
|
+ type: String,
|
|
|
+ default: '#076aff',
|
|
|
+ },
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
@@ -151,6 +175,9 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
methods: {
|
|
|
+ getCurTime(curTime) {
|
|
|
+ this.curTime = curTime * 1000;
|
|
|
+ },
|
|
|
playAudio() {
|
|
|
if (!this.url) return;
|
|
|
const audio = this.$refs[this.fileId];
|
|
|
@@ -251,6 +278,12 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ .independent-big {
|
|
|
+ .audio-name {
|
|
|
+ text-align: left;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
.audio-middle {
|
|
|
width: 280px;
|
|
|
padding: 12px 16px;
|
|
|
@@ -270,9 +303,19 @@ export default {
|
|
|
|
|
|
.audio-icons {
|
|
|
display: flex;
|
|
|
+ flex-direction: column;
|
|
|
column-gap: 10px;
|
|
|
align-items: center;
|
|
|
|
|
|
+ .audio-name {
|
|
|
+ padding: 8px;
|
|
|
+ margin-bottom: 8px;
|
|
|
+ font-size: 14px;
|
|
|
+ text-align: center;
|
|
|
+ background-color: #eee;
|
|
|
+ border-radius: 4px;
|
|
|
+ }
|
|
|
+
|
|
|
.icon-box {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
@@ -325,7 +368,6 @@ export default {
|
|
|
|
|
|
:deep .el-slider__runway {
|
|
|
height: 4px;
|
|
|
- background-color: #fff;
|
|
|
}
|
|
|
|
|
|
:deep .el-slider__button {
|
|
|
@@ -337,7 +379,7 @@ export default {
|
|
|
|
|
|
:deep .el-slider__bar {
|
|
|
height: 4px;
|
|
|
- background-color: #076aff;
|
|
|
+ background-color: var(--slider-color, #076aff);
|
|
|
}
|
|
|
}
|
|
|
}
|