Commit 3b3c371e by 施宇

111

parent 4ab601da
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
<script type="text/html" id="sphtml"> <script type="text/html" id="sphtml">
<div class="my_xj_list clr "> <div class="my_xj_list clr ">
{{# layui.each(d, function(index, item){ }} {{# layui.each(d, function(index, item){ }}
<div class="my_xj_item fl boxsiz sp_item" goodid="{{item.goods_id}}" style="cursor:pointer"> <div class="my_xj_item fl boxsiz sp_item" goodid="{{item.goods_id}}" style="cursor:pointer" userid="{{item.user_id}}">
<div class="item_top clr"> <div class="item_top clr">
<div class="fl num ellipsis">{{item.goods_name}}</div> <div class="fl num ellipsis">{{item.goods_name}}</div>
</div> </div>
......
...@@ -23,7 +23,7 @@ $(function () { ...@@ -23,7 +23,7 @@ $(function () {
}, function (res) { }, function (res) {
if (res.err_code == 0) { if (res.err_code == 0) {
self.img = res.data.avatar; self.img = res.data.avatar;
self.name = res.data.company_name||'--'; self.name = res.data.company_name || '--';
self.id = res.data.user_id + ''; self.id = res.data.user_id + '';
self.getHistoryUsers(res.data.im_username, res.data.im_password); self.getHistoryUsers(res.data.im_username, res.data.im_password);
...@@ -57,7 +57,7 @@ $(function () { ...@@ -57,7 +57,7 @@ $(function () {
} else { } else {
console.log('添加聊天成员失败') console.log('添加聊天成员失败')
} }
},false); }, false);
}, },
rendChatSection: function (data) { rendChatSection: function (data) {
console.log('获取成员') console.log('获取成员')
...@@ -356,6 +356,9 @@ $(function () { ...@@ -356,6 +356,9 @@ $(function () {
if (!len) { if (!len) {
//新用户 //新用户
if (Util.getCookie('templateBoolean')) {
Util.delCookie('templateBoolean', cookieHostname);
}
var userStr = '<div class="notice_classify active" userid="' + message.from + '" firstClick="true" newMember="true">' + var userStr = '<div class="notice_classify active" userid="' + message.from + '" firstClick="true" newMember="true">' +
self.userHtml(0, message, regContent) + '</div>'; self.userHtml(0, message, regContent) + '</div>';
var messageStr = '<div class="chat_item active" id="' + message.from + '">' + var messageStr = '<div class="chat_item active" id="' + message.from + '">' +
...@@ -385,6 +388,9 @@ $(function () { ...@@ -385,6 +388,9 @@ $(function () {
} else { } else {
//非当前用户 //非当前用户
if (Util.getCookie('templateBoolean')) {
Util.delCookie('templateBoolean', cookieHostname);
}
var num = Number($(this).find('.num').text()); var num = Number($(this).find('.num').text());
$(this).html(self.userHtml(num + 1, message, regContent)); $(this).html(self.userHtml(num + 1, message, regContent));
var html = $(this).clone(); var html = $(this).clone();
...@@ -400,7 +406,9 @@ $(function () { ...@@ -400,7 +406,9 @@ $(function () {
} else { } else {
if (index == len - 1) { if (index == len - 1) {
//新用户 //新用户
console.log('新用户') if (Util.getCookie('templateBoolean')) {
Util.delCookie('templateBoolean', cookieHostname);
}
var userStr = '<div class="notice_classify" userid="' + var userStr = '<div class="notice_classify" userid="' +
message.from + '" newMember="true">' + message.from + '" newMember="true">' +
self.userHtml(1, message, regContent) + '</div>'; self.userHtml(1, message, regContent) + '</div>';
...@@ -425,18 +433,18 @@ $(function () { ...@@ -425,18 +433,18 @@ $(function () {
}, },
onTextMessage: function (message) { onTextMessage: function (message) {
self.receiveData(1, { self.receiveData(1, {
name: message.ext.name||'--', name: message.ext.name || '--',
id: message.ext.id, id: message.ext.id,
img: message.ext.img||(dist + "/images/default.jpg"), img: message.ext.img || (dist + "/images/default.jpg"),
message: message.data, message: message.data,
from: message.from from: message.from
}, false) }, false)
}, //收到文本消息; }, //收到文本消息;
onEmojiMessage: function (message) { onEmojiMessage: function (message) {
self.receiveData(3, { self.receiveData(3, {
name: message.ext.name||'--', name: message.ext.name || '--',
id: message.ext.id, id: message.ext.id,
img: message.ext.img||(dist + "/images/default.jpg"), img: message.ext.img || (dist + "/images/default.jpg"),
message: message.data, message: message.data,
from: message.from, from: message.from,
}, false) }, false)
...@@ -445,9 +453,9 @@ $(function () { ...@@ -445,9 +453,9 @@ $(function () {
onCmdMessage: function (message) { onCmdMessage: function (message) {
console.log(message) console.log(message)
self.receiveData(1, { self.receiveData(1, {
name: message.ext.name||'--', name: message.ext.name || '--',
id: message.ext.id, id: message.ext.id,
img: message.ext.img||(dist + "/images/default.jpg"), img: message.ext.img || (dist + "/images/default.jpg"),
from: message.from, from: message.from,
type: message.ext.type, type: message.ext.type,
price: message.ext.price, price: message.ext.price,
...@@ -467,9 +475,9 @@ $(function () { ...@@ -467,9 +475,9 @@ $(function () {
options.onFileDownloadComplete = function () { options.onFileDownloadComplete = function () {
// 图片下载成功; // 图片下载成功;
self.receiveData(2, { self.receiveData(2, {
name: message.ext.name||'--', name: message.ext.name || '--',
id: message.ext.id, id: message.ext.id,
img: message.ext.img||(dist + "/images/default.jpg"), img: message.ext.img || (dist + "/images/default.jpg"),
from: message.from, from: message.from,
url: message.url url: message.url
}, false) }, false)
...@@ -576,9 +584,9 @@ $(function () { ...@@ -576,9 +584,9 @@ $(function () {
params, true)); params, true));
var contentHeight = $('#' + userId).find('.notice_item_content') var contentHeight = $('#' + userId).find('.notice_item_content')
.height(); .height();
setTimeout(function(){ setTimeout(function () {
$('#' + userId).find('.notice_list').scrollTop(contentHeight); $('#' + userId).find('.notice_list').scrollTop(contentHeight);
},200) }, 200)
}, },
fail: function () { fail: function () {
...@@ -626,9 +634,9 @@ $(function () { ...@@ -626,9 +634,9 @@ $(function () {
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);
setTimeout(function(){ setTimeout(function () {
$('#' + userId).find('.notice_list').scrollTop(contentHeight); $('#' + userId).find('.notice_list').scrollTop(contentHeight);
},200) }, 200)
$('#img_upload').val(''); $('#img_upload').val('');
}, },
fail: function () { fail: function () {
...@@ -700,9 +708,9 @@ $(function () { ...@@ -700,9 +708,9 @@ $(function () {
} else { } else {
var contentHeight = $('#' + id).find('.notice_item_content').height(); var contentHeight = $('#' + id).find('.notice_item_content').height();
// $('#' + id).find('.notice_list').scrollTop(contentHeight); // $('#' + id).find('.notice_list').scrollTop(contentHeight);
setTimeout(function(){ setTimeout(function () {
$('#' + id).find('.notice_list').scrollTop(contentHeight); $('#' + id).find('.notice_list').scrollTop(contentHeight);
},200) }, 200)
if (newMember) { if (newMember) {
return return
...@@ -789,9 +797,9 @@ $(function () { ...@@ -789,9 +797,9 @@ $(function () {
var contentHeight = $('#' + id).find('.notice_item_content') var contentHeight = $('#' + id).find('.notice_item_content')
.height(); .height();
setTimeout(function(){ setTimeout(function () {
$('#' + id).find('.notice_list').scrollTop(contentHeight); $('#' + id).find('.notice_list').scrollTop(contentHeight);
},200) }, 200)
}, },
}; };
......
...@@ -131,7 +131,15 @@ $(function () { ...@@ -131,7 +131,15 @@ $(function () {
}); });
$('.goods_data_list').on('click', '.sp_item', function () { $('.goods_data_list').on('click', '.sp_item', function () {
var goodid = $(this).attr('goodid'); var goodid = $(this).attr('goodid');
window.location.href = "/gooddetail?type=2&id=" + goodid var eleuserid = $(this).attr('userid');
var userid = Util.getCookie('user_id') || "";
var type;
if(userid === eleuserid){
type = 1
}else{
type = 2
}
window.location.href = "/gooddetail?type="+ type +"&id=" + goodid
}); });
$('.goods_data_list').on('click', '.lx_cus', function () { $('.goods_data_list').on('click', '.lx_cus', function () {
window.location.href = "/chat" window.location.href = "/chat"
......
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