作者 王晓刚
1 个管道 的构建 通过 耗费 12 秒

修改问题文档

... ... @@ -10,6 +10,11 @@
<script type="text/javascript" src="__CDN__/assets/store/js/pagination/js/pagination.min.js"></script>
<link rel="stylesheet" href="__CDN__/assets/store/js/pagination/css/pagination.css">
<style>
.wnzd{
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.priceBtn{
position: relative;
}
... ... @@ -569,7 +574,7 @@
<li><a href="#" data-sort="9" onclick="selectDistributor(this)">厂家直销</a></li>
</ul>
</div>
<p>
<p class="wnzd">
为你找到<span id="resultsNum">0件</span>相关商品
</p>
</div>
... ... @@ -744,7 +749,7 @@
}
//初始化商品列表
function initGoodsList(page = 1, pageNum = 10){
function initGoodsList(page = 1, pageNum = 10 , store_id = null){
//排序规则
var sort = $('.activeBtn').attr('data-sort');
//关键字
... ... @@ -752,7 +757,7 @@
$.ajax({
url:"{:url('index/goods/get_all')}",
type:"POST",
data:{"province_id":province_id,"page":page,"pageNum":pageNum,'paginate':1,'sort':sort,'keyword':keyword,'lng':lng,'lat':lat},
data:{"province_id":province_id,"page":page,"pageNum":pageNum,'paginate':1,'sort':sort,'keyword':keyword,'lng':lng,'lat':lat, 'store_id':store_id},
success:function(res){
var goods_html = "";
$(res.data.data).each(function (key1, vo) {
... ... @@ -781,11 +786,11 @@
//初始化分页
var totalPage = Math.ceil(res.data.total/pageNum);
initPaging(res.data.total,res.data.current_page,totalPage,pageNum);
// 随机向地图添加25个标注
// 添加标注
$(res.wait).each(function (key, w) {
var point = new BMap.Point(w.lng, w.lat);
// console.log(point);
addMarker2(point);
addMarker2(point,w.id);
});
},
error:function(res){
... ... @@ -1017,11 +1022,19 @@
}
//添加标注点
function addMarker2(point){
function addMarker2(point,store_id){
console.log(point);
var marker = new BMap.Marker(point);
console.log(marker);
mapObj.addOverlay(marker);
marker.customData={store_id:store_id};//自定义参数id
marker.addEventListener("click",attribute);
}
function attribute(e){
console.log(e);
window.event.stopPropagation();
var store_id= e.target.customData.store_id;
initGoodsList(1,10,store_id);
}
</script>
</body>
... ...