Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
施宇
/
icsales
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
1c3f4f35
authored
Jul 18, 2019
by
施宇
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
1
parent
8341f47b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
10 deletions
dist/js/chat/index.js
dist/js/chat/index.js
View file @
1c3f4f35
...
...
@@ -62,10 +62,11 @@ $(function () {
if
(
JSON
.
stringify
(
this
.
templateObj
)
==
'{}'
)
{
$
(
".notice_classify[userid="
+
this
.
defaultName
+
"]"
).
click
();
}
else
{
Util
.
delCookie
(
'template'
,
cookieHostname
);
this
.
addUser
(
this
.
templateObj
.
userId
);
$
(
".notice_classify[userid="
+
this
.
templateObj
.
userId
+
"]"
).
attr
(
'isTemplate'
,
true
);
//先获取历史纪录再发送模板,否则可能出现发送的消息显示两条
$
(
".notice_classify[userid="
+
this
.
templateObj
.
userId
+
"]"
).
click
();
this
.
sendCmd
(
this
.
templateObj
);
Util
.
delCookie
(
'template'
,
cookieHostname
);
}
},
...
...
@@ -374,6 +375,7 @@ $(function () {
},
//收到表情消息;
onCmdMessage
:
function
(
message
)
{
self
.
receiveData
(
1
,
message
,
true
);
self
.
addChatMember
(
message
.
from
)
},
//收到命令消息;
...
...
@@ -467,7 +469,7 @@ $(function () {
action
:
"template"
,
ext
:
params
,
success
:
function
()
{
self
.
addChatMember
(
userId
)
self
.
addChatMember
(
userId
)
;
$
(
'#'
+
userId
).
find
(
'.notice_item_content'
).
append
(
self
.
messageHtml
(
1
,
params
,
true
));
var
contentHeight
=
$
(
'#'
+
userId
).
find
(
'.notice_item_content'
)
...
...
@@ -560,13 +562,15 @@ $(function () {
})
$
(
'.notice_left'
).
on
(
'click'
,
'.notice_classify'
,
function
()
{
var
id
=
$
(
this
).
attr
(
'userid'
);
var
isTemplate
=
$
(
this
).
attr
(
'isTemplate'
);
$
(
'#'
+
id
).
addClass
(
'active'
).
siblings
(
'.chat_item'
).
removeClass
(
'active'
);
$
(
this
).
find
(
'.num'
).
remove
();
$
(
this
).
addClass
(
'active'
).
siblings
(
'.notice_classify'
).
removeClass
(
'active'
);
var
contentHeight
=
$
(
'#'
+
id
).
find
(
'.notice_item_content'
).
height
();
$
(
'#'
+
id
).
find
(
'.notice_list'
).
scrollTop
(
contentHeight
);
if
(
isTemplate
){
$
(
this
).
removeAttr
(
'isTemplate'
);
}
if
(
self
.
isLoginSuccess
)
{
//登入成功 获取聊天记录
self
.
getHistoryData
(
id
)
self
.
getHistoryData
(
id
,
isTemplate
)
}
else
{
layer
.
msg
(
'获取聊天记录失败'
);
return
;
...
...
@@ -577,15 +581,17 @@ $(function () {
})
},
getHistoryData
:
function
(
id
)
{
getHistoryData
:
function
(
id
,
isTemplate
)
{
var
self
=
this
;
this
.
conn
.
fetchHistoryMessages
({
queue
:
id
,
count
:
"
5
0"
,
count
:
"
10
0"
,
success
:
function
(
data
)
{
console
.
log
(
data
)
console
.
log
(
'xixixi'
)
self
.
rendHistoryMessage
(
id
,
data
)
if
(
isTemplate
){
self
.
sendCmd
(
self
.
templateObj
);
}
},
fail
:
function
(
e
)
{
console
.
log
(
e
)
...
...
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