Commit 70e16a1d authored by zhanglw's avatar zhanglw

调整

parent 240671f8
This diff is collapsed.
<template>
<!-- 表单渲染 -->
<div ref="dragArea" v-show="visible" class="fixed-View" :class="isMousedown?'grabbing':'grab'">
<div class="fixed-View-subTitle">安全帽SOS请求通话:</div>
<div v-show="status" class="corrugation">
......@@ -75,30 +74,17 @@ export default {
},
mounted() {
this.$nextTick(() => {
// 获取DOM元素
const dragArea = this.$refs.dragArea
// 缓存 clientX clientY 的对象: 用于判断是点击事件还是移动事件
const clientOffset = {}
dragArea.addEventListener('mousedown', (event) => {
this.isMousedown = true
// const offsetX = dragArea.getBoundingClientRect().left // 获取当前的x轴距离
const offsetY = dragArea.getBoundingClientRect().top // 获取当前的y轴距离
// const innerX = event.clientX - offsetX // 获取鼠标在方块内的x轴距
const innerY = event.clientY - offsetY // 获取鼠标在方块内的y轴距
// 缓存 clientX clientY
const offsetY = dragArea.getBoundingClientRect().top
const innerY = event.clientY - offsetY
clientOffset.clientX = event.clientX
clientOffset.clientY = event.clientY
document.onmousemove = (event) => {
// dragArea.style.left = event.clientX - innerX + 'px'
dragArea.style.top = event.clientY - innerY + 'px'
const dragAreaTop = window.innerHeight - dragArea.getBoundingClientRect().height
// const dragAreaLeft = window.innerWidth - dragArea.getBoundingClientRect().width - 160
// if (dragArea.getBoundingClientRect().left <= 0) {
// dragArea.style.left = '0px'
// }
// if (dragArea.getBoundingClientRect().left >= dragAreaLeft) {
// dragArea.style.left = dragAreaLeft + 'px'
// }
if (dragArea.getBoundingClientRect().top <= 100) {
dragArea.style.top = '100px'
}
......@@ -112,16 +98,7 @@ export default {
this.isMousedown = false
}
}, false)
// 绑定鼠标松开事件
dragArea.addEventListener('mouseup', (event) => {
// const clientX = event.clientX
// const clientY = event.clientY
// if (clientX === clientOffset.clientX && clientY === clientOffset.clientY) {
// console.log('click 事件')
// } else {
// console.log('drag 事件')
// }
})
dragArea.addEventListener('mouseup', (event) => {})
})
},
methods: {
......@@ -144,21 +121,17 @@ export default {
let sip_uri_ = `sip:${this.uaSipInfo.adminsip_id}@${this.uaSipInfo.adminwsip_host}`;
let sip_password_ = `${this.uaSipInfo.adminsip_pwd}`;
let ws_uri_ = `${this.uaSipInfo.adminwss_url}`;
console.info("get input info: sip_uri = ", sip_uri_, " sip_password = ", sip_password_, " ws_uri = ", ws_uri_);
let socket = new JsSIP.WebSocketInterface(ws_uri_);
let configuration = {
sockets: [socket],
uri: sip_uri_,
password: sip_password_,
session_timers: false, // 启用会话计时器(根据RFC 4028)
session_timers: false,
user_agent: "Aegis WebRTC v1.0",
contact_uri: sip_uri_,
autostart: true, // 自动连接
register: true, // 自动就绪
};
this.userAgent = new JsSIP.UA(configuration);
this.userAgent.on("connecting", (args) => {
......@@ -191,13 +164,10 @@ export default {
} else {
document.getElementById("localVideo").play();
// 接电话
this.dialogVisible = true;
this.isg = true;
this.callers = session.remote_identity.uri.user;
}
// 接通,在这一步可以处理音频播放
// 接通并不代表对方已经接受,接通代表 滴 滴 滴
session.on("confirmed", () => {
console.info("接通中");
this.message = `已接通,请通话...`;
......@@ -212,8 +182,6 @@ export default {
audioElement.srcObject = stream;
audioElement.play();
});
// 接听失败
session.on("failed", (mdata) => {
const myAuto = document.getElementById("localVideo");
myAuto.pause();
......@@ -221,20 +189,15 @@ export default {
this.message = `来电的时拒接或,未接听对方就挂断...`;
console.info("来电的时候 拒接或者 还没接听对方自己就挂断了");
});
// 接听成功
session.on("accepted", (response, cause) => {
// 嘟嘟嘟
this.message = `接听成功...`;
this.status = 1;
console.info("接听成功");
});
// 接听成功后 挂断
session.on("ended", () => {
this.dialogVisible = false;
this.InCall = false;
});
// 通话被挂起
session.on("hold", (data) => {
const org = data.originator;
if (org === "local") {
......@@ -245,7 +208,6 @@ export default {
console.log("通话被对方挂起:", org);
}
});
// 通话被继续
session.on("unhold", (data) => {
const org = data.originator;
if (org === "local") {
......@@ -256,7 +218,6 @@ export default {
}
});
});
this.userAgent.on('newMessage', (data) => {
if (data.originator == 'local') {
console.info('onNewMessage , OutgoingRequest - ', data.request);
......@@ -264,7 +225,6 @@ export default {
console.info('onNewMessage , IncomingRequest - ', data.request);
}
});
console.info("call register");
this.userAgent.start();
},
......
......@@ -34,9 +34,6 @@ export default {
mounted() {
this.$nextTick(() => {
this.$refs.dialView.init()
// setTimeout(()=>{
// this.$refs.dialView.init('123456')
// },5000)
})
},
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment