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
75425bcc
authored
Aug 23, 2019
by
施宇
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
111
parent
a0757557
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
68 deletions
dist/js/chat/index.js
dist/js/chat/index.js
View file @
75425bcc
...
...
@@ -147,7 +147,7 @@ $(function () {
if
(
userLen
)
{
//用户存在
return
;
}
else
{
//用户不存在
var
lefthtml
=
'<div class="notice_classify" userid="'
+
id
+
'" firstClick="true" touserid="'
+
touserid
+
'"name="'
+
name
+
'" img="'
+
img1
+
'">'
+
this
.
userHtml
(
0
,
{
var
lefthtml
=
'<div class="notice_classify" userid="'
+
id
+
'" firstClick="true" touserid="'
+
touserid
+
'"name="'
+
name
+
'" img="'
+
img1
+
'"
status="'
+
(
obj
.
status
||
0
)
+
'"
>'
+
this
.
userHtml
(
0
,
{
name
:
name
,
id
:
id
,
img
:
img
...
...
@@ -636,7 +636,24 @@ $(function () {
this
.
deleteCookie
();
}
},
scrollToTop
:
function
(
userId
)
{
var
imgLen
=
$
(
'#'
+
userId
).
find
(
'img'
).
length
;
if
(
!
imgLen
)
{
setTimeout
(
function
()
{
var
contentHeight
=
$
(
'#'
+
userId
).
find
(
'.notice_item_content'
)
.
height
();
$
(
'#'
+
userId
).
find
(
'.notice_list'
).
scrollTop
(
contentHeight
);
},
200
)
}
else
{
$
(
'#'
+
userId
).
find
(
'img:last'
).
load
(
function
()
{
setTimeout
(
function
()
{
var
contentHeight
=
$
(
'#'
+
userId
).
find
(
'.notice_item_content'
)
.
height
();
$
(
'#'
+
userId
).
find
(
'.notice_list'
).
scrollTop
(
contentHeight
);
},
200
)
})
}
},
sendPrivateText
:
function
(
content
)
{
var
self
=
this
;
// 私聊发送文本消息,发送表情同发送文本消息,只是会在对方客户端将表情文本进行解析成图片;
...
...
@@ -644,6 +661,7 @@ $(function () {
var
touserid
=
$
(
'.notice_left '
).
find
(
'.active'
).
attr
(
'touserid'
);
var
name
=
$
(
'.notice_left '
).
find
(
'.active'
).
attr
(
'name'
);
var
img
=
$
(
'.notice_left '
).
find
(
'.active'
).
attr
(
'img'
);
var
status
=
$
(
'.notice_left '
).
find
(
'.active'
).
attr
(
'status'
);
//0表示客服,1表示正常 ,2不是拉黑
var
id
=
this
.
conn
.
getUniqueId
();
var
msg
=
new
WebIM
.
default
.
message
(
'txt'
,
id
);
var
emojiMessage
=
WebIM
.
default
.
utils
.
parseEmoji
(
content
);
//表情解析工具
...
...
@@ -656,6 +674,10 @@ $(function () {
name1
:
name
,
img1
:
img
};
if
(
status
==
2
)
{
layer
.
msg
(
'该用户已被拉黑'
);
return
;
}
msg
.
set
({
msg
:
content
,
// 消息内容;
to
:
userId
,
// 接收消息对象;
...
...
@@ -667,23 +689,7 @@ $(function () {
img
:
self
.
customerNum
==
self
.
defaultName
?
dist
+
"/images/timg.jpg"
:
self
.
img
,
id
:
self
.
id
},
false
));
var
imgLen
=
$
(
'#'
+
userId
).
find
(
'img'
).
length
;
if
(
!
imgLen
)
{
setTimeout
(
function
()
{
var
contentHeight
=
$
(
'#'
+
userId
).
find
(
'.notice_item_content'
)
.
height
();
$
(
'#'
+
userId
).
find
(
'.notice_list'
).
scrollTop
(
contentHeight
);
},
200
)
}
else
{
$
(
'#'
+
userId
).
find
(
'img:last'
).
load
(
function
()
{
setTimeout
(
function
()
{
var
contentHeight
=
$
(
'#'
+
userId
).
find
(
'.notice_item_content'
)
.
height
();
$
(
'#'
+
userId
).
find
(
'.notice_list'
).
scrollTop
(
contentHeight
);
},
200
)
})
}
self
.
scrollToTop
(
userId
)
$
(
'#chat_textarea'
).
val
(
''
);
},
...
...
@@ -701,6 +707,7 @@ $(function () {
var
touserid
=
$
(
'.notice_left '
).
find
(
'.active'
).
attr
(
'touserid'
);
var
name
=
$
(
'.notice_left '
).
find
(
'.active'
).
attr
(
'name'
);
var
img
=
$
(
'.notice_left '
).
find
(
'.active'
).
attr
(
'img'
);
var
status
=
$
(
'.notice_left '
).
find
(
'.active'
).
attr
(
'status'
);
//0表示客服,1表示正常 ,2不是拉黑
var
id
=
this
.
conn
.
getUniqueId
();
var
msg
=
new
WebIM
.
default
.
message
(
'cmd'
,
id
);
var
params
=
$
.
extend
({},
templateObj
,
{
...
...
@@ -712,6 +719,11 @@ $(function () {
name1
:
name
,
img1
:
img
});
if
(
status
==
2
)
{
layer
.
msg
(
'该用户已被拉黑'
);
self
.
scrollToTop
(
userId
)
return
;
}
msg
.
set
({
msg
:
'template'
,
to
:
userId
,
...
...
@@ -720,26 +732,12 @@ $(function () {
success
:
function
()
{
var
index
=
self
.
chatList
.
indexOf
(
userId
);
if
(
index
==
-
1
)
{
self
.
addChatMember
(
templateObj
.
targetId
);
self
.
addChatMember
(
templateObj
.
targetId
);
}
$
(
'#'
+
userId
).
find
(
'.notice_item_content'
).
append
(
self
.
messageHtml
(
1
,
params
,
true
));
var
imgLen
=
$
(
'#'
+
userId
).
find
(
'img'
).
length
;
if
(
!
imgLen
)
{
setTimeout
(
function
()
{
var
contentHeight
=
$
(
'#'
+
userId
).
find
(
'.notice_item_content'
)
.
height
();
$
(
'#'
+
userId
).
find
(
'.notice_list'
).
scrollTop
(
contentHeight
);
},
200
)
}
else
{
$
(
'#'
+
userId
).
find
(
'img:last'
).
load
(
function
()
{
setTimeout
(
function
()
{
var
contentHeight
=
$
(
'#'
+
userId
).
find
(
'.notice_item_content'
)
.
height
();
$
(
'#'
+
userId
).
find
(
'.notice_list'
).
scrollTop
(
contentHeight
);
},
200
)
})
}
self
.
scrollToTop
(
userId
)
},
fail
:
function
()
{
...
...
@@ -761,6 +759,11 @@ $(function () {
var
touserid
=
$
(
'.notice_left '
).
find
(
'.active'
).
attr
(
'touserid'
);
var
name
=
$
(
'.notice_left '
).
find
(
'.active'
).
attr
(
'name'
);
var
img
=
$
(
'.notice_left '
).
find
(
'.active'
).
attr
(
'img'
);
var
status
=
$
(
'.notice_left '
).
find
(
'.active'
).
attr
(
'status'
);
//0表示客服,1表示正常 ,2不是拉黑
if
(
status
==
2
)
{
layer
.
msg
(
'该用户已被拉黑'
);
return
;
}
var
option
=
{
apiUrl
:
WebIM
.
config
.
apiURL
,
file
:
file
,
...
...
@@ -789,22 +792,7 @@ $(function () {
img
:
self
.
customerNum
==
self
.
defaultName
?
dist
+
"/images/timg.jpg"
:
self
.
img
,
id
:
self
.
id
},
false
));
var
imgLen
=
$
(
'#'
+
userId
).
find
(
'img'
).
length
;
if
(
!
imgLen
)
{
setTimeout
(
function
()
{
var
contentHeight
=
$
(
'#'
+
userId
).
find
(
'.notice_item_content'
)
.
height
();
$
(
'#'
+
userId
).
find
(
'.notice_list'
).
scrollTop
(
contentHeight
);
},
200
)
}
else
{
$
(
'#'
+
userId
).
find
(
'img:last'
).
load
(
function
()
{
setTimeout
(
function
()
{
var
contentHeight
=
$
(
'#'
+
userId
).
find
(
'.notice_item_content'
)
.
height
();
$
(
'#'
+
userId
).
find
(
'.notice_list'
).
scrollTop
(
contentHeight
);
},
200
)
})
}
self
.
scrollToTop
(
userId
)
$
(
'#img_upload'
).
val
(
''
);
},
fail
:
function
()
{
...
...
@@ -1001,22 +989,7 @@ $(function () {
}
$
(
'#'
+
id
).
find
(
'.notice_item_content'
).
prepend
(
chatCon
);
if
(
!
isTemplate
)
{
var
imgLen
=
$
(
'#'
+
id
).
find
(
'img'
).
length
;
if
(
!
imgLen
)
{
setTimeout
(
function
()
{
var
contentHeight
=
$
(
'#'
+
id
).
find
(
'.notice_item_content'
)
.
height
();
$
(
'#'
+
id
).
find
(
'.notice_list'
).
scrollTop
(
contentHeight
);
},
200
)
}
else
{
$
(
'#'
+
id
).
find
(
'img:last'
).
load
(
function
()
{
setTimeout
(
function
()
{
var
contentHeight
=
$
(
'#'
+
id
).
find
(
'.notice_item_content'
)
.
height
();
$
(
'#'
+
id
).
find
(
'.notice_list'
).
scrollTop
(
contentHeight
);
},
200
)
})
}
this
.
scrollToTop
(
id
);
}
...
...
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