Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
libai
/
guodong
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
0a71d2b3
authored
Mar 11, 2021
by
libai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
测试
parent
9fdde34c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
6 deletions
gzh/customer/guodong.html
gzh/customer/index.html
gzh/customer/naicha.html
gzh/customer/guodong.html
View file @
0a71d2b3
...
...
@@ -2,7 +2,7 @@
<html>
<head>
<meta
charset=
"utf-8"
>
<title>
客服聊天
</title>
<title>
</title>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
>
<meta
name=
"format-detection"
content=
"telephone=no"
>
<meta
name=
"apple-mobile-web-app-capable"
content=
"yes"
>
...
...
@@ -520,6 +520,7 @@
}
ws.onopen = function()
{
clearInterval(timmer)
state("连接成功");
system("客服已接入");
if(send){
...
...
@@ -537,16 +538,31 @@
};
ws.onclose = function(event)
{
var recNum=0
var timmer=null
state("连接断开");
$("#guestid").val('
'
);
tips
(
"连接已断开"
,
"error"
,
3000
);
timmer
=
setinterval
(
function
(){
connect
(
false
);
recNum
++
if
(
recNum
>=
5
)
clearInterval
(
timmer
)
},
1000
);
console
.
error
(
"WebSocket close observed:"
,
event
);
};
ws
.
onerror
=
function
(
event
)
{
// 关闭 websocket
var
recNum
=
0
var
timmer
=
null
state
(
"连接错误"
);
msgbulid
(
1
,
"会话意外断开,发送消息即可联系客服"
,
"系统"
,
1
);
timmer
=
setinterval
(
function
(){
connect
(
false
);
recNum
++
if
(
recNum
>=
5
)
clearInterval
(
timmer
)
},
1000
);
console
.
error
(
"WebSocket error observed:"
,
event
);
};
}
else
{
...
...
gzh/customer/index.html
View file @
0a71d2b3
...
...
@@ -2,7 +2,7 @@
<html>
<head>
<meta
charset=
"utf-8"
>
<title>
客服聊天
</title>
<title>
</title>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
>
<meta
name=
"format-detection"
content=
"telephone=no"
>
<meta
name=
"apple-mobile-web-app-capable"
content=
"yes"
>
...
...
@@ -281,6 +281,8 @@
var
checkTimer
;
var
sendtime
=
0
;
var
map
=
new
Map
();
var
timmer
=
null
;
var
recOk
=
true
;
$
(
function
(){
btninit
();
params
();
...
...
@@ -328,9 +330,9 @@
return
;
}
if
(
content
.
length
>
120
){
tips
(
"内容超过最大限制"
,
"warn"
,
5000
);
return
;
}
tips
(
"内容
2
超过最大限制"
,
"warn"
,
5000
);
return
;
2
}
2
var
guestid
=
$
(
"#guestid"
).
val
();
if
(
null
==
guestid
||
guestid
==
''
){
//连接客服
...
...
@@ -423,7 +425,7 @@
var
chat
=
$
(
"#cs-chat"
);
chat
.
append
(
sysmsg
);
var
offset
=
chat
[
0
].
scrollHeight
-
chat
[
0
].
clientHeight
;
if
(
offset
-
chat
[
0
].
scrollTop
<
(
chat
[
0
].
clientHeight
/
2
)){
if
(
offset
-
chat
[
0
].
scrollTop
<
(
500
)){
chat
.
animate
({
scrollTop
:
chat
.
scrollHeight
},
500
);
}
else
{
tips
(
"有新的系统消息"
,
"normal"
,
3000
);
...
...
@@ -502,6 +504,7 @@
}
function WebSocketStart(guestid,send) {
state("连接中");
if(ws!=null&&ws.readyState == WebSocket.OPEN){
...
...
@@ -520,6 +523,7 @@
}
ws.onopen = function()
{
clearInterval(timmer)
state("连接成功");
system("客服已接入");
if(send){
...
...
@@ -537,14 +541,34 @@
};
ws.onclose = function(event)
{
if(recOk){
var recNum=0
timmer=setInterval(function(){
WebSocketStart(guestid,false)
recNum++
if(recNum>=5)clearInterval(timmer)
}, 1000);
}
state("连接断开");
$("#guestid").val('
'
);
tips
(
"连接已断开"
,
"error"
,
3000
);
console
.
error
(
"WebSocket close observed:"
,
event
);
};
ws
.
onerror
=
function
(
event
)
{
// 关闭 websocket
if
(
recOk
){
var
recNum
=
0
timmer
=
setInterval
(
function
(){
WebSocketStart
(
guestid
,
false
)
recNum
++
if
(
recNum
>=
5
)
clearInterval
(
timmer
)
},
1000
);
}
state
(
"连接错误"
);
msgbulid
(
1
,
"会话意外断开,发送消息即可联系客服"
,
"系统"
,
1
);
console
.
error
(
"WebSocket error observed:"
,
event
);
...
...
@@ -571,6 +595,7 @@
msgbulid
(
1
,
"因您长时间未回复,本次会话已经中止,如果还有问题需要咨询,请直接发送消息"
,
"系统"
,
1
);
checkTimer
=
null
;
sendtime
=-
1
;
recOk
=
false
$
(
"#guestid"
).
val
(
''
);
ws
.
close
();
}
...
...
gzh/customer/naicha.html
View file @
0a71d2b3
...
...
@@ -521,6 +521,7 @@
}
ws.onopen = function()
{
clearInterval(timmer)
state("连接成功");
system("客服已接入");
if(send){
...
...
@@ -538,16 +539,31 @@
};
ws.onclose = function(event)
{
var recNum=0
var timmer=null
state("连接断开");
$("#guestid").val('
'
);
tips
(
"连接已断开"
,
"error"
,
3000
);
timmer
=
setinterval
(
function
(){
connect
(
false
);
recNum
++
if
(
recNum
>=
5
)
clearInterval
(
timmer
)
},
1000
);
console
.
error
(
"WebSocket close observed:"
,
event
);
};
ws
.
onerror
=
function
(
event
)
{
// 关闭 websocket
var
recNum
=
0
var
timmer
=
null
state
(
"连接错误"
);
msgbulid
(
1
,
"会话意外断开,发送消息即可联系客服"
,
"系统"
,
1
);
timmer
=
setinterval
(
function
(){
connect
(
false
);
recNum
++
if
(
recNum
>=
5
)
clearInterval
(
timmer
)
},
1000
);
console
.
error
(
"WebSocket error observed:"
,
event
);
};
}
else
{
...
...
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