Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
K
kd_control
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhanglw
kd_control
Commits
70e16a1d
Commit
70e16a1d
authored
Sep 27, 2023
by
zhanglw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整
parent
240671f8
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
529 additions
and
47 deletions
+529
-47
dialView.vue
src/components/DialView/dialView.vue
+525
-0
index.vue
src/components/DialView/index.vue
+4
-44
AppMain.vue
src/layout/components/AppMain.vue
+0
-3
No files found.
src/components/DialView/dialView.vue
0 → 100644
View file @
70e16a1d
This diff is collapsed.
Click to expand it.
src/components/DialView/index.vue
View file @
70e16a1d
<
template
>
<
template
>
<!-- 表单渲染 -->
<div
ref=
"dragArea"
v-show=
"visible"
class=
"fixed-View"
:class=
"isMousedown?'grabbing':'grab'"
>
<div
ref=
"dragArea"
v-show=
"visible"
class=
"fixed-View"
:class=
"isMousedown?'grabbing':'grab'"
>
<div
class=
"fixed-View-subTitle"
>
安全帽SOS请求通话:
</div>
<div
class=
"fixed-View-subTitle"
>
安全帽SOS请求通话:
</div>
<div
v-show=
"status"
class=
"corrugation"
>
<div
v-show=
"status"
class=
"corrugation"
>
...
@@ -75,30 +74,17 @@ export default {
...
@@ -75,30 +74,17 @@ export default {
},
},
mounted
()
{
mounted
()
{
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
// 获取DOM元素
const
dragArea
=
this
.
$refs
.
dragArea
const
dragArea
=
this
.
$refs
.
dragArea
// 缓存 clientX clientY 的对象: 用于判断是点击事件还是移动事件
const
clientOffset
=
{}
const
clientOffset
=
{}
dragArea
.
addEventListener
(
'
mousedown
'
,
(
event
)
=>
{
dragArea
.
addEventListener
(
'
mousedown
'
,
(
event
)
=>
{
this
.
isMousedown
=
true
this
.
isMousedown
=
true
// const offsetX = dragArea.getBoundingClientRect().left // 获取当前的x轴距离
const
offsetY
=
dragArea
.
getBoundingClientRect
().
top
const
offsetY
=
dragArea
.
getBoundingClientRect
().
top
// 获取当前的y轴距离
const
innerY
=
event
.
clientY
-
offsetY
// const innerX = event.clientX - offsetX // 获取鼠标在方块内的x轴距
const
innerY
=
event
.
clientY
-
offsetY
// 获取鼠标在方块内的y轴距
// 缓存 clientX clientY
clientOffset
.
clientX
=
event
.
clientX
clientOffset
.
clientX
=
event
.
clientX
clientOffset
.
clientY
=
event
.
clientY
clientOffset
.
clientY
=
event
.
clientY
document
.
onmousemove
=
(
event
)
=>
{
document
.
onmousemove
=
(
event
)
=>
{
// dragArea.style.left = event.clientX - innerX + 'px'
dragArea
.
style
.
top
=
event
.
clientY
-
innerY
+
'
px
'
dragArea
.
style
.
top
=
event
.
clientY
-
innerY
+
'
px
'
const
dragAreaTop
=
window
.
innerHeight
-
dragArea
.
getBoundingClientRect
().
height
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
)
{
if
(
dragArea
.
getBoundingClientRect
().
top
<=
100
)
{
dragArea
.
style
.
top
=
'
100px
'
dragArea
.
style
.
top
=
'
100px
'
}
}
...
@@ -112,16 +98,7 @@ export default {
...
@@ -112,16 +98,7 @@ export default {
this
.
isMousedown
=
false
this
.
isMousedown
=
false
}
}
},
false
)
},
false
)
// 绑定鼠标松开事件
dragArea
.
addEventListener
(
'
mouseup
'
,
(
event
)
=>
{})
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 事件')
// }
})
})
})
},
},
methods
:
{
methods
:
{
...
@@ -144,21 +121,17 @@ export default {
...
@@ -144,21 +121,17 @@ export default {
let
sip_uri_
=
`sip:
${
this
.
uaSipInfo
.
adminsip_id
}
@
${
this
.
uaSipInfo
.
adminwsip_host
}
`
;
let
sip_uri_
=
`sip:
${
this
.
uaSipInfo
.
adminsip_id
}
@
${
this
.
uaSipInfo
.
adminwsip_host
}
`
;
let
sip_password_
=
`
${
this
.
uaSipInfo
.
adminsip_pwd
}
`
;
let
sip_password_
=
`
${
this
.
uaSipInfo
.
adminsip_pwd
}
`
;
let
ws_uri_
=
`
${
this
.
uaSipInfo
.
adminwss_url
}
`
;
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
socket
=
new
JsSIP
.
WebSocketInterface
(
ws_uri_
);
let
configuration
=
{
let
configuration
=
{
sockets
:
[
socket
],
sockets
:
[
socket
],
uri
:
sip_uri_
,
uri
:
sip_uri_
,
password
:
sip_password_
,
password
:
sip_password_
,
session_timers
:
false
,
// 启用会话计时器(根据RFC 4028)
session_timers
:
false
,
user_agent
:
"
Aegis WebRTC v1.0
"
,
user_agent
:
"
Aegis WebRTC v1.0
"
,
contact_uri
:
sip_uri_
,
contact_uri
:
sip_uri_
,
autostart
:
true
,
// 自动连接
autostart
:
true
,
// 自动连接
register
:
true
,
// 自动就绪
register
:
true
,
// 自动就绪
};
};
this
.
userAgent
=
new
JsSIP
.
UA
(
configuration
);
this
.
userAgent
=
new
JsSIP
.
UA
(
configuration
);
this
.
userAgent
.
on
(
"
connecting
"
,
(
args
)
=>
{
this
.
userAgent
.
on
(
"
connecting
"
,
(
args
)
=>
{
...
@@ -191,13 +164,10 @@ export default {
...
@@ -191,13 +164,10 @@ export default {
}
else
{
}
else
{
document
.
getElementById
(
"
localVideo
"
).
play
();
document
.
getElementById
(
"
localVideo
"
).
play
();
// 接电话
this
.
dialogVisible
=
true
;
this
.
dialogVisible
=
true
;
this
.
isg
=
true
;
this
.
isg
=
true
;
this
.
callers
=
session
.
remote_identity
.
uri
.
user
;
this
.
callers
=
session
.
remote_identity
.
uri
.
user
;
}
}
// 接通,在这一步可以处理音频播放
// 接通并不代表对方已经接受,接通代表 滴 滴 滴
session
.
on
(
"
confirmed
"
,
()
=>
{
session
.
on
(
"
confirmed
"
,
()
=>
{
console
.
info
(
"
接通中
"
);
console
.
info
(
"
接通中
"
);
this
.
message
=
`已接通,请通话...`
;
this
.
message
=
`已接通,请通话...`
;
...
@@ -212,8 +182,6 @@ export default {
...
@@ -212,8 +182,6 @@ export default {
audioElement
.
srcObject
=
stream
;
audioElement
.
srcObject
=
stream
;
audioElement
.
play
();
audioElement
.
play
();
});
});
// 接听失败
session
.
on
(
"
failed
"
,
(
mdata
)
=>
{
session
.
on
(
"
failed
"
,
(
mdata
)
=>
{
const
myAuto
=
document
.
getElementById
(
"
localVideo
"
);
const
myAuto
=
document
.
getElementById
(
"
localVideo
"
);
myAuto
.
pause
();
myAuto
.
pause
();
...
@@ -221,20 +189,15 @@ export default {
...
@@ -221,20 +189,15 @@ export default {
this
.
message
=
`来电的时拒接或,未接听对方就挂断...`
;
this
.
message
=
`来电的时拒接或,未接听对方就挂断...`
;
console
.
info
(
"
来电的时候 拒接或者 还没接听对方自己就挂断了
"
);
console
.
info
(
"
来电的时候 拒接或者 还没接听对方自己就挂断了
"
);
});
});
// 接听成功
session
.
on
(
"
accepted
"
,
(
response
,
cause
)
=>
{
session
.
on
(
"
accepted
"
,
(
response
,
cause
)
=>
{
// 嘟嘟嘟
this
.
message
=
`接听成功...`
;
this
.
message
=
`接听成功...`
;
this
.
status
=
1
;
this
.
status
=
1
;
console
.
info
(
"
接听成功
"
);
console
.
info
(
"
接听成功
"
);
});
});
// 接听成功后 挂断
session
.
on
(
"
ended
"
,
()
=>
{
session
.
on
(
"
ended
"
,
()
=>
{
this
.
dialogVisible
=
false
;
this
.
dialogVisible
=
false
;
this
.
InCall
=
false
;
this
.
InCall
=
false
;
});
});
// 通话被挂起
session
.
on
(
"
hold
"
,
(
data
)
=>
{
session
.
on
(
"
hold
"
,
(
data
)
=>
{
const
org
=
data
.
originator
;
const
org
=
data
.
originator
;
if
(
org
===
"
local
"
)
{
if
(
org
===
"
local
"
)
{
...
@@ -245,7 +208,6 @@ export default {
...
@@ -245,7 +208,6 @@ export default {
console
.
log
(
"
通话被对方挂起:
"
,
org
);
console
.
log
(
"
通话被对方挂起:
"
,
org
);
}
}
});
});
// 通话被继续
session
.
on
(
"
unhold
"
,
(
data
)
=>
{
session
.
on
(
"
unhold
"
,
(
data
)
=>
{
const
org
=
data
.
originator
;
const
org
=
data
.
originator
;
if
(
org
===
"
local
"
)
{
if
(
org
===
"
local
"
)
{
...
@@ -256,7 +218,6 @@ export default {
...
@@ -256,7 +218,6 @@ export default {
}
}
});
});
});
});
this
.
userAgent
.
on
(
'
newMessage
'
,
(
data
)
=>
{
this
.
userAgent
.
on
(
'
newMessage
'
,
(
data
)
=>
{
if
(
data
.
originator
==
'
local
'
)
{
if
(
data
.
originator
==
'
local
'
)
{
console
.
info
(
'
onNewMessage , OutgoingRequest -
'
,
data
.
request
);
console
.
info
(
'
onNewMessage , OutgoingRequest -
'
,
data
.
request
);
...
@@ -264,7 +225,6 @@ export default {
...
@@ -264,7 +225,6 @@ export default {
console
.
info
(
'
onNewMessage , IncomingRequest -
'
,
data
.
request
);
console
.
info
(
'
onNewMessage , IncomingRequest -
'
,
data
.
request
);
}
}
});
});
console
.
info
(
"
call register
"
);
console
.
info
(
"
call register
"
);
this
.
userAgent
.
start
();
this
.
userAgent
.
start
();
},
},
...
...
src/layout/components/AppMain.vue
View file @
70e16a1d
...
@@ -34,9 +34,6 @@ export default {
...
@@ -34,9 +34,6 @@ export default {
mounted
()
{
mounted
()
{
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
this
.
$refs
.
dialView
.
init
()
this
.
$refs
.
dialView
.
init
()
// setTimeout(()=>{
// this.$refs.dialView.init('123456')
// },5000)
})
})
},
},
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment