Showing
3 changed files
with
14 additions
and
9 deletions
@@ -53,7 +53,8 @@ exports.index = (req, res, next) => { | @@ -53,7 +53,8 @@ exports.index = (req, res, next) => { | ||
53 | title: 'Yoho!Buy 有货', | 53 | title: 'Yoho!Buy 有货', |
54 | searchUrl: helpers.urlFormat('/', null, 'search'), | 54 | searchUrl: helpers.urlFormat('/', null, 'search'), |
55 | pageFooter: true, | 55 | pageFooter: true, |
56 | - channelList: result[0], | 56 | + channelList: result[0].channelList, |
57 | + yohood: result[0].yohood, | ||
57 | background: result[1] | 58 | background: result[1] |
58 | }); | 59 | }); |
59 | }).catch(next); | 60 | }).catch(next); |
@@ -174,18 +174,20 @@ const getChannelList = () => { | @@ -174,18 +174,20 @@ const getChannelList = () => { | ||
174 | if (result && result.code === 200) { | 174 | if (result && result.code === 200) { |
175 | const list = {}; | 175 | const list = {}; |
176 | 176 | ||
177 | + list.channelList = []; | ||
178 | + list.yohood = {}; | ||
177 | result.data.list = camelCase(result.data.list || []); | 179 | result.data.list = camelCase(result.data.list || []); |
178 | 180 | ||
179 | _.forEach(result.data.list, function(item) { | 181 | _.forEach(result.data.list, function(item) { |
180 | - const channel = channelList[item.channelId]; | 182 | + const channel = channelList[item.yhChannel]; |
181 | 183 | ||
182 | if (channel) { | 184 | if (channel) { |
183 | - list[item.channelId] = channelList[item.channelId]; | 185 | + list.channelList.push(channelList[item.yhChannel]); |
184 | } | 186 | } |
185 | 187 | ||
186 | - if (_.toNumber(item.channelId) === 5) { | ||
187 | - list.showYohood = true; | ||
188 | - list.yohoodHref = 'http://yohood.cn'; | 188 | + if (_.toNumber(item.yhChannel) !== 5) { |
189 | + list.yohood.showYohood = true; | ||
190 | + list.yohood.yohoodHref = 'http://yohood.cn'; | ||
189 | } | 191 | } |
190 | }); | 192 | }); |
191 | return Object.keys(list).length ? list : channelList; | 193 | return Object.keys(list).length ? list : channelList; |
@@ -24,9 +24,11 @@ | @@ -24,9 +24,11 @@ | ||
24 | <span class="iconfont right-icon"></span> | 24 | <span class="iconfont right-icon"></span> |
25 | </a> | 25 | </a> |
26 | {{/each}} | 26 | {{/each}} |
27 | - {{#showYohood}} | ||
28 | - <a href="{{yohoodHref}}" id="yohood" class="list-item"> <span class="iconfont right-icon"></span></a> | ||
29 | - {{/showYohood}} | 27 | + {{#yohood}} |
28 | + {{#if showYohood}} | ||
29 | + <a href="{{yohoodHref}}" id="yohood" class="list-item"> <span class="iconfont right-icon"></span></a> | ||
30 | + {{/if}} | ||
31 | + {{/yohood}} | ||
30 | </div> | 32 | </div> |
31 | </div> | 33 | </div> |
32 | </div> | 34 | </div> |
-
Please register or login to post a comment