Merge branch 'develop' of http://git.dev.yoho.cn/platform/yohobuy-portal-fe into develop
# Conflicts: # server/stub/service/yohosearch.js
Showing
3 changed files
with
30 additions
and
6 deletions
@@ -87,7 +87,8 @@ var Bll={ | @@ -87,7 +87,8 @@ var Bll={ | ||
87 | }, | 87 | }, |
88 | __render:function(selecter,templater,data){ | 88 | __render:function(selecter,templater,data){ |
89 | $(selecter).html(common.util.__template2($("#"+templater).html(),data) ); | 89 | $(selecter).html(common.util.__template2($("#"+templater).html(),data) ); |
90 | - } | 90 | + }, |
91 | + Tags:[] | ||
91 | } | 92 | } |
92 | //获取品牌 | 93 | //获取品牌 |
93 | Bll.getBrands(); | 94 | Bll.getBrands(); |
@@ -121,12 +122,14 @@ $(document).on("click","#addUrl",function(){ | @@ -121,12 +122,14 @@ $(document).on("click","#addUrl",function(){ | ||
121 | 122 | ||
122 | $(document).on("click","#TagsSelectBtn",function(){ | 123 | $(document).on("click","#TagsSelectBtn",function(){ |
123 | common.dialog.confirm("选择标签","<div id='gird'></div>",function(){ | 124 | common.dialog.confirm("选择标签","<div id='gird'></div>",function(){ |
125 | + | ||
124 | $("#taglist").html(common.util.__template2($("#template4").html(),{tags:g.selected})); | 126 | $("#taglist").html(common.util.__template2($("#template4").html(),{tags:g.selected})); |
125 | }); | 127 | }); |
126 | g.init('/guang/tags/getList'); | 128 | g.init('/guang/tags/getList'); |
127 | }); | 129 | }); |
128 | $(document).on("click",".tag a",function(){ | 130 | $(document).on("click",".tag a",function(){ |
129 | g.selected.splice($(this).data("index"),1); | 131 | g.selected.splice($(this).data("index"),1); |
132 | + | ||
130 | $("#taglist").html(common.util.__template2($("#template4").html(),{tags:g.selected})); | 133 | $("#taglist").html(common.util.__template2($("#template4").html(),{tags:g.selected})); |
131 | return false; | 134 | return false; |
132 | }); | 135 | }); |
@@ -372,6 +375,10 @@ $(document).on("click","#submit",function(){ | @@ -372,6 +375,10 @@ $(document).on("click","#submit",function(){ | ||
372 | console.log("Bll.contentDatas",Bll.Brdata); | 375 | console.log("Bll.contentDatas",Bll.Brdata); |
373 | option.data.contentData=JSON.stringify(option.data.contentData); | 376 | option.data.contentData=JSON.stringify(option.data.contentData); |
374 | option.data.brands=JSON.stringify(Bll.Brdata); | 377 | option.data.brands=JSON.stringify(Bll.Brdata); |
378 | + g.selected.forEach(function(item,index){ | ||
379 | + Bll.Tags.push(item.id); | ||
380 | + }); | ||
381 | + option.data.tag=Bll.Tags.join(','); | ||
375 | 382 | ||
376 | console.log("submit",option.data); | 383 | console.log("submit",option.data); |
377 | }); | 384 | }); |
@@ -11,11 +11,28 @@ exports.search=function(req,res){ | @@ -11,11 +11,28 @@ exports.search=function(req,res){ | ||
11 | var url="http://192.168.102.208:8087/yohosearch/search.json?viewNum=15&query=51022754,51178582"; | 11 | var url="http://192.168.102.208:8087/yohosearch/search.json?viewNum=15&query=51022754,51178582"; |
12 | request({url: url}, function (error, response, body) { | 12 | request({url: url}, function (error, response, body) { |
13 | var data={}; | 13 | var data={}; |
14 | + data.list=[]; | ||
14 | body=JSON.parse(body); | 15 | body=JSON.parse(body); |
15 | - data.list=body.data.product_list; | ||
16 | - data.totalPage=body.data.total; | 16 | + var dataList=body.data.product_list; |
17 | + var goodslist=[]; | ||
18 | + var goodslist1=[]; | ||
19 | + for(var m=0;m<dataList.length;m++){ | ||
20 | + for(var n=0;n<dataList[m].goods_list.length;n++){ | ||
21 | + goodslist.push({a:dataList[m],b:dataList[m].goods_list[n]}) | ||
22 | + } | ||
23 | + } | ||
24 | + for(var i=0;i<goodslist.length;i++){ | ||
25 | + goodslist1[i]= _.assign({},goodslist[i].a,goodslist[i].b); | ||
26 | + } | ||
27 | + data.list=goodslist1.concat(); | ||
28 | + //data.list=body.data.product_list; | ||
29 | + data.total=data.list.length; | ||
17 | data.page=body.data.page; | 30 | data.page=body.data.page; |
18 | - // console.log(data); | 31 | + data.size=5; |
32 | + var a = (/^[1-9]\d*$/).test(data.total/data.size); | ||
33 | + data.totalPage=a?parseInt(data.total/data.size):parseInt(data.total/data.size)+1; | ||
19 | res.json({data:{data:data}}); | 34 | res.json({data:{data:data}}); |
20 | }); | 35 | }); |
21 | -} | ||
36 | +}; | ||
37 | + | ||
38 | + |
@@ -98,7 +98,7 @@ | @@ -98,7 +98,7 @@ | ||
98 | <div class="col-sm-8"> | 98 | <div class="col-sm-8"> |
99 | <input type="radio" value="1" name="coverImageType"> | 99 | <input type="radio" value="1" name="coverImageType"> |
100 | <label>方形</label> | 100 | <label>方形</label> |
101 | - <input type="radio" value="2" name="coverImageType" checked=""> | 101 | + <input type="radio" value="2" name="coverImageType"> |
102 | <label>长形</label> | 102 | <label>长形</label> |
103 | <input type="hidden" id="coverImageType" value="[[coverImageType]]" for="radio" /> | 103 | <input type="hidden" id="coverImageType" value="[[coverImageType]]" for="radio" /> |
104 | </div> | 104 | </div> |
-
Please register or login to post a comment