浏览代码

reactor:坐席辅助请求封装;

zhangchong 1 年之前
父节点
当前提交
7b7a68f5e3

+ 27 - 0
src/api/todo/voiceAssistant.ts

@@ -0,0 +1,27 @@
+/*
+ * @Author: zc
+ * @description 坐席辅助
+ */
+import request from '@/utils/request';
+/**
+ * @description 链接坐席辅助
+ * @param {string} telNo
+ */
+export const voiceAssistant = (telNo: string) => {
+  return request({
+    url: `users/getUserByAgentId/${telNo}`,
+    method: 'get',
+    baseURL:import.meta.env.VITE_VOICE_ASSISTANT_API_URL // 请求地址  可以在不同url中修改
+  });
+}
+/**
+ * @description 获取识别内容
+ * @param {string} callId
+ */
+export const voiceAssistantContent = (callId: string) => {
+  return request({
+    url: `/monitor/remote/details/${callId}`,
+    method: 'get',
+    baseURL:import.meta.env.VITE_VOICE_ASSISTANT_API_URL
+  });
+}

+ 2 - 2
src/layout/navBars/breadcrumb/telControl.vue

@@ -499,6 +499,7 @@ import dayjs from 'dayjs';
 import axios from 'axios';
 import { useSocket } from '@/utils/websocket';
 import mittBus from '@/utils/mitt';
+import { voiceAssistant } from "@/api/todo/voiceAssistant";
 // 引入组件
 const CommonAdvice = defineAsyncComponent(() => import('@/components/CommonAdvice/index.vue')); // 常用意见
 const AnnexList = defineAsyncComponent(() => import('@/components/AnnexList/index.vue'));
@@ -1474,8 +1475,7 @@ const connectVoiceAssistant = async (telNo: string) => {
 		socket.value = null;
 	}
 	try {
-		const { data } = await axios.get(`${import.meta.env.VITE_VOICE_ASSISTANT_API_URL}/users/getUserByAgentId/${telNo}`);
-		const { result } = data;
+		const { result } = await voiceAssistant(telNo);
 		const uid = `8#User-${result.uid}`;
 		const subscribe = `/trans/${result.orgCode}/${result.groupUid}/${uid}`;
 		socket.value = useSocket(import.meta.env.VITE_VOICE_ASSISTANT_SOCKET_URL, { uid, subscribe });

+ 9 - 7
src/views/todo/seats/accept/Voice-assistant.vue

@@ -110,6 +110,7 @@ import { useRoute } from 'vue-router';
 import { formatDate } from '@/utils/formatTime';
 const emit = defineEmits(['orderOverwrite']);
 import mittBus from '@/utils/mitt';
+import { voiceAssistantContent } from "@/api/todo/voiceAssistant";
 // 消息列表
 const messageList = ref<any>([
 	/*{
@@ -193,13 +194,14 @@ const closeSearch = () => {
 	searchCol.value = !searchCol.value;
 };
 // 获取识别内容
-const getRecognize = () => {
-	const callId = route.params.callId;
-	axios.get(`${import.meta.env.VITE_VOICE_ASSISTANT_API_URL}/monitor/remote/details/${callId}`).then((res) => {
-		const { data } = res;
-		const { result } = data;
-		recognizeList.value = result;
-	});
+const getRecognize = async () => {
+  try {
+    const callId = route.params.callId;
+    const {result} = await voiceAssistantContent(typeof callId === "string" ? callId :'');
+    recognizeList.value = result;
+  }catch (error) {
+    console.log('获取识别内容失败', error);
+  }
 };
 // 停止滚动
 const stopScroll = () => {