Merge branch 'feature/userVip' into 'feature/qps'
个人中心为你优选开关 See merge request !1023
Showing
3 changed files
with
30 additions
and
22 deletions
@@ -4,6 +4,7 @@ const mRoot = '../models'; | @@ -4,6 +4,7 @@ const mRoot = '../models'; | ||
4 | const headerModel = require('../../../doraemon/models/header'); // 头部model | 4 | const headerModel = require('../../../doraemon/models/header'); // 头部model |
5 | const footerModel = require('../../../doraemon/models/footer_tab'); // 底部tab | 5 | const footerModel = require('../../../doraemon/models/footer_tab'); // 底部tab |
6 | const newHomeModel = require(`${mRoot}/new-home`); | 6 | const newHomeModel = require(`${mRoot}/new-home`); |
7 | +const _ = require('lodash'); | ||
7 | 8 | ||
8 | let yhchannels = { | 9 | let yhchannels = { |
9 | '1,3': 1, | 10 | '1,3': 1, |
@@ -46,6 +47,11 @@ exports.index = (req, res, next) => { | @@ -46,6 +47,11 @@ exports.index = (req, res, next) => { | ||
46 | }; | 47 | }; |
47 | 48 | ||
48 | req.ctx(newHomeModel).index(params).then(result => { | 49 | req.ctx(newHomeModel).index(params).then(result => { |
49 | - res.render('new-home', Object.assign(responseData, result)); | 50 | + // 为你优选开关 |
51 | + let recommendHide = _.get(req.app.locals.wap, 'ucenter.removePrefe', false); | ||
52 | + | ||
53 | + res.render('new-home', Object.assign(responseData, result, { | ||
54 | + recommendHide: recommendHide | ||
55 | + })); | ||
50 | }).catch(next); | 56 | }).catch(next); |
51 | }; | 57 | }; |
@@ -161,7 +161,7 @@ | @@ -161,7 +161,7 @@ | ||
161 | {{> content}} | 161 | {{> content}} |
162 | </div> | 162 | </div> |
163 | </div> | 163 | </div> |
164 | - <div id="new-recommend-c"> | 164 | + <div id="new-recommend-c" class="{{#if recommendHide}}hide{{/if}}" data-switch="{{recommendHide}}"> |
165 | <div class="toper"> | 165 | <div class="toper"> |
166 | <div class="title">为你优选</div> | 166 | <div class="title">为你优选</div> |
167 | </div> | 167 | </div> |
@@ -31,27 +31,29 @@ class NewRecommend extends Page { | @@ -31,27 +31,29 @@ class NewRecommend extends Page { | ||
31 | } | 31 | } |
32 | 32 | ||
33 | getRecommend() { | 33 | getRecommend() { |
34 | - this.ajax({ | ||
35 | - url: '/product/new-recommend/getRecommend', | ||
36 | - }).then((result) => { | ||
37 | - if (result) { | ||
38 | - if (result.goods.length > 0) { | ||
39 | - let goodsData = { | ||
40 | - goods: result.goods | ||
41 | - }; | ||
42 | - let $goodsData = $(this.view.goodsRender(goodsData)); | ||
43 | - | ||
44 | - this.selector.$goodsContainer.append($goodsData); | ||
45 | - lazyLoad($goodsData.find('img.lazy')); | ||
46 | - window.rePosFooter(); | ||
47 | - } else { | ||
48 | - this.selector.$recommendC.remove(); | 34 | + if (this.selector.$recommendC.data('switch') !== true) { |
35 | + this.ajax({ | ||
36 | + url: '/product/new-recommend/getRecommend', | ||
37 | + }).then((result) => { | ||
38 | + if (result) { | ||
39 | + if (result.goods.length > 0) { | ||
40 | + let goodsData = { | ||
41 | + goods: result.goods | ||
42 | + }; | ||
43 | + let $goodsData = $(this.view.goodsRender(goodsData)); | ||
44 | + | ||
45 | + this.selector.$goodsContainer.append($goodsData); | ||
46 | + lazyLoad($goodsData.find('img.lazy')); | ||
47 | + window.rePosFooter(); | ||
48 | + } else { | ||
49 | + this.selector.$recommendC.remove(); | ||
50 | + } | ||
49 | } | 51 | } |
50 | - } | ||
51 | - }).catch(error => { | ||
52 | - console.error(error); | ||
53 | - this.selector.$recommendC.remove(); | ||
54 | - }); | 52 | + }).catch(error => { |
53 | + console.error(error); | ||
54 | + this.selector.$recommendC.remove(); | ||
55 | + }); | ||
56 | + } | ||
55 | } | 57 | } |
56 | } | 58 | } |
57 | 59 |
-
Please register or login to post a comment