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 () {
...
@@ -147,7 +147,7 @@ $(function () {
if
(
userLen
)
{
//用户存在
if
(
userLen
)
{
//用户存在
return
;
return
;
}
else
{
//用户不存在
}
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
,
name
:
name
,
id
:
id
,
id
:
id
,
img
:
img
img
:
img
...
@@ -636,7 +636,24 @@ $(function () {
...
@@ -636,7 +636,24 @@ $(function () {
this
.
deleteCookie
();
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
)
{
sendPrivateText
:
function
(
content
)
{
var
self
=
this
;
var
self
=
this
;
// 私聊发送文本消息,发送表情同发送文本消息,只是会在对方客户端将表情文本进行解析成图片;
// 私聊发送文本消息,发送表情同发送文本消息,只是会在对方客户端将表情文本进行解析成图片;
...
@@ -644,6 +661,7 @@ $(function () {
...
@@ -644,6 +661,7 @@ $(function () {
var
touserid
=
$
(
'.notice_left '
).
find
(
'.active'
).
attr
(
'touserid'
);
var
touserid
=
$
(
'.notice_left '
).
find
(
'.active'
).
attr
(
'touserid'
);
var
name
=
$
(
'.notice_left '
).
find
(
'.active'
).
attr
(
'name'
);
var
name
=
$
(
'.notice_left '
).
find
(
'.active'
).
attr
(
'name'
);
var
img
=
$
(
'.notice_left '
).
find
(
'.active'
).
attr
(
'img'
);
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
id
=
this
.
conn
.
getUniqueId
();
var
msg
=
new
WebIM
.
default
.
message
(
'txt'
,
id
);
var
msg
=
new
WebIM
.
default
.
message
(
'txt'
,
id
);
var
emojiMessage
=
WebIM
.
default
.
utils
.
parseEmoji
(
content
);
//表情解析工具
var
emojiMessage
=
WebIM
.
default
.
utils
.
parseEmoji
(
content
);
//表情解析工具
...
@@ -656,6 +674,10 @@ $(function () {
...
@@ -656,6 +674,10 @@ $(function () {
name1
:
name
,
name1
:
name
,
img1
:
img
img1
:
img
};
};
if
(
status
==
2
)
{
layer
.
msg
(
'该用户已被拉黑'
);
return
;
}
msg
.
set
({
msg
.
set
({
msg
:
content
,
// 消息内容;
msg
:
content
,
// 消息内容;
to
:
userId
,
// 接收消息对象;
to
:
userId
,
// 接收消息对象;
...
@@ -667,23 +689,7 @@ $(function () {
...
@@ -667,23 +689,7 @@ $(function () {
img
:
self
.
customerNum
==
self
.
defaultName
?
dist
+
"/images/timg.jpg"
:
self
.
img
,
img
:
self
.
customerNum
==
self
.
defaultName
?
dist
+
"/images/timg.jpg"
:
self
.
img
,
id
:
self
.
id
id
:
self
.
id
},
false
));
},
false
));
self
.
scrollToTop
(
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
)
})
}
$
(
'#chat_textarea'
).
val
(
''
);
$
(
'#chat_textarea'
).
val
(
''
);
},
},
...
@@ -701,6 +707,7 @@ $(function () {
...
@@ -701,6 +707,7 @@ $(function () {
var
touserid
=
$
(
'.notice_left '
).
find
(
'.active'
).
attr
(
'touserid'
);
var
touserid
=
$
(
'.notice_left '
).
find
(
'.active'
).
attr
(
'touserid'
);
var
name
=
$
(
'.notice_left '
).
find
(
'.active'
).
attr
(
'name'
);
var
name
=
$
(
'.notice_left '
).
find
(
'.active'
).
attr
(
'name'
);
var
img
=
$
(
'.notice_left '
).
find
(
'.active'
).
attr
(
'img'
);
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
id
=
this
.
conn
.
getUniqueId
();
var
msg
=
new
WebIM
.
default
.
message
(
'cmd'
,
id
);
var
msg
=
new
WebIM
.
default
.
message
(
'cmd'
,
id
);
var
params
=
$
.
extend
({},
templateObj
,
{
var
params
=
$
.
extend
({},
templateObj
,
{
...
@@ -712,6 +719,11 @@ $(function () {
...
@@ -712,6 +719,11 @@ $(function () {
name1
:
name
,
name1
:
name
,
img1
:
img
img1
:
img
});
});
if
(
status
==
2
)
{
layer
.
msg
(
'该用户已被拉黑'
);
self
.
scrollToTop
(
userId
)
return
;
}
msg
.
set
({
msg
.
set
({
msg
:
'template'
,
msg
:
'template'
,
to
:
userId
,
to
:
userId
,
...
@@ -720,26 +732,12 @@ $(function () {
...
@@ -720,26 +732,12 @@ $(function () {
success
:
function
()
{
success
:
function
()
{
var
index
=
self
.
chatList
.
indexOf
(
userId
);
var
index
=
self
.
chatList
.
indexOf
(
userId
);
if
(
index
==
-
1
)
{
if
(
index
==
-
1
)
{
self
.
addChatMember
(
templateObj
.
targetId
);
self
.
addChatMember
(
templateObj
.
targetId
);
}
}
$
(
'#'
+
userId
).
find
(
'.notice_item_content'
).
append
(
self
.
messageHtml
(
1
,
$
(
'#'
+
userId
).
find
(
'.notice_item_content'
).
append
(
self
.
messageHtml
(
1
,
params
,
true
));
params
,
true
));
var
imgLen
=
$
(
'#'
+
userId
).
find
(
'img'
).
length
;
self
.
scrollToTop
(
userId
)
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
)
})
}
},
},
fail
:
function
()
{
fail
:
function
()
{
...
@@ -761,6 +759,11 @@ $(function () {
...
@@ -761,6 +759,11 @@ $(function () {
var
touserid
=
$
(
'.notice_left '
).
find
(
'.active'
).
attr
(
'touserid'
);
var
touserid
=
$
(
'.notice_left '
).
find
(
'.active'
).
attr
(
'touserid'
);
var
name
=
$
(
'.notice_left '
).
find
(
'.active'
).
attr
(
'name'
);
var
name
=
$
(
'.notice_left '
).
find
(
'.active'
).
attr
(
'name'
);
var
img
=
$
(
'.notice_left '
).
find
(
'.active'
).
attr
(
'img'
);
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
=
{
var
option
=
{
apiUrl
:
WebIM
.
config
.
apiURL
,
apiUrl
:
WebIM
.
config
.
apiURL
,
file
:
file
,
file
:
file
,
...
@@ -789,22 +792,7 @@ $(function () {
...
@@ -789,22 +792,7 @@ $(function () {
img
:
self
.
customerNum
==
self
.
defaultName
?
dist
+
"/images/timg.jpg"
:
self
.
img
,
img
:
self
.
customerNum
==
self
.
defaultName
?
dist
+
"/images/timg.jpg"
:
self
.
img
,
id
:
self
.
id
id
:
self
.
id
},
false
));
},
false
));
var
imgLen
=
$
(
'#'
+
userId
).
find
(
'img'
).
length
;
self
.
scrollToTop
(
userId
)
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
)
})
}
$
(
'#img_upload'
).
val
(
''
);
$
(
'#img_upload'
).
val
(
''
);
},
},
fail
:
function
()
{
fail
:
function
()
{
...
@@ -1001,22 +989,7 @@ $(function () {
...
@@ -1001,22 +989,7 @@ $(function () {
}
}
$
(
'#'
+
id
).
find
(
'.notice_item_content'
).
prepend
(
chatCon
);
$
(
'#'
+
id
).
find
(
'.notice_item_content'
).
prepend
(
chatCon
);
if
(
!
isTemplate
)
{
if
(
!
isTemplate
)
{
var
imgLen
=
$
(
'#'
+
id
).
find
(
'img'
).
length
;
this
.
scrollToTop
(
id
);
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
)
})
}
}
}
...
...
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