diff --git a/package-lock.json b/package-lock.json index 9b12bb7..9969e43 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,7 +22,8 @@ "vue-countup-v3": "^1.4.2", "vue-echarts": "^7.0.3", "vue-router": "^4.4.5", - "vue3-seamless-scroll": "^2.0.1" + "vue3-seamless-scroll": "^2.0.1", + "vuedraggable": "^4.1.0" }, "devDependencies": { "@vitejs/plugin-vue": "^5.2.1", @@ -4993,6 +4994,12 @@ "node": ">=18" } }, + "node_modules/sortablejs": { + "version": "1.14.0", + "resolved": "https://registry.npmmirror.com/sortablejs/-/sortablejs-1.14.0.tgz", + "integrity": "sha512-pBXvQCs5/33fdN1/39pPL0NZF20LeRbLQ5jtnheIPN9JQAaufGjKdWduZn4U7wCtVuzKhmRkI0DFYHYRbB2H1w==", + "license": "MIT" + }, "node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -5983,6 +5990,18 @@ "throttle-debounce": "5.0.0" } }, + "node_modules/vuedraggable": { + "version": "4.1.0", + "resolved": "https://registry.npmmirror.com/vuedraggable/-/vuedraggable-4.1.0.tgz", + "integrity": "sha512-FU5HCWBmsf20GpP3eudURW3WdWTKIbEIQxh9/8GE806hydR9qZqRRxRE3RjqX7PkuLuMQG/A7n3cfj9rCEchww==", + "license": "MIT", + "dependencies": { + "sortablejs": "1.14.0" + }, + "peerDependencies": { + "vue": "^3.0.1" + } + }, "node_modules/watchpack": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.2.tgz", diff --git a/package.json b/package.json index 64822ea..c010dea 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,8 @@ "vue-countup-v3": "^1.4.2", "vue-echarts": "^7.0.3", "vue-router": "^4.4.5", - "vue3-seamless-scroll": "^2.0.1" + "vue3-seamless-scroll": "^2.0.1", + "vuedraggable": "^4.1.0" }, "devDependencies": { "@vitejs/plugin-vue": "^5.2.1", diff --git a/src/api/home.js b/src/api/home.js index 1f5a2be..b613728 100644 --- a/src/api/home.js +++ b/src/api/home.js @@ -107,4 +107,28 @@ export function getSpotVideoEvents(data) { method: 'post', data }) +} +// 徒步客流统计 +export function getSpotPassengerFlow(data) { + return request({ + url: '/fjtcc-api/api/largeScreen/spot/passengerFlow', + method: 'get', + data + }) +} +// 收藏视频 +export function getVideCollectCate(data) { + return request({ + url: '/fjtcc-api/api/largeScreen/video/collectCate', + method: 'get', + data + }) +} +// 收藏排序 +export function getVideCollectCateSort(data) { + return request({ + url: '/fjtcc-api/api/largeScreen/video/collectCateSort', + method: 'post', + data + }) } \ No newline at end of file diff --git a/src/api/sentiment.js b/src/api/sentiment.js index acb5f8a..5b9e670 100644 --- a/src/api/sentiment.js +++ b/src/api/sentiment.js @@ -73,3 +73,10 @@ export function getSpotListApi() { method: 'get' }) } +// 景区列表 +export function getGsdataDetailApi(data) { + return request({ + url: `/fjtcc-api/api/largeScreen/gsdata/detail/${data}`, + method: 'get', + }) +} diff --git a/src/assets/com/webrtc.js b/src/assets/com/webrtc.js index 3c5af9e..88e602d 100644 --- a/src/assets/com/webrtc.js +++ b/src/assets/com/webrtc.js @@ -24,8 +24,9 @@ export default class MyWebrtc { var holdFlag = false; var session; - var incomingCallAudio = new window.Audio('./static/incoming-call-ringtone.wav'); - var ringbackAudio = new window.Audio('./static/ringbacktone.wav'); + var incomingCallAudio = new window.Audio('../static/incoming-call-ringtone.wav'); + var ringbackAudio = new window.Audio('../static/ringbacktone.wav'); + console.log(incomingCallAudio,'incomingCallAudio') incomingCallAudio.loop = true; ringbackAudio.loop = true; var remoteAudio = new window.Audio(); @@ -45,9 +46,9 @@ export default class MyWebrtc { video: true }; } - + this.changeAgent = null //jssip实例初始化 - this.jssipAgent = function(JsSipPhoneNumber, JsSipgetIp, JsSipgetPort, JsSipgetPassWord, remoteVideo, Registerstate, Callstate) { + this.jssipAgent = function(JsSipPhoneNumber, JsSipgetIp, JsSipgetPort, JsSipgetPassWord, remoteVideo, Registerstate, Callstate,callback) { getJsSipPhoneNumber = JsSipPhoneNumber; getJsSipgetIp = JsSipgetIp; getJsSipgetPassWord = JsSipgetPassWord; @@ -75,12 +76,13 @@ export default class MyWebrtc { uri: sip_uri_, register: true, password: sip_password_, - contact_uri: sip_uri_ + ';transport=wss', + contact_uri: sip_uri_ + ';transport=ws', ws_servers: ws_uri_ - //session_timers: false + // session_timers: false }; userAgent = new JsSIP.UA(configuration); + this.changeAgent = userAgent incomingCallAudio.play(); incomingCallAudio.pause(); ringbackAudio.play(); @@ -108,9 +110,7 @@ export default class MyWebrtc { }); //为传入或传出的会话/呼叫 userAgent.on('newRTCSession', function(data) { - console.info('onNewRTCSession: ', data); if(data.originator == 'remote') { //incoming call - if(globalCallPhoneStates == "连接中" || globalCallPhoneStates == "通话中" || globalCallPhoneStates.indexOf("来电")>-1){ var options2 = { all: false, @@ -119,8 +119,9 @@ export default class MyWebrtc { data.session.terminate(options2); return; } - - autoAnswerFlag = document.getElementById('autoAnswerFlag').checked; + // callback(data,globalCallPhoneStates) + // autoAnswerFlag = document.getElementById('autoAnswerFlag').checked; + autoAnswerFlag = false console.info("incomingSession, answer the call"); incomingSession = data.session; Datas = data.session; @@ -129,9 +130,9 @@ export default class MyWebrtc { incomingNum = incomingNum.substring(incomingNum.indexOf("sip:")+4); incomingNum = incomingNum.substring(0,incomingNum.indexOf("@")); } - + // doEvent("incoming_event",incomingNum,data.request.call_id); globalCallPhoneStates = incomingNum+"来电"; - + if(useVideo){ initVideo(); } @@ -156,7 +157,7 @@ export default class MyWebrtc { 'mediaStream': null }); } - getstatus2.innerText = "通话中"; + // getstatus2.innerText = "通话中"; globalCallPhoneStates = "通话中"; Datas.connection.ontrack = getRemoteStream; @@ -198,15 +199,18 @@ export default class MyWebrtc { }else if(currentSession!=null && currentSession._request.call_id!=null){ call_id = currentSession._request.call_id; } - doEvent("hangup_event",'',call_id); + // doEvent("hangup_event",'',call_id); //Callstate.innerText = "已挂断"; globalCallPhoneStates = "已挂断"; - + youVideo = document.getElementById('youVideo'); + youVideo.style.opacity = '0'; clearVideo(); currentSession = null; }); data.session.on('accepted', function(data) { console.info('onAccepted - ', data); + youVideo = document.getElementById('youVideo'); + youVideo.style.opacity = '1'; var call_id = ""; if(data!=null && data.request!=null && data.request.call_id!=null){ call_id = data.request.call_id; @@ -248,10 +252,10 @@ export default class MyWebrtc { var holdOption = currentSession.isOnHold(); if(holdOption.local){ holdFlag = true; - doEvent("hold_event",'',data.request.call_id); + // doEvent("hold_event",'',data.request.call_id); }else if(holdFlag){; holdFlag = false; - doEvent("unhold_event",'',data.request.call_id); + // doEvent("unhold_event",'',data.request.call_id); } } @@ -332,7 +336,8 @@ export default class MyWebrtc { } // doEvent("hangup_event",'',call_id); // globalCallPhoneStates = "未通话"; - + globalCallPhoneStates = "呼叫失败"; + if(incomingSession!=null){ incomingCallAudio.pause(); incomingSession = null; @@ -344,7 +349,8 @@ export default class MyWebrtc { if(data.session.direction === 'incoming'){ console.log('incoming - ',data.session); - autoAnswerFlag = document.getElementById('autoAnswerFlag').checked; + // autoAnswerFlag = document.getElementById('autoAnswerFlag').checked; + autoAnswerFlag = false if(!autoAnswerFlag){ incomingCallAudio.play(); } @@ -361,7 +367,7 @@ export default class MyWebrtc { // ringbackAudio.play(); console.log('call is in progress'); // getstatus2.innerText = "连接中"; - // globalCallPhoneStates = "连接中"; + globalCallPhoneStates = "连接中"; }, 'failed': function(e) { console.log('call failed: ', e); @@ -369,25 +375,25 @@ export default class MyWebrtc { if(e.cause == "Busy") { console.error("用户正忙"); // getstatus2.innerText = "用户正忙"; - // globalCallPhoneStates = "用户正忙"; + globalCallPhoneStates = "用户正忙"; } else { console.error("拨打失败"); //通话状态 // getstatus2.innerText = "拨打失败"; - // globalCallPhoneStates = "拨打失败"; - + globalCallPhoneStates = "拨打失败"; + } clearVideo(); }, 'ended': function(e) { //隐藏本地视频区域 - //selfViewWap.style.display = "none"; + // selfViewWap.style.display = "none"; console.log('call ended : ', e); //通话状态 - getstatus2.innerText = "已挂断"; + // getstatus2.innerText = "已挂断"; globalCallPhoneStates = "已挂断"; - + clearVideo(); currentSession = null; }, @@ -397,7 +403,6 @@ export default class MyWebrtc { console.log('call confirmed'); } }; - //语音拨打 this.JsSip_VoiceCall = function(callPhone,isVoice) { console.log("isVoice",isVoice); @@ -418,6 +423,7 @@ export default class MyWebrtc { } //接听 this.VoiceAnsWter = function() { + incomingCallAudio.pause(); if(useVideo){ Datas.answer({ @@ -443,6 +449,7 @@ export default class MyWebrtc { //发送DTMF this.VoiceSendDTMF = function(dtmf) { + console.log(dtmf) if(incomingSession!=null){ incomingSession.sendDTMF(dtmf); }else{ @@ -517,39 +524,41 @@ export default class MyWebrtc { function getRemoteStream(e) { ringbackAudio.pause(); console.log('getRemoteStream - ', e.track, e.streams[0]); - //remoteAudio.srcObject = e.streams[0]; - + remoteAudio.srcObject = e.streams[0]; if(useVideo){ console.log(e.streams[0]) - // youVideo.srcObject = e.streams[0]; - // document.body.addEventListener('click', function () { - // meVideo.play(); - // }); + youVideo.srcObject = e.streams[0]; + document.body.addEventListener('click', function () { + meVideo.play(); + }); // 等到视频流准备好了 - // var interval = setInterval(function () { - // if (!meVideo.videoWidth) { - // return; - // } - // //stage.appendChild(videoView); - // clearInterval(interval); - // }, 1000 / 50); + var interval = setInterval(function () { + if (!meVideo.videoWidth) { + return; + } + //stage.appendChild(videoView); + clearInterval(interval); + }, 1000 / 50); }else{ - // remoteAudio.srcObject = e.streams[0]; + remoteAudio.srcObject = e.streams[0]; + } } //初始化视频 function initVideo(){ - // meVideo = document.getElementById('meVideo'); - // meVideo.setAttribute('autoplay', ''); - // meVideo.setAttribute('playsinline', ''); - // meVideo.style.width = '212px'; - // - // youVideo = document.getElementById('youVideo'); - // youVideo.setAttribute('autoplay', ''); - // youVideo.setAttribute('playsinline', ''); - // youVideo.style.width = '531px'; + meVideo = document.getElementById('meVideo'); + meVideo.setAttribute('autoplay', ''); + meVideo.setAttribute('playsinline', ''); + meVideo.style.width = '20vh'; + + youVideo = document.getElementById('youVideo'); + youVideo.setAttribute('autoplay', ''); + youVideo.setAttribute('playsinline', ''); + // youVideo.style.width = '1000px'; + youVideo.style.opacity = '0'; + youVideo.style.height = '80vh'; navigator.mediaDevices.getUserMedia({ audio: false, @@ -558,18 +567,18 @@ export default class MyWebrtc { } }).then(function success(stream) { console.log(stream) - // meVideo.srcObject = stream; - // document.body.addEventListener('click', function () { - // meVideo.play(); - // }); - // // 等到视频流准备好了 - // var interval = setInterval(function () { - // if (!meVideo.videoWidth) { - // return; - // } - // //stage.appendChild(videoView); - // clearInterval(interval); - // }, 1000 / 50); + meVideo.srcObject = stream; + document.body.addEventListener('click', function () { + meVideo.play(); + }); + // 等到视频流准备好了 + var interval = setInterval(function () { + if (!meVideo.videoWidth) { + return; + } + //stage.appendChild(videoView); + clearInterval(interval); + }, 1000 / 50); }).catch(function (error) { alert(error.message); }); @@ -577,6 +586,7 @@ export default class MyWebrtc { //释放视频资源 function clearVideo(){ + return false if(useVideo && meVideo!=null && meVideo.srcObject!=null){ meVideo.pause(); if(meVideo.srcObject.getTracks()[0]!=null){ diff --git a/src/assets/images/hj-1.png b/src/assets/images/hj-1.png new file mode 100644 index 0000000..87e1204 Binary files /dev/null and b/src/assets/images/hj-1.png differ diff --git a/src/assets/static/incoming-call-ringtone.wav b/src/assets/static/incoming-call-ringtone.wav new file mode 100644 index 0000000..601b5f3 Binary files /dev/null and b/src/assets/static/incoming-call-ringtone.wav differ diff --git a/src/assets/static/ringbacktone.wav b/src/assets/static/ringbacktone.wav new file mode 100644 index 0000000..d333a7d Binary files /dev/null and b/src/assets/static/ringbacktone.wav differ diff --git a/src/layout/components/Correspondence/index.vue b/src/layout/components/Correspondence/index.vue index b35646e..eb27e5a 100644 --- a/src/layout/components/Correspondence/index.vue +++ b/src/layout/components/Correspondence/index.vue @@ -43,6 +43,7 @@
+
姓名
部门
@@ -58,7 +59,7 @@
{{ item.phoneNumber }}
- +
@@ -74,14 +75,36 @@
- -
- - - - -
-
+ +
+ +
+ +
+
+ +
{{progressVal=='未通话'?'呼叫中...':progressVal}}
+
+ +
+
+ +
{{progressVal=='未通话'?'呼叫中...':progressVal}}
+
+
+
+ 重拨 + + 接听 + 挂断 + +
+ + + +
@@ -93,8 +116,10 @@ let deptsList = ref([]) let dialogTableVisible = ref(false) let dialogTableVisible2 = ref(false) + let dialogTableVisible3 = ref(false) + let callType = ref(3) let dialogComVideo = ref(false) - const webrtcInstance = new MyWebrtc(); + const webrtcInstance = new MyWebrtc() const getComDepts = async () => { let res = await getComDeptsApi() deptsList.value = res.data @@ -110,18 +135,58 @@ dialogTableVisible2.value = true // location.href="http://192.168.0.2:81/"; } + let progressVal = ref(null) + let timer = ref(null) + watch( + () => dialogTableVisible.value, + (val) => { + // comRegister(); + + + } + ) const doCallTel = (item) => { - webrtcInstance.JsSip_VoiceCall('15123854798',true); - dialogComVideo.value=true; + callType.value = 1 + dialogTableVisible3.value=true; + nextTick(()=>{ + webrtcInstance.JsSip_VoiceCall('15123854798',true); + }) } const doCallVoice = (item) => { - webrtcInstance.JsSip_VoiceCall('854798',false); - dialogComVideo.value=true; + callType.value = 2 + dialogTableVisible3.value=true; + + nextTick(()=>{ + webrtcInstance.JsSip_VoiceCall('854798',false); + }) + } const doCallVideo = (item) => { - webrtcInstance.JsSip_VoiceCall('854798',true); - dialogComVideo.value=true; + callType.value = 3 + dialogTableVisible3.value = true; + nextTick(()=>{ + webrtcInstance.JsSip_VoiceCall('854798',true); + }) } + // 接听 + const ansWerPhone = ()=> { + //调用语音接听方法 + nextTick(()=>{ + webrtcInstance.VoiceAnsWter(); + thState.value = false + }) + } + const huangUp = ()=>{ + // clearInterval(timer.value) + //调用挂断方法 + dialogTableVisible3.value = false; + webrtcInstance.JsSip_hangUpPhone(); + + } + const closeTh = ()=>{ + huangUp() + } + const handleDepsUser = async (id, item) => { gridTitle.value = item.name dialogTableVisible.value = true @@ -129,16 +194,120 @@ gridData.value = res.data } const comRegister = () => { - webrtcInstance.jssipAgent('101','192.168.77.8','7066','Admin246246246',null,null,null); + //初始化 + nextTick(()=>{ + webrtcInstance.jssipAgent('101','192.168.77.8','7066','Admin246246246',null,null,null); + // console.log(webrtcInstance.changeAgent) + webrtcInstance.changeAgent.on('newRTCSession',(res)=>{ + timer.value = setInterval(()=>{ + progressVal.value = webrtcInstance.callPoneState() + // console.log(progressVal.value,'progressVal.value') + if(progressVal.value.includes('来电')){ + dialogTableVisible3.value = true; + thState.value = true + }else if( progressVal.value == '呼叫停止'){ + thState.value = false + // dialogTableVisible3.value = false; + // clearInterval(timer.value) + }else if( progressVal.value == '已挂断'){ + thState.value = false + closeTh() + }else{ + thState.value = false + } + },1000) + }) + + }) } + let thState = ref(false) onMounted(() => { getComDepts() getComRecord() - comRegister(); + comRegister() + return false + timer.value = setInterval(()=>{ + progressVal.value = webrtcInstance.callPoneState() + console.log(progressVal.value,'progressVal.value') + if(progressVal.value.includes('来电')){ + dialogTableVisible3.value = true; + thState.value = true + }else if( progressVal.value == '呼叫停止'){ + thState.value = false + dialogTableVisible3.value = false; + // clearInterval(timer.value) + }else if( progressVal.value == '已挂断'){ + thState.value = false + closeTh() + }else{ + thState.value = false + } + },1000) }) + diff --git a/src/views/collect/index.vue b/src/views/collect/index.vue new file mode 100644 index 0000000..a6f1128 --- /dev/null +++ b/src/views/collect/index.vue @@ -0,0 +1,7 @@ + + + diff --git a/src/views/scenic/components/box-1.vue b/src/views/scenic/components/box-1.vue index 749a6ac..0a42161 100644 --- a/src/views/scenic/components/box-1.vue +++ b/src/views/scenic/components/box-1.vue @@ -1,12 +1,13 @@