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
9db21323
authored
Jun 27, 2019
by
施宇
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
3123123
parent
5ea1d4b7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
69 additions
and
52 deletions
Application/Home/View/Chat/index.html
dist/js/chat/index.js
Application/Home/View/Chat/index.html
View file @
9db21323
...
...
@@ -16,6 +16,7 @@
<div
class=
"content_div"
>
<div
class=
"notice_left boxsiz"
>
<div
class=
"notice_left_content boxsiz"
>
</div>
</div>
<div
class=
"notice_right boxsiz"
>
...
...
dist/js/chat/index.js
View file @
9db21323
...
...
@@ -9,69 +9,85 @@ $(function () {
this
.
connListen
();
this
.
login
();
this
.
bindFunction
();
var
data
=
JSON
.
stringify
({
"grant_type"
:
"client_credentials"
,
"client_id"
:
"YXA6UWJlUJGNEemA0XUSlr6mDA"
,
"client_secret"
:
"YXA6n8pckF065e7FPtukjJHAoa-4G74"
},
)
$
.
ajax
({
type
:
'post'
,
url
:
'http://a1.easemob.com/1113190618181018/icsales/token'
,
data
:
data
,
contentType
:
"application/json"
,
success
:
function
(
data
)
{
var
token
=
data
.
access_token
;
$
.
ajax
({
type
:
'get'
,
url
:
'http://a1.easemob.com/1113190618181018/icsales/chatmessages/2019062513'
,
headers
:
{
Authorization
:
'Bearer '
+
token
},
success
:
function
(
data
)
{
//
var data = JSON.stringify({
//
"grant_type": "client_credentials",
//
"client_id": "YXA6UWJlUJGNEemA0XUSlr6mDA",
//
"client_secret": "YXA6n8pckF065e7FPtukjJHAoa-4G74"
//
}, )
//
$.ajax({
//
type: 'post',
//
url: 'http://a1.easemob.com/1113190618181018/icsales/token',
//
data: data,
//
contentType: "application/json",
//
success: function (data) {
//
var token = data.access_token;
//
$.ajax({
//
type: 'get',
//
url: 'http://a1.easemob.com/1113190618181018/icsales/chatmessages/2019062513',
//
headers: {
//
Authorization: 'Bearer ' + token
//
},
//
success: function (data) {
},
error
:
function
()
{
layer
.
msg
(
'网络出现问题,请重试!'
);
}
});
//
},
//
error: function () {
//
layer.msg('网络出现问题,请重试!');
//
}
//
});
},
error
:
function
()
{
layer
.
msg
(
'网络出现问题,请重试!'
);
}
});
//
},
//
error: function () {
//
layer.msg('网络出现问题,请重试!');
//
}
//
});
},
defaultUser
:
function
()
{
//默认客服
var
message
=
{
from
:
"18664936975"
,
data
:
''
}
this
.
receiveData
(
1
,
message
,
false
);
this
.
addUser
(
'18664936975'
,
true
)
},
singleChat
:
function
()
{
var
templateStr
=
Util
.
getCookie
(
'template'
);
var
templateObj
=
{};
if
(
templateStr
)
{
templateObj
=
JSON
.
parse
(
templateStr
)
}
var
templateObj
=
JSON
.
parse
(
Util
.
getCookie
(
'template'
)
||
"{}"
)
if
(
JSON
.
stringify
(
templateObj
)
!==
'{}'
)
{
var
message
=
{
from
:
templateObj
.
userId
,
data
:
''
};
this
.
receiveData
(
1
,
message
,
false
);
$
(
".notice_classify[userid="
+
templateObj
.
userId
+
"]"
).
click
();
this
.
addUser
(
templateObj
.
userId
,
false
)
this
.
sendCmd
(
templateObj
);
Util
.
delCookie
(
'template'
);
}
},
addUser
:
function
(
id
,
isCustom
)
{
var
userLen
=
$
(
'.chat_item_content'
).
find
(
'#'
+
id
).
length
;
if
(
userLen
)
{
//用户存在
$
(
".notice_classify[userid="
+
id
+
"]"
).
click
();
}
else
{
//用户不存在
var
lefthtml
=
'<div class="notice_classify" userid="'
+
id
+
'">'
+
this
.
userHtml
(
0
,
id
,
''
)
+
'</div>'
;;
var
righthtml
=
'<div class="chat_item" id="'
+
id
+
'">'
+
'<div class="title clr">'
+
'<div class="fr btn btn_border">'
+
'<span class="icon iconfont iconjuxing23"></span>'
+
'<i>'
+
id
+
'</i>'
+
'</div>'
+
'<h3 class="bold boxsiz">'
+
id
+
'</h3>'
+
'</div>'
+
'<div class="notice_list boxsiz">'
+
'<div class="notice_item_content">'
+
'</div>'
+
'</div>'
+
'</div>'
+
'</div>'
;
if
(
isCustom
)
{
//是客服
$
(
'.notice_left_content'
).
prepend
(
lefthtml
);
$
(
'.chat_item_content'
).
prepend
(
righthtml
)
}
else
{
//不是客服
$
(
'.notice_left_content'
).
append
(
lefthtml
);
$
(
'.chat_item_content'
).
append
(
righthtml
)
}
$
(
".notice_classify[userid="
+
id
+
"]"
).
click
();
}
},
connection
:
function
()
{
//建立聊天链接
this
.
conn
=
new
WebIM
.
connection
({
...
...
@@ -195,17 +211,17 @@ $(function () {
'<img src="http://resic.liexin.com/images/test.jpg" alt="">'
+
'<div class="template_right">'
+
'<div class="template_right_top clr">'
+
'<h3 class="bold fl">'
+
html
.
type
+
'</h3>'
+
'<div class="price bold fr">'
+
html
.
price
+
'</div>'
+
'<h3 class="bold fl">'
+
html
.
type
+
'</h3>'
+
'<div class="price bold fr">'
+
html
.
price
+
'</div>'
+
'</div>'
+
'<div class="template_right_bottom">'
+
'<div class="desc1 clr">'
+
'<div class="brand fl">品牌:<i>'
+
html
.
brand
+
'</i></div>'
+
'<div class="hq fl">货期:<i>'
+
html
.
hq
+
'</i></div>'
+
'<div class="brand fl">品牌:<i>'
+
html
.
brand
+
'</i></div>'
+
'<div class="hq fl">货期:<i>'
+
html
.
hq
+
'</i></div>'
+
'</div>'
+
'<div class="desc2 clr">'
+
'<div class="num fl">数量:<i class="bold">'
+
html
.
num
+
'PCS</i></div>'
+
'<div class="num fl">数量:<i class="bold">'
+
html
.
num
+
'PCS</i></div>'
+
'<div class="time fl">时间:<i>2019-05-23 15:57 </i></div>'
+
'</div>'
+
'</div>'
+
...
...
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