Authored by OF1706

Merge branch 'feature/guangDev' of http://git.yoho.cn/fe/yohobuy-node into feature/guangDev

  1 +'use strict';
  2 +
  3 +const helpers = global.yoho.helpers;
  4 +
  5 +const getQuestionnaire = (req, res) => {
  6 + let id = req.params.id || '';
  7 +
  8 + res.redirect(helpers.urlFormat(`/3party/questionnaire/${id}`, null, 'm'));
  9 +};
  10 +
  11 +module.exports = {
  12 + getQuestionnaire
  13 +};
@@ -16,6 +16,7 @@ const ads = require(`${cRoot}/ads`); // 第三方广告平台对接 @@ -16,6 +16,7 @@ const ads = require(`${cRoot}/ads`); // 第三方广告平台对接
16 const robot = require(`${cRoot}/robot-check`); // 机器人检查 16 const robot = require(`${cRoot}/robot-check`); // 机器人检查
17 const materialController = require(`${cRoot}/material`); 17 const materialController = require(`${cRoot}/material`);
18 const activate = require(`${cRoot}/activate`); // 激活点击统计 18 const activate = require(`${cRoot}/activate`); // 激活点击统计
  19 +const questionnaire = require(`${cRoot}/questionnaire`);
19 20
20 router.get('/ads', ads.jump); 21 router.get('/ads', ads.jump);
21 router.get('/check', captcha.tryGeetest, robot.index); 22 router.get('/check', captcha.tryGeetest, robot.index);
@@ -29,5 +30,6 @@ router.get('/material/getRecommendlist', auth, materialController.getRecommendli @@ -29,5 +30,6 @@ router.get('/material/getRecommendlist', auth, materialController.getRecommendli
29 30
30 router.get('/activate-count', auth, activate.index); 31 router.get('/activate-count', auth, activate.index);
31 router.get('/activate-count/getList', auth, activate.getList); 32 router.get('/activate-count/getList', auth, activate.getList);
  33 +router.get('/questionnaire/:id', auth, questionnaire.getQuestionnaire);
32 34
33 module.exports = router; 35 module.exports = router;
@@ -7,34 +7,13 @@ @@ -7,34 +7,13 @@
7 7
8 'use strict'; 8 'use strict';
9 9
10 -const suggestFeedBackModel = require('../models/suggestFeedBack');  
11 -const _ = require('lodash'); 10 +const suggestFeedBackModel = require('../models/suggestFeedBack-service');
12 11
13 const getFeedBack = (req, res, next) => { 12 const getFeedBack = (req, res, next) => {
14 13
15 - let feedbackId = req.query.feedback_id || 0;  
16 - let questionId = req.query.question_id || 0;  
17 - let answer = _.trim(req.query.answer) || '';  
18 - let solution = req.query.solution || 0;  
19 -  
20 - if (!feedbackId || !questionId || !answer || !solution) {  
21 -  
22 - suggestFeedBackModel.feedBackApi(feedbackId, questionId, answer, solution).then((result) => {  
23 -  
24 - return res.jsonp({  
25 - code: 200,  
26 - data: result.data,  
27 - message: 'success'  
28 - });  
29 -  
30 - }).catch(next);  
31 -  
32 - } else {  
33 - return res.status(403).send({  
34 - message: '意见反馈失败'  
35 - });  
36 - }  
37 - 14 + suggestFeedBackModel.suggestFeedBack().then((result) => {
  15 + res.jsonp(result);
  16 + }).catch(next);
38 }; 17 };
39 18
40 module.exports = { 19 module.exports = {
@@ -6,24 +6,17 @@ @@ -6,24 +6,17 @@
6 6
7 'use strict'; 7 'use strict';
8 8
9 -const api = global.yoho.API;  
10 -const config = global.yoho.config; 9 +const service = global.yoho.ServiceAPI;
  10 +const URL_ACTIVITY_QUESTION = '/activity/question/';
11 11
12 /** 12 /**
13 * 获取用户信息 13 * 获取用户信息
14 * @param uid 14 * @param uid
15 * @return string 15 * @return string
16 */ 16 */
17 -const feedBackApi = (feedbackId, questionId, answer, solution) => {  
18 - let params = {  
19 - method: 'open.feedback.submit',  
20 - feedback_id: feedbackId,  
21 - question_id: questionId,  
22 - answer: answer,  
23 - solution: solution  
24 - }; 17 +const feedBackApi = () => {
25 18
26 - return api.get('', params, config.apiCache); 19 + return service.get(URL_ACTIVITY_QUESTION + 'questionList', {});
27 }; 20 };
28 21
29 module.exports = { 22 module.exports = {
  1 +/**
  2 + * suggestFeedBack model
  3 + * @author: gxh<xuhui.ge@yoho.cn>
  4 + * @date: 2017/05/25
  5 + */
  6 +'use strict';
  7 +
  8 +const api = require('./suggestFeedBack-api');
  9 +const helpers = global.yoho.helpers;
  10 +const _ = require('lodash');
  11 +
  12 +const suggestFeedBack = () => {
  13 +
  14 + return api.feedBackApi().then((result) => {
  15 + let suggestData = [];
  16 +
  17 + if (result && result.code === 200 && _.get(result, 'data.rows')) {
  18 +
  19 + if (_.get(result, 'data.rows')) {
  20 + _.forEach(_.get(result, 'data.rows', []), it => {
  21 + let item = {
  22 + description: it.description,
  23 + title: it.title,
  24 + id: it.id,
  25 + url: helpers.urlFormat(`/3party/questionnaire/${it.id}`, null)
  26 + };
  27 +
  28 + suggestData.push(item);
  29 + });
  30 + }
  31 + }
  32 +
  33 + return suggestData;
  34 + });
  35 +};
  36 +
  37 +module.exports = {
  38 + suggestFeedBack
  39 +};
@@ -307,7 +307,7 @@ exports.detail = (req, res, next) => { @@ -307,7 +307,7 @@ exports.detail = (req, res, next) => {
307 commentFirstPageUrl: '?pageSize=10' 307 commentFirstPageUrl: '?pageSize=10'
308 } 308 }
309 }, { 309 }, {
310 - title: `${info.title} | YOHO!BUY有货 | 年轻人潮流购物中心,中国潮流购物风向标,官方授权正品保证`, 310 + title: `${info.title} | YOHO!BUY有货`,
311 keywords: info.tag.length > 0 ? `${info.tag}` : 311 keywords: info.tag.length > 0 ? `${info.tag}` :
312 ['Yoho! 有货,潮流,时尚,流行,购物,B2C,正品,购物网站,网上购物,货到付款,品牌服饰,男士护肤,', 312 ['Yoho! 有货,潮流,时尚,流行,购物,B2C,正品,购物网站,网上购物,货到付款,品牌服饰,男士护肤,',
313 '黑框眼镜,匡威,板鞋,i.t,izzue,5cm,eastpak,vans,lylescott,g-shock,new balance,lacoste,melissa,', 313 '黑框眼镜,匡威,板鞋,i.t,izzue,5cm,eastpak,vans,lylescott,g-shock,new balance,lacoste,melissa,',
@@ -74,7 +74,7 @@ @@ -74,7 +74,7 @@
74 <select class="exchange-color" {{#if isLimitSkn}}disabled{{/if}}> 74 <select class="exchange-color" {{#if isLimitSkn}}disabled{{/if}}>
75 <option value="0">请选择颜色</option> 75 <option value="0">请选择颜色</option>
76 {{# colorSize}} 76 {{# colorSize}}
77 - <option value="{{skc}}">{{color}}</option> 77 + <option value="{{skc}}" data-goodsid="{{goodsId}}">{{color}}</option>
78 {{/ colorSize}} 78 {{/ colorSize}}
79 </select> 79 </select>
80 {{# colorSize}} 80 {{# colorSize}}
@@ -11,7 +11,7 @@ const isTest = process.env.NODE_ENV === 'test'; @@ -11,7 +11,7 @@ const isTest = process.env.NODE_ENV === 'test';
11 11
12 module.exports = { 12 module.exports = {
13 app: 'web', 13 app: 'web',
14 - appVersion: '5.7.0', // 调用api的版本 14 + appVersion: '5.7.1', // 调用api的版本
15 port: 6002, 15 port: 6002,
16 siteUrl: 'http://www.yohobuy.com', 16 siteUrl: 'http://www.yohobuy.com',
17 cookieDomain: '.yohobuy.com', 17 cookieDomain: '.yohobuy.com',
@@ -60,3 +60,19 @@ var _gaq = _gaq || []; @@ -60,3 +60,19 @@ var _gaq = _gaq || [];
60 s.parentNode.insertBefore(bp, s); 60 s.parentNode.insertBefore(bp, s);
61 })(); 61 })();
62 </script> 62 </script>
  63 +<!-- 品众统计 -->
  64 +<script type='text/javascript'>
  65 + var _fxcmd=_fxcmd||[];
  66 + _fxcmd.sid='bb3b16fa1106a6ab8619da0095755f32';
  67 + _fxcmd.trackAll=false;
  68 + // 参数配置(可选)...
  69 + // 追踪配置(可选)...
  70 + (function () {
  71 + var _pzfx=document['createElement']('script');
  72 + _pzfx.type='text/javascript';
  73 + _pzfx.async=true;
  74 + _pzfx.src='//static.w3t.cn/fx/1/1/fx.js';
  75 + var sc=document.getElementsByTagName('script')[0];
  76 + sc.parentNode.insertBefore(_pzfx,sc);
  77 + })();
  78 +</script>
@@ -44,86 +44,24 @@ @@ -44,86 +44,24 @@
44 <span class="iconfont cur" key="0">&#xe606;</span> 44 <span class="iconfont cur" key="0">&#xe606;</span>
45 </p> 45 </p>
46 </dd> 46 </dd>
47 - <dd> 47 + <dd class="feed-back-box">
48 <div id="feed-back-box-list" class="foot-panel"> 48 <div id="feed-back-box-list" class="foot-panel">
49 <div class="title"> 49 <div class="title">
50 <div class="title-line"></div> 50 <div class="title-line"></div>
51 <div class="text"> 51 <div class="text">
52 - <span>意见反馈</span> 52 + <span>调研中心</span>
53 </div> 53 </div>
54 </div> 54 </div>
55 <ul class="vote clearfix"> 55 <ul class="vote clearfix">
56 - <li key="0">  
57 - <form class="feed-back-form" action="#">  
58 - <div>您喜欢有货的新版吗?</div>  
59 - <div class="vote-item clearfix">  
60 - <p>  
61 - <input type="radio" name="solution" value="33">非常喜欢  
62 - </p>  
63 - <p>  
64 - <input type="radio" name="solution" value="34">喜欢  
65 - </p>  
66 - <p>  
67 - <input type="radio" name="solution" value="35">一般般  
68 - </p>  
69 - <p>  
70 - <input type="radio" name="solution" value="36">不喜欢  
71 - </p>  
72 - <p>  
73 - <input type="radio" name="solution" value="37">非常不喜欢  
74 - </p>  
75 - </div>  
76 - <div>  
77 - <span class="feed-back-btn button">提交</span>  
78 - </div>  
79 - <input class="question-id" type="hidden" name="question_id" value="38">  
80 - <input class="feedback-id" type="hidden" name="feedback_id" value="5">  
81 - </form>  
82 - </li>  
83 - <li class="hide" key="1">  
84 - <form class="feed-back-form" action="#">  
85 - <div>您可以方便的找到想查看的内容吗?</div>  
86 - <div class="vote-item clearfix">  
87 - <p>  
88 - <input type="radio" name="solution" value="38">非常方便  
89 - </p>  
90 - <p>  
91 - <input type="radio" name="solution" value="39">方便  
92 - </p>  
93 - <p>  
94 - <input type="radio" name="solution" value="40">一般般  
95 - </p>  
96 - <p>  
97 - <input type="radio" name="solution" value="41">不方便  
98 - </p>  
99 - <p>  
100 - <input type="radio" name="solution" value="42">非常不方便  
101 - </p>  
102 - </div>  
103 - <div>  
104 - <span class="feed-back-btn button">提交</span>  
105 - </div>  
106 - <input class="question-id" type="hidden" value="39">  
107 - <input class="feedback-id" type="hidden" value="5">  
108 - </form>  
109 - </li>  
110 - <li class="hide" key="2">  
111 - <form class="feed-back-form" action="#">  
112 - <div>您对新版还有哪些意见或建议?</div>  
113 - <textarea name="answer" id="feedback-answer" class="feedback-answer"></textarea>  
114 - <div>  
115 - <span class="feed-back-btn button">提交</span>  
116 - </div>  
117 - <input class="question-id" type="hidden" value="37">  
118 - <input class="feedback-id" type="hidden" value="5">  
119 - </form> 56 + <li>
  57 + <p class="feed-back-none">调研问卷时间未开始,有货君正在生成调研问卷,<br/>
  58 + 请您先逛一逛,稍后再来~~
  59 + </p>
120 </li> 60 </li>
121 </ul> 61 </ul>
122 </div> 62 </div>
123 <p id="feed-back-page" class="item-nav center"> 63 <p id="feed-back-page" class="item-nav center">
124 <span class="iconfont cur">&#xe606;</span> 64 <span class="iconfont cur">&#xe606;</span>
125 - <span class="iconfont ">&#xe606;</span>  
126 - <span class="iconfont ">&#xe606;</span>  
127 </p> 65 </p>
128 </dd> 66 </dd>
129 <dd class="last"> 67 <dd class="last">
1 { 1 {
2 "name": "yohobuy-node", 2 "name": "yohobuy-node",
3 - "version": "5.6.17", 3 + "version": "5.7.1",
4 "private": true, 4 "private": true,
5 "description": "A New Yohobuy Project With Express", 5 "description": "A New Yohobuy Project With Express",
6 "repository": { 6 "repository": {
  1 +<div id="feed-back-box-list" class="foot-panel">
  2 + <div class="title">
  3 + <div class="title-line"></div>
  4 + <div class="text">
  5 + <span>调研中心</span>
  6 + </div>
  7 + </div>
  8 + <ul class="vote clearfix">
  9 + {{#if suggestData}}
  10 + {{#each suggestData}}
  11 + <li key="{{@index}}" {{#unless @first}}class="hide"{{/unless}}>
  12 + <form class="feed-back-form" action="#">
  13 + <p class="description">{{description}}</p>
  14 + <p>{{title}}</p>
  15 + <div>
  16 + <a class="feed-back-btn button" href="{{url}}">我要参与</a>
  17 + </div>
  18 + </form>
  19 + </li>
  20 + {{/each}}
  21 + {{else}}
  22 + <li>
  23 + <p class="feed-back-none">调研问卷时间未开始,有货君正在生成调研问卷,<br/>
  24 + 请您先逛一逛,稍后再来~~
  25 + </p>
  26 + </li>
  27 + {{/if}}
  28 + </ul>
  29 +</div>
  30 +<p id="feed-back-page" class="item-nav center">
  31 +{{#if suggestData}}
  32 + {{#each suggestData}}
  33 + <span class="iconfont {{#if @first}}cur{{/if}}">&#xe606;</span>
  34 + {{/each}}
  35 + {{else}}
  36 + <span class="iconfont cur">&#xe606;</span>
  37 +{{/if}}
  38 +</p>
  39 +
@@ -747,7 +747,7 @@ $('#order-submit').click(function() { @@ -747,7 +747,7 @@ $('#order-submit').click(function() {
747 url: '/cart/ensure/submit', 747 url: '/cart/ensure/submit',
748 data: order 748 data: order
749 }).then(function(data) { 749 }).then(function(data) {
750 - var rdata, subTip, 750 + var rdata, subTip, newUser,
751 tongJi = { 751 tongJi = {
752 num: 0, 752 num: 0,
753 skn: [], 753 skn: [],
@@ -815,6 +815,19 @@ $('#order-submit').click(function() { @@ -815,6 +815,19 @@ $('#order-submit').click(function() {
815 }).track('MC.ROh.yqkx8jgGASmo3McexF7XE0'); 815 }).track('MC.ROh.yqkx8jgGASmo3McexF7XE0');
816 } 816 }
817 817
  818 + // 品众统计
  819 + if (window._fxcmd) {
  820 + newUser = window.cookie('__NEW_USER') || 0;
  821 +
  822 + window._fxcmd.push(['trackOrder', {
  823 + oid: rdata.order_code,
  824 + otp: rdata.order_amount,
  825 + u_info: window.getUid(),
  826 + u_type: newUser
  827 + }, []]);
  828 + window.setCookie('__NEW_USER', 0);
  829 + }
  830 +
818 location.href = rdata.url; 831 location.href = rdata.url;
819 } 832 }
820 } else if (data.message) { 833 } else if (data.message) {
@@ -829,9 +842,8 @@ multiPackage.init(); @@ -829,9 +842,8 @@ multiPackage.init();
829 coupon.init(); 842 coupon.init();
830 yohoCoin.init(); 843 yohoCoin.init();
831 844
832 -// 删除品众统计 2017-4-24  
833 // 获取用户是否新客(品众统计)写cookie 845 // 获取用户是否新客(品众统计)写cookie
834 -// $.ajax({type: 'GET', url: '/home/newuser'}); 846 +$.ajax({type: 'GET', url: '/home/newuser'});
835 847
836 // 订单确认页默认埋点 848 // 订单确认页默认埋点
837 yas.givePoint('YB_SC_ORDER_ENSURE'); 849 yas.givePoint('YB_SC_ORDER_ENSURE');
@@ -10,6 +10,8 @@ var $ = require('yoho-jquery'), @@ -10,6 +10,8 @@ var $ = require('yoho-jquery'),
10 var $returnTop = $('.return-top'); 10 var $returnTop = $('.return-top');
11 var $qrcodeHoverBox = $('.qrcode-hover-box'); 11 var $qrcodeHoverBox = $('.qrcode-hover-box');
12 var $rightFloatingLayer = $('.right-floating-layer'); 12 var $rightFloatingLayer = $('.right-floating-layer');
  13 +var suggestFeedBackHbs = require('hbs/common/suggest-feed-back.hbs');
  14 +var $feedBackBox = $('.feed-back-box');
13 15
14 lazyLoad($('img.lazy')); 16 lazyLoad($('img.lazy'));
15 17
@@ -64,12 +66,15 @@ function actionSubscription() { @@ -64,12 +66,15 @@ function actionSubscription() {
64 } 66 }
65 67
66 function actionhomeFootChange() { 68 function actionhomeFootChange() {
67 - var $vote = $('.vote'),  
68 - $feedBackPage = $('#feed-back-page'),  
69 - count = $vote.children('li').length; 69 +
  70 + var param = {
  71 + return_type: 'jsonp',
  72 + client_secret: 'web',
  73 + code: 200
  74 + };
70 75
71 // 意见反馈 76 // 意见反馈
72 - $feedBackPage.on('click', 'span', function() { 77 + $feedBackBox.on('click', '#feed-back-page span', function() {
73 var $this = $(this); 78 var $this = $(this);
74 79
75 if ($this.hasClass('cur')) { 80 if ($this.hasClass('cur')) {
@@ -78,53 +83,16 @@ function actionhomeFootChange() { @@ -78,53 +83,16 @@ function actionhomeFootChange() {
78 83
79 $this.siblings('.cur').removeClass('cur'); 84 $this.siblings('.cur').removeClass('cur');
80 $this.addClass('cur'); 85 $this.addClass('cur');
81 -  
82 - $vote.children().not('.hide').addClass('hide') 86 + $feedBackBox.find('.vote').children('li').not('.hide').addClass('hide')
83 .end() 87 .end()
84 .eq($this.index()).removeClass('hide'); 88 .eq($this.index()).removeClass('hide');
85 }); 89 });
86 90
87 - $vote.on('click', '.feed-back-btn', function() {  
88 - var $this = $(this),  
89 - $li = $this.closest('li'),  
90 - index = $li.index(),  
91 - _solution = [];  
92 -  
93 - var _answer = $li.find('.feedback-answer').val(),  
94 - _feedback = $li.find('.feedback-id').val(),  
95 - _question = $li.find('.question-id').val();  
96 -  
97 - $li.find(':checked').each(function() {  
98 - _solution.push($(this).val());  
99 - });  
100 -  
101 - $.ajax({  
102 - url: '//new.yohobuy.com/common/suggestfeedback',  
103 - dataType: 'jsonp',  
104 - data: {  
105 - feedback_id: _feedback || 0,  
106 - question_id: _question || 0,  
107 - answer: _answer || '',  
108 - solution: _solution.join(',')  
109 - },  
110 - success: function(data) {  
111 - var next = index + 1;  
112 -  
113 - if (~~data.data.result === 1) {  
114 - if (index === count - 1) {  
115 - alert('感谢您的参与!'); // eslint-disable-line  
116 - return;  
117 - }  
118 -  
119 - $li.addClass('hide');  
120 -  
121 - $vote.children(':eq(' + (index + 1) + ')').removeClass('hide');  
122 - $feedBackPage.children('.cur').removeClass('cur');  
123 - $feedBackPage.children(':eq(' + next + ')').addClass('cur');  
124 - }  
125 - }  
126 - });  
127 - }); 91 + return $.getJSON('//www.yohobuy.com/common/suggestfeedback?callback=?', param,
  92 + function(suggestData) {
  93 + $feedBackBox.html(suggestFeedBackHbs({suggestData: suggestData}));
  94 + }
  95 + );
128 } 96 }
129 97
130 function rePosReturn() { 98 function rePosReturn() {
@@ -362,7 +362,7 @@ function packGoogsList() { @@ -362,7 +362,7 @@ function packGoogsList() {
362 $checkBox.each(function() { 362 $checkBox.each(function() {
363 var $par = $(this).parent().parent(), 363 var $par = $(this).parent().parent(),
364 $next = $par.next(), 364 $next = $par.next(),
365 - goodsInfo; 365 + goodsInfo, cskc;
366 366
367 if (verifyTip.length) { 367 if (verifyTip.length) {
368 return; 368 return;
@@ -382,9 +382,16 @@ function packGoogsList() { @@ -382,9 +382,16 @@ function packGoogsList() {
382 goodsInfo.returned_reason = goodsInfo.reason; 382 goodsInfo.returned_reason = goodsInfo.reason;
383 } else { 383 } else {
384 goodsInfo.exchange_reason = goodsInfo.reason; 384 goodsInfo.exchange_reason = goodsInfo.reason;
385 - goodsInfo.new_goods_id = $par.find('.exchange-color').val() * 1;  
386 goodsInfo.new_product_sku = $par.find('.exchange-size').val() * 1; 385 goodsInfo.new_product_sku = $par.find('.exchange-size').val() * 1;
387 386
  387 + cskc = $par.find('.exchange-color').val() * 1;
  388 +
  389 + $par.find('.exchange-color').children().each(function() {
  390 + if (cskc === +$(this).attr('value')) {
  391 + goodsInfo.new_goods_id = $(this).data('goodsid');
  392 + }
  393 + });
  394 +
388 if (!verifyTip && !goodsInfo.new_goods_id) { 395 if (!verifyTip && !goodsInfo.new_goods_id) {
389 verifyTip = '请选择要换的颜色'; 396 verifyTip = '请选择要换的颜色';
390 } 397 }
@@ -45,6 +45,7 @@ @@ -45,6 +45,7 @@
45 .foot-panel { 45 .foot-panel {
46 background: #fff; 46 background: #fff;
47 padding: 20px; 47 padding: 20px;
  48 + min-height: 207px;
48 } 49 }
49 50
50 .title { 51 .title {
@@ -75,6 +76,10 @@ @@ -75,6 +76,10 @@
75 } 76 }
76 } 77 }
77 78
  79 + .feed-back-form {
  80 + text-align: center;
  81 + }
  82 +
78 .item-nav { 83 .item-nav {
79 padding-top: 20px; 84 padding-top: 20px;
80 85
@@ -100,7 +105,7 @@ @@ -100,7 +105,7 @@
100 .button { 105 .button {
101 height: 24px; 106 height: 24px;
102 line-height: 24px; 107 line-height: 24px;
103 - width: 55px; 108 + width: 60px;
104 font-size: 12px; 109 font-size: 12px;
105 margin-top: 11px; 110 margin-top: 11px;
106 margin-right: 10px; 111 margin-right: 10px;
@@ -112,8 +117,20 @@ @@ -112,8 +117,20 @@
112 } 117 }
113 118
114 p { 119 p {
115 - height: 24px;  
116 - overflow: hidden; 120 + font-size: 14px;
  121 + line-height: 24px;
  122 + text-align: center;
  123 + }
  124 +
  125 + .description {
  126 + font-size: 12px;
  127 + height: 72px;
  128 + overflow-x: hidden;
  129 + overflow-y: auto;
  130 + }
  131 +
  132 + .feed-back-none {
  133 + margin-top: 35px;
117 } 134 }
118 135
119 textarea { 136 textarea {