Kaynağa Gözat

reactor:智能语音回访播放调整;

zhangchong 5 ay önce
ebeveyn
işleme
f0b0b4f999

+ 51 - 1
src/components/PlayRecord/index.vue

@@ -119,6 +119,56 @@ const playRecord = async (callId: string) => {
 	});
 	window.open(routeData.href, '_blank', 'left=100,top=100,width=600,height=200');
 };
+const playRecordPath = async (path: string) => {
+	recordUrl.value = null;
+	recordUrl.value = path;
+	let popup = window.open('', '_blank', 'left=100,top=100,width=400,height=200');
+	if (popup) {
+		popup.document.write(`
+			<html>
+				<head>
+					<title>智能回访录音</title>
+					<style>
+						body,html {
+						 margin: 0;
+						padding: 0;
+						width: 100%;
+						height: 100%;
+						font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, SimSun, sans-serif;
+						font-weight: 400;
+						-webkit-font-smoothing: antialiased;
+						-webkit-tap-highlight-color: transparent;
+						background-color: var(--hotline-bg-main-color);
+						font-size: 14px;
+						overflow: hidden;
+						position: relative;
+						}
+						.play-content{
+							height: 100%;
+							display: flex;
+							align-items: center;
+							justify-content: center;
+							flex-direction: column;
+						}
+						.audio-player{
+							width: 100%;
+						}
+					</style>
+				</head>
+				<body>
+					 <div class="play-content">
+							<audio controls class="audio-player">
+								<source src="${recordUrl.value}" type="audio/wav">
+								您的浏览器不支持音频组件
+							</audio>
+						</div>
+				</body>
+			</html>
+		`);
+	} else {
+		alert('浏览器阻止了弹出窗口,请允许弹出窗口后再试。');
+	}
+};
 // 点击播放录音
 const audioPlayerRef = ref<RefType>();
 const onPlay = (row: any) => {
@@ -131,7 +181,7 @@ watch(
 	}
 );
 //暴漏变量和方法
-defineExpose({ closeDialog, openDialog, playRecord });
+defineExpose({ closeDialog, openDialog, playRecord, playRecordPath });
 </script>
 <style lang="scss" scoped>
 .item {

+ 1 - 1
src/views/business/visit/components/Visit-detail.vue

@@ -697,7 +697,7 @@ const recordFile = () => {
 };
 // 查看智能回访录音
 const onSmartRecord = () => {
-	playRecordRef.value.playRecord(aiVisitVoiceBaseUrl.value + state.smartRecord);
+	playRecordRef.value.playRecordPath(aiVisitVoiceBaseUrl.value + state.smartRecord);
 };
 // 呼叫
 const prefixOptions = ref<EmptyArrayType>([]);