Commit 3b3c371e by 施宇

111

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