Authored by cailing

update

@@ -86,6 +86,59 @@ const getNewReportFloorData = data => { @@ -86,6 +86,59 @@ const getNewReportFloorData = data => {
86 return list; 86 return list;
87 }; 87 };
88 88
  89 +//人气单品
  90 +const getSingleHotFloorData = data => {
  91 + let list = [];
  92 +
  93 + _.forEach(data, (item, index) => {
  94 + let len = 10;
  95 +
  96 + if (item.data.text === '人气单品') {
  97 + for (let i = 0; i < len; i ++) {
  98 + let pos = i;
  99 + let val = {};
  100 + let obj = {};
  101 + if (i == 1) {
  102 + val = data[index + 1].data[0]; // 第二个是大图
  103 + }
  104 + else if (i == len - 1) {
  105 + val = data[index + 1].data[1]; // 最后一个是大图
  106 + }
  107 + else {
  108 + if (pos > 1) { // 小图
  109 + pos = pos - 1;
  110 + }
  111 + val = data[index + 2].data[pos];
  112 + }
  113 + obj.href = val.url;
  114 + obj.img = val.src;
  115 + list.push(obj);
  116 + }
  117 + }
  118 + });
  119 + return list;
  120 +};
  121 +
  122 +const getadbannerData = data => {
  123 + let adbanner = [];
  124 + let temp = [];
  125 + let obj = {};
  126 + _.forEach(data, (item, index) => {
  127 + if(item.template_name === 'single_image'){
  128 + temp.push(item);
  129 + }
  130 +
  131 + })
  132 + console.log(temp);
  133 + obj.href = temp[2].data[0].url;
  134 + obj.img = temp[2].data[0].src;
  135 + obj.name = temp[2].data[0].title;
  136 +
  137 + adbanner.push(obj);
  138 + return adbanner;
  139 +
  140 +}
  141 +
89 const requestContent = (type) => { 142 const requestContent = (type) => {
90 let data = sign.apiSign({ 143 let data = sign.apiSign({
91 /* eslint-disable */ 144 /* eslint-disable */
@@ -124,6 +177,14 @@ exports.getContent = (type) => { @@ -124,6 +177,14 @@ exports.getContent = (type) => {
124 name: '最新速报', 177 name: '最新速报',
125 list: getNewReportFloorData(contentData.list) 178 list: getNewReportFloorData(contentData.list)
126 }; 179 };
  180 +
  181 + data.singlehot = {
  182 + name: '人气单品',
  183 + imgHot: getSingleHotFloorData(contentData.list)
  184 + };
  185 +
  186 + //广告
  187 + data.adbanner = getadbannerData(contentData.list);
127 188
128 189
129 190
@@ -74,7 +74,7 @@ @@ -74,7 +74,7 @@
74 {{! 广告}} 74 {{! 广告}}
75 {{# adbanner}} 75 {{# adbanner}}
76 <div class="floor-ad"> 76 <div class="floor-ad">
77 - <a href="{{href}}" target= "_blank"><img class="lazy" data-original="{{img}}"/></a> 77 + <a href="{{href}}" target= "_blank"><img class="lazy" data-original="{{image img 1150 129}}"/></a>
78 </div> 78 </div>
79 {{/ adbanner}} 79 {{/ adbanner}}
80 80
  1 +<div class="singlehot clearfix">
  2 + {{> index/floor-header}}
  3 + <ul class="g-list imgopacity">
  4 + {{#each imgHot}}
  5 + {{#if @last}}
  6 + <li><a class="impo{{@index}}" href="{{href}}" target= "_blank"><img class="lazy" src="{{image img 378 248}}"/></a></li>
  7 + {{^}}
  8 + <li><a class="impo{{@index}}" href="{{href}}" target= "_blank"><img class="lazy" src="{{image img 185 248}}"/></a></li>
  9 + {{/if}}
  10 + {{/each}}
  11 + </ul>
  12 +</div>
  1 +<div class="floor-header clearfix">
  2 + <h2 class="floor-title">{{name}}</h2>
  3 + {{#if navs}}
  4 + <ul class="header-navs">
  5 + {{# navs}}
  6 + <li data-classify="{{id}}">
  7 + <a target="_blank" href="{{href}}">{{name}}</a>
  8 + </li>
  9 + {{/ navs}}
  10 + </ul>
  11 + {{/if}}
  12 +</div>