feat : 获取工作台当前线路记录

This commit is contained in:
2024-10-13 15:57:11 +08:00
parent 02b1cc03f7
commit 4a6ce61091
3 changed files with 35 additions and 15 deletions

View File

@@ -10,6 +10,7 @@
import {useAuthStore} from '@/stores/userstore.js'
import {getToken} from '@/utils/auth'
import {usePermisstionStroe} from '@/stores/permisstion'
import {getCurrentContent} from "@/api/workbench";
const permisstionStore = usePermisstionStroe()
const authStore = useAuthStore()
@@ -37,6 +38,24 @@ let token = getToken();
let send = {
type: "ping",
};
// if(localStorage.getItem('recordLeftObj')){
// recordLeftObj.value=JSON.parse(localStorage.getItem('recordLeftObj'))
// }
// if(localStorage.getItem('recordRightObj')){
// recordRightObj.value=JSON.parse(localStorage.getItem('recordRightObj'))
// }
const getCurrentMsg=(line)=>{
getCurrentContent(line).then(res=>{
// console.info("🚀 ~method:res -----", res)
if(line==1){
recordLeftObj.value.content=res.data
}else if(line==2){
recordRightObj.value.content=res.data
}
})
}
getCurrentMsg(1)
getCurrentMsg(2)
//滚动面板自动滑动到底部
const scrollToBottom = (scrollbarRef) => {
if (scrollbarRef) {
@@ -64,8 +83,8 @@ const handleShowDeadLine=(recordObj,data)=>{
}
const initWebSocket = () => {
try {
const wsUrl=setWsUrl(`/ws/text/${token}`)
// const wsUrl = `ws://frp.feashow.cn:31800/ws/text/${token}`
// const wsUrl=setWsUrl(`/ws/text/${token}`)
const wsUrl = `ws://frp.feashow.cn:31800/ws/text/${token}`
// const wsUrl = `ws://112.19.165.99:20002/api/ws/text/${token}`
socket = new WebSocket(wsUrl)
// 2. ws.send()给服务器发送信息
@@ -104,16 +123,13 @@ const initWebSocket = () => {
console.info("🚀 ~method:flag -----", flag)
if(flag){
recordLeftObj.value.content.push({
// callIdNumber: "17282197782048",
// conversationId:0,
// conversationTimestamp: "",
// createTime: "2024-10-08",
isLine:true,
lineMsg: "一轮通话结束~~",
speaker: data.content.speaker
})
}
recordLeftObj.value.content.push(data.content)
localStorage.setItem('recordLeftObj',JSON.stringify(recordLeftObj.value))
// console.info("🚀 ~method:onmessage -----", recordLeftObj.value)
nextTick(() => {
scrollToBottom(recordLeftRef.value)
@@ -127,10 +143,6 @@ const initWebSocket = () => {
console.info("🚀 ~method:flag -----", flag)
if(flag){
recordRightObj.value.content.push({
// callIdNumber: "17282197782048",
// conversationId:0,
// conversationTimestamp: "",
// createTime: "2024-10-08",
isLine:true,
lineMsg: "一轮通话结束~~",
speaker: data.content.speaker
@@ -138,6 +150,7 @@ const initWebSocket = () => {
}
recordRightObj.value.content.push(data.content)
// console.info("🚀 ~method:onmessage -----", recordRightObj.value)
localStorage.setItem('recordRightObj',JSON.stringify(recordRightObj.value))
nextTick(() => {
scrollToBottom(recordRightRef.value);
})