Commit eed5ab25 by 施宇

Merge branch 'sy_ic_1016'

parents 955e4d52 ff02480c
......@@ -32,14 +32,14 @@
<li class="search_sp fl">商品</li>
<li class="search_xj fl">询价</li>
</ul>
<div class="zz condition_content">
<!-- <div class="zz condition_content">
<span class="bold">时间:</span>
<div class="condition_right_content clr">
<div class="fl jt">今天 </div>
<div class="fl st">三天之内</div>
<div class="fl qt">七天之内</div>
</div>
</div>
</div> -->
<!-- <div class="fz condition_content ">
<span class="bold">封装:</span>
<div class="condition_right_content clr">
......
......@@ -348,9 +348,9 @@
} else {
var token = Util.getCookie('token') || "";
if (token) {
window.location.href = home_url + '/search?key=' + val + '&type=1&time=1';
window.location.href = home_url + '/search?key=' + val + '&type=1';
} else {
window.location.href = search_url + '/' + decodeURIComponent(val) + '_1_1';
window.location.href = search_url + '/' + decodeURIComponent(val) + '_1';
}
}
......
<?php
return array(
'URL_ROUTE_RULES' => array(//动态路由
'/^(\w+)_(\d+)_(\d+)$/' => 'Index/index?key=:1&type=:2&time=:3',
'/^(\w+)_(\d+)$/' => 'Index/index?key=:1&type=:2',
)
);
......@@ -30,14 +30,14 @@
<li class="search_sp fl ">商品</li>
<li class="search_xj fl">询价</li>
</ul>
<div class="zz condition_content">
<!-- <div class="zz condition_content">
<span class="bold">时间:</span>
<div class="condition_right_content clr">
<div class="fl jt">今天</div>
<div class="fl st">三天之内</div>
<div class="fl qt">七天之内</div>
</div>
</div>
</div> -->
<!-- <div class="fz condition_content ">
<span class="bold">封装:</span>
<div class="condition_right_content clr">
......
......@@ -3,9 +3,11 @@ $(function () {
conn: {},
orgName: "1113190618181018",
appName: "icsales",
defaultName: "001",
defaultName: "001",//客服im账号
defaultUserId:"36",//客服ID
customerNum: "",
customerP: "",
isAddCustomer:false,
templateObj: JSON.parse(Util.getCookie('template') || "{}"),
customerText: Util.getCookie('customer') || "",
isLoginSuccess: false,
......@@ -76,24 +78,31 @@ $(function () {
}
});
},
addChatMember: function (id) {
addChatMember: function (id,isCustomer) {
var self = this;
IcController.getData(apis.addrecord, 'GET', {
"token": Util.getCookie('token') || '',
"user_id": id
}, function (res) {
if (res.errcode === 0) {
if(isCustomer){
self.isAddCustomer = true
}
} else {
// console.log('添加聊天成员失败')
}
}, false);
},
rendChatSection: function (data) {
if (this.customerNum !== this.defaultName) {
if (this.customerNum !== this.defaultName) {//加客服
this.addUser({}, true);
}
for (var i = 0; i < data.length; i++) {
this.addUser(data[i])
if(data[i].im_username !== this.defaultName){
this.addUser(data[i])
}else{
this.isAddCustomer = true;
}
}
},
singleChat: function () {
......@@ -130,7 +139,7 @@ $(function () {
if (isDefault) {
id = this.defaultName;
name = '芯掌柜客服';
touserid = "";
touserid = this.defaultUserId;
img = dist + "/images/timg.jpg";
img1 = dist + "/images/timg.jpg";
} else {
......@@ -526,10 +535,10 @@ $(function () {
time: message.ext.time,
touserid: message.ext.touserid
}, true);
var index = self.chatList.indexOf(message.from);
if (index == -1) {
self.addChatMember(message.ext.id)
}
// var index = self.chatList.indexOf(message.from);
// if (index == -1) {
// self.addChatMember(message.ext.id)
// }
} else { //普通消息
self.receiveData(1, {
......@@ -540,12 +549,12 @@ $(function () {
from: message.from,
touserid: message.ext.touserid
}, false);
if (self.customerNum == self.defaultName) {
var index = self.chatList.indexOf(message.from);
if (index == -1) {
self.addChatMember(message.ext.id)
}
}
// if (self.customerNum == self.defaultName) {
// var index = self.chatList.indexOf(message.from);
// if (index == -1) {
// self.addChatMember(message.ext.id)
// }
// }
}
}, //收到文本消息;
......@@ -558,12 +567,12 @@ $(function () {
from: message.from,
touserid: message.ext.touserid
}, false);
if (self.customerNum == self.defaultName) {
var index = self.chatList.indexOf(message.from);
if (index == -1) {
self.addChatMember(message.ext.id)
}
}
// if (self.customerNum == self.defaultName) {
// var index = self.chatList.indexOf(message.from);
// if (index == -1) {
// self.addChatMember(message.ext.id)
// }
// }
}, //收到表情消息;
// onCmdMessage: function (message) {
......@@ -598,12 +607,12 @@ $(function () {
url: message.url,
touserid: message.ext.touserid
}, false);
if (self.customerNum == self.defaultName) {
var index = self.chatList.indexOf(message.from);
if (index == -1) {
self.addChatMember(message.ext.id)
}
}
// if (self.customerNum == self.defaultName) {
// var index = self.chatList.indexOf(message.from);
// if (index == -1) {
// self.addChatMember(message.ext.id)
// }
// }
};
options.onFileDownloadError = function () {
// 图片下载失败
......@@ -748,6 +757,9 @@ $(function () {
}, false));
self.scrollToTop(userId)
$('#chat_textarea').val('');
if(userId == self.defaultName && !self.isAddCustomer){
self.addChatMember(touserid,true)
}
},
fail: function (e) {
......
......@@ -117,7 +117,8 @@ $(function () {
} else if (val.length < 3) {
layer.msg('请至少输入3个字符')
} else {
window.location.href = "/search?key=" + val + '&type=1&time=1';
// window.location.href = "/search?key=" + val + '&type=1&time=1';
window.location.href = "/search?key=" + val + '&type=1';
}
});
......@@ -139,7 +140,8 @@ $(function () {
});
$('.search_command').on('click', '.hot_item', function () {
var title = $(this).attr('title');
window.location.href = "/search?key=" + title + '&type=1&time=1';
// window.location.href = "/search?key=" + title + '&type=1&time=1';
window.location.href = "/search?key=" + title + '&type=1';
});
......
......@@ -11,27 +11,29 @@ $(function () {
},
renderPage: function () {
if (this.type == 2) {
$('.search_nav ').find('.search_xj').addClass('active').siblings().removeClass('active');
$('.search_nav').find('.search_xj').click()
// $('.search_nav ').find('.search_xj').addClass('active').siblings().removeClass('active');
} else {
$('.search_nav ').find('.search_sp').addClass('active').siblings().removeClass('active');
$('.search_nav').find('.search_sp').click()
// $('.search_nav ').find('.search_sp').addClass('active').siblings().removeClass('active');
}
if (this.time == 2) {
$('.condition_right_content').find('.st').click()
} else if (this.time == 3) {
$('.condition_right_content').find('.qt').click()
} else {
$('.condition_right_content').find('.jt').click()
};
// if (this.time == 2) {
// $('.condition_right_content').find('.st').click()
// } else if (this.time == 3) {
// $('.condition_right_content').find('.qt').click()
// } else {
// $('.condition_right_content').find('.jt').click()
// };
$('.input-search').val(this.key);
},
getData: function (type, time) {
getData: function (type) {
var self = this;
var url = type == 1 ? apis.goodsSearch : apis.inquirySearch;
IcController.getData(url, 'GET', {
"offset": 8,
"p": 1,
"goods_name/like": self.key,
"start_time": time
// "start_time": time
}, function (res) {
var getTpl = "";
if (type == 1) {
......@@ -74,7 +76,7 @@ $(function () {
} else {
self.type = 2
}
$('.jt').click();
self.getData(self.type)
});
$('.input_btn').on('click', function () {
var val = $.trim($('.input-search').val());
......@@ -84,7 +86,7 @@ $(function () {
layer.msg('搜索内容太短')
} else {
console.log(self.type, self.time)
window.location.replace("/" + decodeURIComponent(val) + '_' + self.type + '_' + self.time);
window.location.replace("/" + decodeURIComponent(val) + '_' + self.type);
}
});
$('.zz').on('click', '.fl', function () {
......
......@@ -9,28 +9,30 @@ $(function () {
},
renderPage: function () {
if (this.type == 2) {
$('.search_nav ').find('.search_xj').addClass('active').siblings().removeClass('active');
// $('.search_nav ').find('.search_xj').addClass('active').siblings().removeClass('active');
$('.search_nav').find('.search_xj').click()
} else {
$('.search_nav ').find('.search_sp').addClass('active').siblings().removeClass('active');
$('.search_nav').find('.search_sp').click()
// $('.search_nav ').find('.search_sp').addClass('active').siblings().removeClass('active');
}
if (this.time == 2) {
$('.condition_right_content').find('.st').click()
} else if (this.time == 3) {
$('.condition_right_content').find('.qt').click()
} else {
$('.condition_right_content').find('.jt').click()
};
// if (this.time == 2) {
// $('.condition_right_content').find('.st').click()
// } else if (this.time == 3) {
// $('.condition_right_content').find('.qt').click()
// } else {
// $('.condition_right_content').find('.jt').click()
// };
$('.input-search').val(this.key);
},
getData: function (type, p, time) {
getData: function (type, p) {
var self = this;
var url = type == 1 ? apis.goodsSearch : apis.inquirySearch;
IcController.getData(url, 'GET', {
"offset": 10,
"p": p,
"goods_name/like": self.key,
"start_time": time,
// "start_time": time,
"token": Util.getCookie('token') || ""
}, function (res) {
var getTpl = "";
......@@ -59,7 +61,8 @@ $(function () {
jump: function (obj, first) {
if (!first) {
//分页回调调用
self.getData(type, obj.curr, self.key, time)
// self.getData(type, obj.curr, self.key, time)
self.getData(type, obj.curr)
}
}
});
......@@ -88,9 +91,9 @@ $(function () {
if (index == 0) {
self.type = 1
} else {
self.type = 2
self.type = 2;
}
$('.jt').click();
self.getData(self.type, 1)
});
$('.input_btn').on('click', function () {
var val = $.trim($('.input-search').val());
......@@ -99,7 +102,7 @@ $(function () {
} else if (val.length < 3) {
layer.msg('请至少输入3个字符');
} else {
window.location.replace("/search?key=" + val + '&type=' + self.type + '&time=' + self.time);
window.location.replace("/search?key=" + val + '&type=' + self.type);
}
});
$('.zz').on('click', '.fl', function () {
......
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