|
@@ -203,6 +203,7 @@ export default {
|
|
phone: "",
|
|
phone: "",
|
|
uploadFiles: [], // 存储上传的文件
|
|
uploadFiles: [], // 存储上传的文件
|
|
documents: [], // 新增:专门存储文档类型文件的数组
|
|
documents: [], // 新增:专门存储文档类型文件的数组
|
|
|
|
+ currentAudio: null, // 添加当前播放的音频实例
|
|
};
|
|
};
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
@@ -243,11 +244,19 @@ export default {
|
|
methods: {
|
|
methods: {
|
|
/* 播放音频 */
|
|
/* 播放音频 */
|
|
playAudio(audioBase64) {
|
|
playAudio(audioBase64) {
|
|
- console.log(audioBase64);
|
|
|
|
- // 创建音频元素
|
|
|
|
- const audio = new Audio(audioBase64); // 播放音频
|
|
|
|
|
|
+ // 如果有正在播放的音频,先停止它
|
|
|
|
+ if (this.currentAudio) {
|
|
|
|
+ this.currentAudio.pause();
|
|
|
|
+ this.currentAudio = null;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 创建新的音频实例并播放
|
|
|
|
+ const audio = new Audio(audioBase64);
|
|
|
|
+ this.currentAudio = audio;
|
|
|
|
+
|
|
audio.play().catch((error) => {
|
|
audio.play().catch((error) => {
|
|
console.error("Error playing audio:", error);
|
|
console.error("Error playing audio:", error);
|
|
|
|
+ this.currentAudio = null;
|
|
});
|
|
});
|
|
},
|
|
},
|
|
async handleFileUpload(event) {
|
|
async handleFileUpload(event) {
|
|
@@ -1062,7 +1071,7 @@ textarea {
|
|
.input-container textarea {
|
|
.input-container textarea {
|
|
width: 100%; /* 输入框占据所有可用空间 */
|
|
width: 100%; /* 输入框占据所有可用空间 */
|
|
padding: 10px;
|
|
padding: 10px;
|
|
- margin-right: 10px; /* 与按��的间距 */
|
|
|
|
|
|
+ margin-right: 10px; /* 与按钮的间距 */
|
|
box-sizing: border-box;
|
|
box-sizing: border-box;
|
|
}
|
|
}
|
|
|
|
|