Commit b113195e by 施宇

1213

parent 3dbf3c8c
...@@ -69,58 +69,7 @@ ...@@ -69,58 +69,7 @@
</div> </div>
</div> </div>
<div class="chat_item_content"> <div class="chat_item_content">
<!-- <div class="chat_item active" id="18664936975">
<div class="title clr">
<div class="fr btn btn_border"><span
class="icon iconfont iconjuxing23"></span><i>18664936975</i></div>
<h3 class="bold boxsiz">18664936975</h3>
</div>
<div class="notice_list boxsiz">
<div class="notice_item_content">
<div class="notice_item left clr">
<img src="http://resic.liexin.com/images/test.jpg" alt=""
class="fl user_logo">
<div class="notice_content">
<div class="template lineBlock boxsiz">
<img src="http://resic.liexin.com/images/test.jpg" alt="">
<div class="template_right">
<div class="template_right_top clr">
<h3 class="bold fl ">
STM32F103ZE</h3>
<div class="price bold fr">¥67.9800</div>
</div>
<div class="template_right_bottom">
<div class="desc1 clr">
<div class="brand fl">品牌:<i>Texas
Instruments</i></div>
<div class="hq fl">货期:<i>
现货</i></div>
</div>
<div class="desc2 clr">
<div class="num fl">数量:<i class="bold">
100,000PCS</i></div>
<div class="time fl">时间:<i>
2019-05-23 15:57 </i></div>
</div>
</div>
</div>
</div>
<div>2019-06-25 14:18:09</div>
</div>
</div>
<div class="notice_item right clr"><img
src="http://resic.liexin.com/images/test.jpg" alt=""
class="fr user_logo">
<div class="notice_content">
<p>23213123</p>
<div>2019-06-25 14:18:15</div>
</div>
</div>
</div>
</div>
</div> -->
</div> </div>
</div> </div>
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
封装:<span>LQFP-144</span> 封装:<span>LQFP-144</span>
</div> </div>
<div class="price fl boxsiz ellipsis "> 接受价:<span></span></div> <div class="price fl boxsiz ellipsis "> 接受价:<span></span></div>
<div class="num fl boxsiz ellipsis"> 数量:<span class="bold">100,000 PCS</span></div> <div class="num fl boxsiz ellipsis"> 数量:<span class="bold">100,000 PCS</span></div>
<div class="hq fl boxsiz ellipsis"> 货期:<span>现货</span></div> <div class="hq fl boxsiz ellipsis"> 货期:<span>现货</span></div>
<div class="bz fl boxsiz ellipsis"> 备注:<span>有货的商家请尽快联系,谢谢!</span></div> <div class="bz fl boxsiz ellipsis"> 备注:<span>有货的商家请尽快联系,谢谢!</span></div>
</div> </div>
...@@ -111,9 +111,11 @@ ...@@ -111,9 +111,11 @@
<div class="fz fl boxsiz ellipsis"> <div class="fz fl boxsiz ellipsis">
封装:<span>LQFP-144</span> 封装:<span>LQFP-144</span>
</div> </div>
<div class="num fl boxsiz ellipsis"> 数量:<span class="bold">100,000 PCS</span></div> <div class="num fl boxsiz ellipsis"> 数量:<span class="bold">100,000 PCS</span>
</div>
<div class="hq fl boxsiz ellipsis"> 货期:<span>现货</span></div> <div class="hq fl boxsiz ellipsis"> 货期:<span>现货</span></div>
<div class="bz fl boxsiz ellipsis"> 备注:<span>我们有大量的现货,随时都可以出库。我们有大量的现货,随时都可以出库。</span></div> <div class="bz fl boxsiz ellipsis">
备注:<span>我们有大量的现货,随时都可以出库。我们有大量的现货,随时都可以出库。</span></div>
</div> </div>
</div> </div>
</div> </div>
...@@ -131,8 +133,9 @@ ...@@ -131,8 +133,9 @@
</div> </div>
<include file="public/foot" /> <include file="public/foot" />
<script> <script>
$('.gt_div ').on('click',function(){ $('.gt_div ').on('click', function () {
window.location.href = '/chat?test=1' Util.setCookie('test', '1', 1)
window.location.href = '/chat'
}) })
</script> </script>
</body> </body>
......
...@@ -145,7 +145,7 @@ ...@@ -145,7 +145,7 @@
width: 20px; width: 20px;
} }
.chat_content .content .content_div .notice_right .edit_content .edit_input { .chat_content .content .content_div .notice_right .edit_content .edit_input {
height: 150px; height: 100px;
padding: 10px; padding: 10px;
} }
.chat_content .content .content_div .notice_right .edit_content .edit_input .chat_textarea { .chat_content .content .content_div .notice_right .edit_content .edit_input .chat_textarea {
...@@ -177,7 +177,7 @@ ...@@ -177,7 +177,7 @@
top: 90px; top: 90px;
left: 0; left: 0;
right: 0; right: 0;
bottom: 210px; bottom: 160px;
overflow: auto; overflow: auto;
padding: 10px 20px; padding: 10px 20px;
} }
...@@ -196,7 +196,33 @@ ...@@ -196,7 +196,33 @@
.chat_content .content .content_div .notice_right .notice_list .notice_item.left .notice_content p { .chat_content .content .content_div .notice_right .notice_list .notice_item.left .notice_content p {
background-color: #DFECFC; background-color: #DFECFC;
} }
.chat_content .content .content_div .notice_right .notice_list .notice_item.left .notice_content .template { .chat_content .content .content_div .notice_right .notice_list .notice_item.right {
text-align: right;
}
.chat_content .content .content_div .notice_right .notice_list .notice_item.right .notice_content {
margin-right: 60px;
}
.chat_content .content .content_div .notice_right .notice_list .notice_item.right .notice_content p {
background-color: #FCF2DF;
}
.chat_content .content .content_div .notice_right .notice_list .notice_item .user_logo {
height: 40px;
width: 40px;
border-radius: 50% 50%;
}
.chat_content .content .content_div .notice_right .notice_list .notice_item .notice_content p {
display: inline-block;
font-size: 16px;
color: #515559;
padding: 10px 15px;
border-radius: 4px;
}
.chat_content .content .content_div .notice_right .notice_list .notice_item .notice_content div {
font-size: 12px;
color: #ADB6BF;
padding: 10px 15px;
}
.chat_content .content .content_div .notice_right .notice_list .notice_item .notice_content .template {
background-color: #F5F9FC; background-color: #F5F9FC;
border: 1px solid #E6ECF2; border: 1px solid #E6ECF2;
border-radius: 4px; border-radius: 4px;
...@@ -204,86 +230,60 @@ ...@@ -204,86 +230,60 @@
position: relative; position: relative;
min-width: 520px; min-width: 520px;
} }
.chat_content .content .content_div .notice_right .notice_list .notice_item.left .notice_content .template img { .chat_content .content .content_div .notice_right .notice_list .notice_item .notice_content .template img {
height: 80px; height: 80px;
width: 80px; width: 80px;
position: absolute; position: absolute;
top: 20px; top: 20px;
left: 20px; left: 20px;
} }
.chat_content .content .content_div .notice_right .notice_list .notice_item.left .notice_content .template .template_right { .chat_content .content .content_div .notice_right .notice_list .notice_item .notice_content .template .template_right {
padding: 0; padding: 0;
margin-left: 100px; margin-left: 100px;
} }
.chat_content .content .content_div .notice_right .notice_list .notice_item.left .notice_content .template .template_right .template_right_top { .chat_content .content .content_div .notice_right .notice_list .notice_item .notice_content .template .template_right .template_right_top {
padding: 0; padding: 0;
} }
.chat_content .content .content_div .notice_right .notice_list .notice_item.left .notice_content .template .template_right .template_right_top h3 { .chat_content .content .content_div .notice_right .notice_list .notice_item .notice_content .template .template_right .template_right_top h3 {
color: #2E3033; color: #2E3033;
font-size: 20px; font-size: 20px;
padding-right: 15px; padding-right: 15px;
} }
.chat_content .content .content_div .notice_right .notice_list .notice_item.left .notice_content .template .template_right .template_right_top .price { .chat_content .content .content_div .notice_right .notice_list .notice_item .notice_content .template .template_right .template_right_top .price {
color: #EA1717; color: #EA1717;
padding: 0; padding: 0;
font-size: 20px; font-size: 20px;
text-align: right; text-align: right;
} }
.chat_content .content .content_div .notice_right .notice_list .notice_item.left .notice_content .template .template_right .template_right_bottom { .chat_content .content .content_div .notice_right .notice_list .notice_item .notice_content .template .template_right .template_right_bottom {
padding: 0; padding: 0;
font-size: 14px; font-size: 14px;
text-align: left;
} }
.chat_content .content .content_div .notice_right .notice_list .notice_item.left .notice_content .template .template_right .template_right_bottom .desc1 { .chat_content .content .content_div .notice_right .notice_list .notice_item .notice_content .template .template_right .template_right_bottom .desc1 {
padding: 0; padding: 0;
margin-top: 15px; margin-top: 15px;
} }
.chat_content .content .content_div .notice_right .notice_list .notice_item.left .notice_content .template .template_right .template_right_bottom .desc1 div { .chat_content .content .content_div .notice_right .notice_list .notice_item .notice_content .template .template_right .template_right_bottom .desc1 div {
width: 60%; width: 60%;
} }
.chat_content .content .content_div .notice_right .notice_list .notice_item.left .notice_content .template .template_right .template_right_bottom .desc1 div.hq { .chat_content .content .content_div .notice_right .notice_list .notice_item .notice_content .template .template_right .template_right_bottom .desc1 div.hq {
width: 40%; width: 40%;
} }
.chat_content .content .content_div .notice_right .notice_list .notice_item.left .notice_content .template .template_right .template_right_bottom .desc2 { .chat_content .content .content_div .notice_right .notice_list .notice_item .notice_content .template .template_right .template_right_bottom .desc2 {
padding: 0; padding: 0;
margin-top: 15px; margin-top: 15px;
} }
.chat_content .content .content_div .notice_right .notice_list .notice_item.left .notice_content .template .template_right .template_right_bottom .desc2 div { .chat_content .content .content_div .notice_right .notice_list .notice_item .notice_content .template .template_right .template_right_bottom .desc2 div {
width: 60%; width: 60%;
} }
.chat_content .content .content_div .notice_right .notice_list .notice_item.left .notice_content .template .template_right .template_right_bottom .desc2 div.time { .chat_content .content .content_div .notice_right .notice_list .notice_item .notice_content .template .template_right .template_right_bottom .desc2 div.time {
width: 40%; width: 40%;
} }
.chat_content .content .content_div .notice_right .notice_list .notice_item.left .notice_content .template .template_right .template_right_bottom div { .chat_content .content .content_div .notice_right .notice_list .notice_item .notice_content .template .template_right .template_right_bottom div {
color: #ADB6BF; color: #ADB6BF;
padding: 0; padding: 0;
} }
.chat_content .content .content_div .notice_right .notice_list .notice_item.left .notice_content .template .template_right .template_right_bottom div i { .chat_content .content .content_div .notice_right .notice_list .notice_item .notice_content .template .template_right .template_right_bottom div i {
color: #515559; color: #515559;
} }
.chat_content .content .content_div .notice_right .notice_list .notice_item.right {
text-align: right;
}
.chat_content .content .content_div .notice_right .notice_list .notice_item.right .notice_content {
margin-right: 60px;
}
.chat_content .content .content_div .notice_right .notice_list .notice_item.right .notice_content p {
background-color: #FCF2DF;
}
.chat_content .content .content_div .notice_right .notice_list .notice_item .user_logo {
height: 40px;
width: 40px;
border-radius: 50% 50%;
}
.chat_content .content .content_div .notice_right .notice_list .notice_item .notice_content p {
display: inline-block;
font-size: 16px;
color: #515559;
padding: 10px 15px;
border-radius: 4px;
}
.chat_content .content .content_div .notice_right .notice_list .notice_item .notice_content div {
font-size: 12px;
color: #ADB6BF;
padding: 10px 15px;
}
/*# sourceMappingURL=chat.css.map */
\ No newline at end of file
...@@ -177,7 +177,7 @@ ...@@ -177,7 +177,7 @@
} }
.edit_input { .edit_input {
height: 150px; height: 100px;
padding: 10px; padding: 10px;
.chat_textarea { .chat_textarea {
...@@ -217,7 +217,7 @@ ...@@ -217,7 +217,7 @@
top: 90px; top: 90px;
left: 0; left: 0;
right: 0; right: 0;
bottom: 210px; bottom: 160px;
overflow: auto; overflow: auto;
padding: 10px 20px; padding: 10px 20px;
...@@ -228,6 +228,7 @@ ...@@ -228,6 +228,7 @@
.notice_item { .notice_item {
margin-top: 20px; margin-top: 20px;
&.left { &.left {
text-align: left; text-align: left;
...@@ -239,78 +240,7 @@ ...@@ -239,78 +240,7 @@
} }
.template {
background-color: #F5F9FC;
border: 1px solid #E6ECF2;
border-radius: 4px;
padding: 20px;
position: relative;
min-width: 520px;
img {
height: 80px;
width: 80px;
position: absolute;
top: 20px;
left: 20px;
}
.template_right {
padding: 0;
margin-left: 100px;
.template_right_top {
padding: 0;
h3 {
color: #2E3033;
font-size: 20px;
padding-right:15px;
}
.price {
color: #EA1717;
padding: 0;
font-size: 20px;
text-align: right;
}
}
.template_right_bottom {
padding: 0;
font-size: 14px;
.desc1 {
padding: 0;
margin-top: 15px;
div{
width:60%;
&.hq{
width:40%;
}
}
}
.desc2 {
padding: 0;
margin-top: 15px;
div{
width:60%;
&.time{
width:40%;
}
}
}
div {
color: #ADB6BF;
padding: 0;
i {
color: #515559
}
}
}
}
}
} }
} }
...@@ -348,12 +278,92 @@ ...@@ -348,12 +278,92 @@
font-size: 12px; font-size: 12px;
color: #ADB6BF; color: #ADB6BF;
padding: 10px 15px; padding: 10px 15px;
}
.template {
background-color: #F5F9FC;
border: 1px solid #E6ECF2;
border-radius: 4px;
padding: 20px;
position: relative;
min-width: 520px;
img {
height: 80px;
width: 80px;
position: absolute;
top: 20px;
left: 20px;
}
.template_right {
padding: 0;
margin-left: 100px;
.template_right_top {
padding: 0;
h3 {
color: #2E3033;
font-size: 20px;
padding-right: 15px;
}
.price {
color: #EA1717;
padding: 0;
font-size: 20px;
text-align: right;
}
}
.template_right_bottom {
padding: 0;
font-size: 14px;
text-align: left;
.desc1 {
padding: 0;
margin-top: 15px;
div {
width: 60%;
&.hq {
width: 40%;
}
}
}
.desc2 {
padding: 0;
margin-top: 15px;
div {
width: 60%;
&.time {
width: 40%;
}
}
}
div {
color: #ADB6BF;
padding: 0;
i {
color: #515559
}
}
}
}
} }
} }
} }
} }
......
$(function () { $(function () {
var chatObj = { var chatObj = {
conn: {}, conn: {},
orgName: "1113190618181018",
appName: "icsales",
init: function () { init: function () {
this.ieFun() this.ieFun()
this.connection(); this.connection();
this.connListen(); this.connListen();
this.login(); this.login();
this.bindFunction(); 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) {
console.log(data)
},
error: function () {
layer.msg('网络出现问题,请重试!');
}
});
},
error: function () {
layer.msg('网络出现问题,请重试!');
}
});
}, },
defaultUser: function () { defaultUser: function () {
//默认客服 //默认客服
...@@ -18,19 +53,44 @@ $(function () { ...@@ -18,19 +53,44 @@ $(function () {
}, },
singleChat: function () { singleChat: function () {
var type = Util.getRequest('test'); var type = Util.getCookie('test');
if (type) {
if (type == 1) {
var id = '18589050841'; var id = '18589050841';
var message = { var message = {
from: "18589050841", from: "18589050841",
data: '' data: ''
}; };
var content = '<div class="template lineBlock boxsiz">' +
'<img src="http://resic.liexin.com/images/test.jpg" alt="">' +
'<div class="template_right">' +
'<div class="template_right_top clr">' +
'<h3 class="bold fl">STM32F103ZE</h3>' +
'<div class="price bold fr">¥67.9800</div>' +
'</div>' +
'<div class="template_right_bottom">' +
'<div class="desc1 clr">' +
'<div class="brand fl">品牌:<i>TexasInstruments</i></div>' +
'<div class="hq fl">货期:<i> 现货</i></div>' +
'</div>' +
'<div class="desc2 clr">' +
'<div class="num fl">数量:<i class="bold">100,000PCS</i></div>' +
'<div class="time fl">时间:<i>2019-05-23 15:57 </i></div>' +
'</div>' +
'</div>' +
'</div>' +
'</div>';
this.receiveData(1, message); this.receiveData(1, message);
$(".notice_classify[userid=" + id + "]").click(); $(".notice_classify[userid=" + id + "]").click();
this.sendPrivateText('1') this.sendPrivateText(content, {
test: 1
});
Util.delCookie('test');
} }
}, },
connection: function () { connection: function () {
//建立聊天链接 //建立聊天链接
...@@ -147,16 +207,22 @@ $(function () { ...@@ -147,16 +207,22 @@ $(function () {
'</div>' '</div>'
} }
}, },
messageHtml: function (leftOrRight, html) { messageHtml: function (leftOrRight, html, obj) {
//右边消息的dom拼接 //右边消息的dom拼接
if (leftOrRight == 1) { //右边 if (leftOrRight == 1) { //右边
if (html) { if (html) {
var htmlp = ''
if (obj.test) {
htmlp = html;
} else {
htmlp = '<p>' + html + '</p>'
}
return '<div class="notice_item right clr">' + return '<div class="notice_item right clr">' +
'<img src="' + dist + '/images/test.jpg" alt="" class="fr user_logo">' + '<img src="' + dist + '/images/test.jpg" alt="" class="fr user_logo">' +
'<div class="notice_content">' + '<div class="notice_content">' +
'<p>' + // '<p>' +
html + htmlp +
'</p>' + // '</p>' +
'<div>' + this.curentTime() + '</div>' + '<div>' + this.curentTime() + '</div>' +
'</div>' '</div>'
} else { } else {
...@@ -213,7 +279,7 @@ $(function () { ...@@ -213,7 +279,7 @@ $(function () {
'</div>' + '</div>' +
'<div class="notice_list boxsiz">' + '<div class="notice_list boxsiz">' +
'<div class="notice_item_content">' + '<div class="notice_item_content">' +
self.messageHtml(2, htmlStr) + self.messageHtml(2, htmlStr, {}) +
'</div>' + '</div>' +
'</div>' + '</div>' +
'</div>'; '</div>';
...@@ -236,7 +302,7 @@ $(function () { ...@@ -236,7 +302,7 @@ $(function () {
//当前用户 //当前用户
$(this).html(self.userHtml(0, message.from, regContent)); $(this).html(self.userHtml(0, message.from, regContent));
$('#' + userId).find('.notice_item_content').append(self.messageHtml(2, $('#' + userId).find('.notice_item_content').append(self.messageHtml(2,
htmlStr)); htmlStr, {}));
var contentHeight = $('#' + userId).find('.notice_item_content') var contentHeight = $('#' + userId).find('.notice_item_content')
.height(); .height();
$('#' + userId).find('.notice_list').scrollTop(contentHeight); $('#' + userId).find('.notice_list').scrollTop(contentHeight);
...@@ -246,7 +312,7 @@ $(function () { ...@@ -246,7 +312,7 @@ $(function () {
var num = Number($(this).find('.num').text()); var num = Number($(this).find('.num').text());
$(this).html(self.userHtml(num + 1, message.from, regContent)); $(this).html(self.userHtml(num + 1, message.from, regContent));
$('#' + userId).find('.notice_item_content').append(self.messageHtml(2, $('#' + userId).find('.notice_item_content').append(self.messageHtml(2,
htmlStr)); htmlStr, {}));
} }
return false; return false;
...@@ -328,7 +394,7 @@ $(function () { ...@@ -328,7 +394,7 @@ $(function () {
} }
}, },
sendPrivateText: function (content) { sendPrivateText: function (content, obj) {
var self = this; var self = this;
// 私聊发送文本消息,发送表情同发送文本消息,只是会在对方客户端将表情文本进行解析成图片; // 私聊发送文本消息,发送表情同发送文本消息,只是会在对方客户端将表情文本进行解析成图片;
var userId = $('.notice_left ').find('.active').attr('userid'); var userId = $('.notice_left ').find('.active').attr('userid');
...@@ -341,7 +407,7 @@ $(function () { ...@@ -341,7 +407,7 @@ $(function () {
roomType: false, roomType: false,
success: function (id, serverMsgId) { success: function (id, serverMsgId) {
$('#' + userId).find('.notice_item_content').append(self.messageHtml(1, $('#' + userId).find('.notice_item_content').append(self.messageHtml(1,
emojiMessage)); emojiMessage, obj));
var contentHeight = $('#' + userId).find('.notice_item_content') var contentHeight = $('#' + userId).find('.notice_item_content')
.height(); .height();
$('#' + userId).find('.notice_list').scrollTop(contentHeight); $('#' + userId).find('.notice_list').scrollTop(contentHeight);
...@@ -377,7 +443,7 @@ $(function () { ...@@ -377,7 +443,7 @@ $(function () {
success: function () { success: function () {
var htmlStr = '<img src ="' + file.url + '" class="edit_img"/>'; var htmlStr = '<img src ="' + file.url + '" class="edit_img"/>';
$('#' + userId).find('.notice_item_content').append(self.messageHtml(1, $('#' + userId).find('.notice_item_content').append(self.messageHtml(1,
htmlStr)); htmlStr, {}));
var contentHeight = $('#' + userId).find('.notice_item_content') var contentHeight = $('#' + userId).find('.notice_item_content')
.height(); .height();
$('#' + userId).find('.notice_list').scrollTop(contentHeight); $('#' + userId).find('.notice_list').scrollTop(contentHeight);
...@@ -402,7 +468,7 @@ $(function () { ...@@ -402,7 +468,7 @@ $(function () {
e.preventDefault(); e.preventDefault();
} }
if (val) { if (val) {
self.sendPrivateText(val) self.sendPrivateText(val, {})
} }
} }
}); });
......
...@@ -83,12 +83,12 @@ $ }) ...@@ -83,12 +83,12 @@ $ })
* @param domain * @param domain
* @returns {boolean} * @returns {boolean}
*/ */
setCookie: function (name, value, time, domain) { setCookie: function (name, value, time) {
domain = domain ? ";domain=" + domain : ""; // domain = domain ? ";domain=" + domain : "";
var Days = time; var Days = time;
var exp = new Date(); var exp = new Date();
exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000); exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);
document.cookie = name + "=" + value + ";expires=" + exp.toGMTString() + ";path=/" + domain; document.cookie = name + "=" + value + ";expires=" + exp.toGMTString();
return true; return true;
}, },
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment