|
@@ -24,14 +24,7 @@
|
|
|
</div>
|
|
|
<div class="icon-div">
|
|
|
<div class="flex-center-center">
|
|
|
- <SvgIcon
|
|
|
- @click="handleBack"
|
|
|
- name="ele-DArrowLeft"
|
|
|
- title="快退"
|
|
|
- class="mr5 cursor-pointer"
|
|
|
- size="24px"
|
|
|
- color="var(--el-color-primary)"
|
|
|
- />
|
|
|
+ <SvgIcon @click="handleBack" name="ele-DArrowLeft" title="快退" class="mr5 cursor-pointer" size="24px" color="var(--el-color-primary)" />
|
|
|
<el-text class="mr20" size="small" type="info">-{{ props.backSecond }}S</el-text>
|
|
|
</div>
|
|
|
<SvgIcon
|
|
@@ -62,7 +55,7 @@
|
|
|
</el-dropdown-menu>
|
|
|
</template>
|
|
|
</el-dropdown>
|
|
|
- <!-- <SvgIcon name="ele-Download" class="cursor-pointer ml5" size="18px" color="var(--el-color-primary)" @click="downLoad" title="下载" />-->
|
|
|
+ <SvgIcon name="ele-Download" class="cursor-pointer ml5" size="18px" color="var(--el-color-primary)" @click="downLoad" title="下载录音" />
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -73,8 +66,8 @@
|
|
|
import { reactive, ref, computed, watch, nextTick } from 'vue';
|
|
|
import { formatDuration } from '@/utils/formatTime';
|
|
|
import { ElMessage } from 'element-plus';
|
|
|
-import { downloadFileBySrc, downloadFileByStream } from "@/utils/tools";
|
|
|
-import { fileDownload } from "@/api/public/file";
|
|
|
+import { downloadFileBySrc, downloadFileByStream } from '@/utils/tools';
|
|
|
+import { fileDownload } from '@/api/public/file';
|
|
|
|
|
|
// 定义父组件传过来的值
|
|
|
const props = defineProps({
|
|
@@ -82,10 +75,15 @@ const props = defineProps({
|
|
|
type: String,
|
|
|
required: true,
|
|
|
},
|
|
|
+ recordingAbsolutePath: {
|
|
|
+ // 录音文件绝对路径
|
|
|
+ type: String,
|
|
|
+ default: '',
|
|
|
+ },
|
|
|
fileName: {
|
|
|
type: String,
|
|
|
required: false,
|
|
|
- default: '测试文件',
|
|
|
+ default: '下载录音',
|
|
|
},
|
|
|
backSecond: {
|
|
|
// 快退时间
|
|
@@ -121,25 +119,25 @@ const playPauseAudio = () => {
|
|
|
};
|
|
|
// 快退
|
|
|
const handleBack = () => {
|
|
|
- if (audioData.currentTime - props.backSecond < 0) {
|
|
|
- audioData.currentTime = 0;
|
|
|
- progressBarByCurrentTime();
|
|
|
- return;
|
|
|
- }
|
|
|
- audioRef.value.currentTime = audioData.currentTime - props.backSecond;
|
|
|
- audioData.currentTime = audioRef.value.currentTime;
|
|
|
- progressBarByCurrentTime();
|
|
|
+ if (audioData.currentTime - props.backSecond < 0) {
|
|
|
+ audioData.currentTime = 0;
|
|
|
+ progressBarByCurrentTime();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ audioRef.value.currentTime = audioData.currentTime - props.backSecond;
|
|
|
+ audioData.currentTime = audioRef.value.currentTime;
|
|
|
+ progressBarByCurrentTime();
|
|
|
};
|
|
|
// 快进
|
|
|
const handleForward = () => {
|
|
|
- if (audioData.currentTime + props.forwardSecond > audioData.duration) {
|
|
|
- audioData.currentTime = audioData.duration;
|
|
|
- progressBarByCurrentTime();
|
|
|
- return;
|
|
|
- }
|
|
|
- audioRef.value.currentTime = audioData.currentTime + props.forwardSecond;
|
|
|
- audioData.currentTime = audioRef.value.currentTime;
|
|
|
- progressBarByCurrentTime();
|
|
|
+ if (audioData.currentTime + props.forwardSecond > audioData.duration) {
|
|
|
+ audioData.currentTime = audioData.duration;
|
|
|
+ progressBarByCurrentTime();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ audioRef.value.currentTime = audioData.currentTime + props.forwardSecond;
|
|
|
+ audioData.currentTime = audioRef.value.currentTime;
|
|
|
+ progressBarByCurrentTime();
|
|
|
};
|
|
|
const icon = computed(() => {
|
|
|
if (audioData.muteState) {
|
|
@@ -240,9 +238,9 @@ const mute = () => {
|
|
|
};
|
|
|
// 下载
|
|
|
const downLoad = () => {
|
|
|
- fileDownload({path:props.url}).then((res:any) => {
|
|
|
- downloadFileByStream(res, <string>props.fileName);
|
|
|
- });
|
|
|
+ fileDownload({ path: import.meta.env.VITE_RECORD_DOWNLOAD_PREFIX + props.recordingAbsolutePath }).then((res: any) => {
|
|
|
+ downloadFileByStream(res, <string>props.fileName);
|
|
|
+ });
|
|
|
};
|
|
|
nextTick(() => {
|
|
|
audioRef.value.onerror = () => {
|