Authored by 毕凯

Merge branch 'feature/userVip' into 'feature/qps'

个人中心为你优选开关



See merge request !1023
@@ -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,6 +31,7 @@ class NewRecommend extends Page { @@ -31,6 +31,7 @@ class NewRecommend extends Page {
31 } 31 }
32 32
33 getRecommend() { 33 getRecommend() {
  34 + if (this.selector.$recommendC.data('switch') !== true) {
34 this.ajax({ 35 this.ajax({
35 url: '/product/new-recommend/getRecommend', 36 url: '/product/new-recommend/getRecommend',
36 }).then((result) => { 37 }).then((result) => {
@@ -53,6 +54,7 @@ class NewRecommend extends Page { @@ -53,6 +54,7 @@ class NewRecommend extends Page {
53 this.selector.$recommendC.remove(); 54 this.selector.$recommendC.remove();
54 }); 55 });
55 } 56 }
  57 + }
56 } 58 }
57 59
58 $(() => { 60 $(() => {