Authored by OF1706

suggestFeedBack

  1 +'use strict';
  2 +
  3 +const helpers = global.yoho.helpers;
  4 +
  5 +const getQuestionnaire = (req, res) => {
  6 + let id = req.param || '';
  7 +
  8 + res.redirect(helpers.urlFormat(`/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;
@@ -8,13 +8,10 @@ @@ -8,13 +8,10 @@
8 'use strict'; 8 'use strict';
9 9
10 const suggestFeedBackModel = require('../models/suggestFeedBack-service'); 10 const suggestFeedBackModel = require('../models/suggestFeedBack-service');
11 -const _ = require('lodash');  
12 11
13 const getFeedBack = (req, res, next) => { 12 const getFeedBack = (req, res, next) => {
14 13
15 suggestFeedBackModel.suggestFeedBack().then((result) => { 14 suggestFeedBackModel.suggestFeedBack().then((result) => {
16 - console.log('result99999999999');  
17 - console.log(result);  
18 res.jsonp(result); 15 res.jsonp(result);
19 }).catch(next); 16 }).catch(next);
20 }; 17 };
@@ -6,26 +6,27 @@ @@ -6,26 +6,27 @@
6 'use strict'; 6 'use strict';
7 7
8 const api = require('./suggestFeedBack-api'); 8 const api = require('./suggestFeedBack-api');
9 - 9 +const helpers = global.yoho.helpers;
10 const _ = require('lodash'); 10 const _ = require('lodash');
11 11
12 const suggestFeedBack = () => { 12 const suggestFeedBack = () => {
13 13
14 return api.feedBackApi().then((result) => { 14 return api.feedBackApi().then((result) => {
15 let suggestData = []; 15 let suggestData = [];
16 - if (result && result.code == 200 && _.get(result, 'data.rows')) { 16 +
  17 + if (result && result.code === 200 && _.get(result, 'data.rows')) {
17 18
18 if (_.get(result, 'data.rows')) { 19 if (_.get(result, 'data.rows')) {
19 _.forEach(_.get(result, 'data.rows', []), it => { 20 _.forEach(_.get(result, 'data.rows', []), it => {
20 let item = { 21 let item = {
21 description: it.description, 22 description: it.description,
22 title: it.title, 23 title: it.title,
23 - id: it.id 24 + id: it.id,
  25 + url: helpers.urlFormat(`/questionnaire/${it.id}`, null, 'm')
24 }; 26 };
25 27
26 suggestData.push(item); 28 suggestData.push(item);
27 }); 29 });
28 -  
29 } 30 }
30 31
31 result = suggestData; 32 result = suggestData;
@@ -19,7 +19,7 @@ module.exports = { @@ -19,7 +19,7 @@ module.exports = {
19 // test3 19 // test3
20 singleApi: 'http://api-test3.yohops.com:9999/', 20 singleApi: 'http://api-test3.yohops.com:9999/',
21 api: 'http://api-test3.yohops.com:9999/', 21 api: 'http://api-test3.yohops.com:9999/',
22 - service: 'http://192.168.102.14:8090/', 22 + service: 'http://service-test3.yohops.com:9999/',
23 serviceNotify: 'http://service-test3.yohops.com:9999/', 23 serviceNotify: 'http://service-test3.yohops.com:9999/',
24 global: 'http://global-test-soa.yohops.com:9999/', 24 global: 'http://global-test-soa.yohops.com:9999/',
25 25
@@ -45,77 +45,6 @@ @@ -45,77 +45,6 @@
45 </p> 45 </p>
46 </dd> 46 </dd>
47 <dd class="feed-back-box"> 47 <dd class="feed-back-box">
48 - <!--<div id="feed-back-box-list" class="foot-panel">-->  
49 - <!--<div class="title">-->  
50 - <!--<div class="title-line"></div>-->  
51 - <!--<div class="text">-->  
52 - <!--<span>调研中心</span>-->  
53 - <!--</div>-->  
54 - <!--</div>-->  
55 - <!--<ul class="vote suggest-feed-back clearfix">-->  
56 - <!--</ul>-->  
57 - <!--&lt;!&ndash;<ul class="vote clearfix">&ndash;&gt;-->  
58 - <!--&lt;!&ndash;{{#each suggestData}}&ndash;&gt;-->  
59 - <!--&lt;!&ndash;<li key="0">&ndash;&gt;-->  
60 - <!--&lt;!&ndash;<form class="feed-back-form" action="#">&ndash;&gt;-->  
61 - <!--&lt;!&ndash;<p>{{description}}</p>&ndash;&gt;-->  
62 - <!--&lt;!&ndash;<p>{{title}}</p>&ndash;&gt;-->  
63 - <!--&lt;!&ndash;<div>&ndash;&gt;-->  
64 - <!--&lt;!&ndash;<span class="feed-back-btn button">我要参与</span>&ndash;&gt;-->  
65 - <!--&lt;!&ndash;</div>&ndash;&gt;-->  
66 - <!--&lt;!&ndash;</form>&ndash;&gt;-->  
67 - <!--&lt;!&ndash;</li>&ndash;&gt;-->  
68 - <!--&lt;!&ndash;{{/each}}&ndash;&gt;-->  
69 - <!--&lt;!&ndash;<li class="hide" key="1">&ndash;&gt;-->  
70 - <!--&lt;!&ndash;<form class="feed-back-form" action="#">&ndash;&gt;-->  
71 - <!--&lt;!&ndash;<div>您可以方便的找到想查看的内容吗?</div>&ndash;&gt;-->  
72 - <!--&lt;!&ndash;<div class="vote-item clearfix">&ndash;&gt;-->  
73 - <!--&lt;!&ndash;<p>&ndash;&gt;-->  
74 - <!--&lt;!&ndash;<input type="radio" name="solution" value="38">非常方便&ndash;&gt;-->  
75 - <!--&lt;!&ndash;</p>&ndash;&gt;-->  
76 - <!--&lt;!&ndash;<p>&ndash;&gt;-->  
77 - <!--&lt;!&ndash;<input type="radio" name="solution" value="39">方便&ndash;&gt;-->  
78 - <!--&lt;!&ndash;</p>&ndash;&gt;-->  
79 - <!--&lt;!&ndash;<p>&ndash;&gt;-->  
80 - <!--&lt;!&ndash;<input type="radio" name="solution" value="40">一般般&ndash;&gt;-->  
81 - <!--&lt;!&ndash;</p>&ndash;&gt;-->  
82 - <!--&lt;!&ndash;<p>&ndash;&gt;-->  
83 - <!--&lt;!&ndash;<input type="radio" name="solution" value="41">不方便&ndash;&gt;-->  
84 - <!--&lt;!&ndash;</p>&ndash;&gt;-->  
85 - <!--&lt;!&ndash;<p>&ndash;&gt;-->  
86 - <!--&lt;!&ndash;<input type="radio" name="solution" value="42">非常不方便&ndash;&gt;-->  
87 - <!--&lt;!&ndash;</p>&ndash;&gt;-->  
88 - <!--&lt;!&ndash;</div>&ndash;&gt;-->  
89 - <!--&lt;!&ndash;<div>&ndash;&gt;-->  
90 - <!--&lt;!&ndash;<span class="feed-back-btn button">提交</span>&ndash;&gt;-->  
91 - <!--&lt;!&ndash;</div>&ndash;&gt;-->  
92 - <!--&lt;!&ndash;<input class="question-id" type="hidden" value="39">&ndash;&gt;-->  
93 - <!--&lt;!&ndash;<input class="feedback-id" type="hidden" value="5">&ndash;&gt;-->  
94 - <!--&lt;!&ndash;</form>&ndash;&gt;-->  
95 - <!--&lt;!&ndash;</li>&ndash;&gt;-->  
96 - <!--&lt;!&ndash;<li class="hide" key="2">&ndash;&gt;-->  
97 - <!--&lt;!&ndash;<form class="feed-back-form" action="#">&ndash;&gt;-->  
98 - <!--&lt;!&ndash;<div>您对新版还有哪些意见或建议?</div>&ndash;&gt;-->  
99 - <!--&lt;!&ndash;<textarea name="answer" id="feedback-answer" class="feedback-answer"></textarea>&ndash;&gt;-->  
100 - <!--&lt;!&ndash;<div>&ndash;&gt;-->  
101 - <!--&lt;!&ndash;<span class="feed-back-btn button">提交</span>&ndash;&gt;-->  
102 - <!--&lt;!&ndash;</div>&ndash;&gt;-->  
103 - <!--&lt;!&ndash;<input class="question-id" type="hidden" value="37">&ndash;&gt;-->  
104 - <!--&lt;!&ndash;<input class="feedback-id" type="hidden" value="5">&ndash;&gt;-->  
105 - <!--&lt;!&ndash;</form>&ndash;&gt;-->  
106 - <!--&lt;!&ndash;</li>&ndash;&gt;-->  
107 - <!--&lt;!&ndash;<li class="hide" key="3">&ndash;&gt;-->  
108 - <!--&lt;!&ndash;<p>调研问卷时间未开始,有货君正在生成调研问卷,<br/>&ndash;&gt;-->  
109 - <!--&lt;!&ndash;请您先逛一逛,稍后再来~~&ndash;&gt;-->  
110 - <!--&lt;!&ndash;</p>&ndash;&gt;-->  
111 - <!--&lt;!&ndash;</li>&ndash;&gt;-->  
112 - <!--&lt;!&ndash;</ul>&ndash;&gt;-->  
113 - <!--</div>-->  
114 - <!--<p id="feed-back-page" class="item-nav center">-->  
115 - <!--<span class="iconfont cur">&#xe606;</span>-->  
116 - <!--<span class="iconfont ">&#xe606;</span>-->  
117 - <!--<span class="iconfont ">&#xe606;</span>-->  
118 - <!--</p>-->  
119 </dd> 48 </dd>
120 <dd class="last"> 49 <dd class="last">
121 <div class="foot-panel"> 50 <div class="foot-panel">
@@ -8,29 +8,30 @@ @@ -8,29 +8,30 @@
8 <ul class="vote clearfix"> 8 <ul class="vote clearfix">
9 {{#if suggestData}} 9 {{#if suggestData}}
10 {{#each suggestData}} 10 {{#each suggestData}}
11 - <li key="0"> 11 + <li key="{{@index}}" {{#unless @first}}class="hide"{{/unless}}>
12 <form class="feed-back-form" action="#"> 12 <form class="feed-back-form" action="#">
13 - <p>{{description}}</p> 13 + <p class="description">{{description}}</p>
14 <p>{{title}}</p> 14 <p>{{title}}</p>
15 <div> 15 <div>
16 - <span class="feed-back-btn button">我要参与</span> 16 + <a class="feed-back-btn button" href="{{url}}">我要参与</a>
17 </div> 17 </div>
18 </form> 18 </form>
19 </li> 19 </li>
20 {{/each}} 20 {{/each}}
21 {{/if}} 21 {{/if}}
22 - {{#unless suggestData}}  
23 - <li key="3">  
24 - <p class="feed-back-none">调研问卷时间未开始,有货君正在生成调研问卷,<br/>  
25 - 请您先逛一逛,稍后再来~~  
26 - </p>  
27 - </li>  
28 - {{/unless}} 22 +
  23 + <li {{#if suggestData}}class="hide"{{/if}}>
  24 + <p class="feed-back-none">调研问卷时间未开始,有货君正在生成调研问卷,<br/>
  25 + 请您先逛一逛,稍后再来~~
  26 + </p>
  27 + </li>
29 </ul> 28 </ul>
30 </div> 29 </div>
31 <p id="feed-back-page" class="item-nav center"> 30 <p id="feed-back-page" class="item-nav center">
32 - <span class="iconfont cur">&#xe606;</span>  
33 - <span class="iconfont ">&#xe606;</span>  
34 - <span class="iconfont ">&#xe606;</span> 31 +{{#if suggestData}}
  32 + {{#each suggestData}}
  33 + <span class="iconfont {{#if @first}}cur{{/if}}">&#xe606;</span>
  34 + {{/each}}
  35 +{{/if}}
35 </p> 36 </p>
36 37
@@ -66,10 +66,6 @@ function actionSubscription() { @@ -66,10 +66,6 @@ function actionSubscription() {
66 } 66 }
67 67
68 function actionhomeFootChange() { 68 function actionhomeFootChange() {
69 - var $vote = $('.vote'),  
70 - $feedBackPage = $('#feed-back-page');  
71 -  
72 - // count = $vote.children('li').length;  
73 69
74 var param = { 70 var param = {
75 return_type: 'jsonp', 71 return_type: 'jsonp',
@@ -78,7 +74,7 @@ function actionhomeFootChange() { @@ -78,7 +74,7 @@ function actionhomeFootChange() {
78 }; 74 };
79 75
80 // 意见反馈 76 // 意见反馈
81 - $feedBackPage.on('click', 'span', function() { 77 + $feedBackBox.on('click', '#feed-back-page span', function() {
82 var $this = $(this); 78 var $this = $(this);
83 79
84 if ($this.hasClass('cur')) { 80 if ($this.hasClass('cur')) {
@@ -87,8 +83,7 @@ function actionhomeFootChange() { @@ -87,8 +83,7 @@ function actionhomeFootChange() {
87 83
88 $this.siblings('.cur').removeClass('cur'); 84 $this.siblings('.cur').removeClass('cur');
89 $this.addClass('cur'); 85 $this.addClass('cur');
90 -  
91 - $vote.children().not('.hide').addClass('hide') 86 + $feedBackBox.find('.vote').children('li').not('.hide').addClass('hide')
92 .end() 87 .end()
93 .eq($this.index()).removeClass('hide'); 88 .eq($this.index()).removeClass('hide');
94 }); 89 });
@@ -98,49 +93,6 @@ function actionhomeFootChange() { @@ -98,49 +93,6 @@ function actionhomeFootChange() {
98 $feedBackBox.html(suggestFeedBackHbs({suggestData: suggestData})); 93 $feedBackBox.html(suggestFeedBackHbs({suggestData: suggestData}));
99 } 94 }
100 ); 95 );
101 -  
102 -  
103 - // $vote.on('click', '.feed-back-btn', function() {  
104 - // var $this = $(this),  
105 - // $li = $this.closest('li'),  
106 - // index = $li.index(),  
107 - // _solution = [];  
108 - //  
109 - // var _answer = $li.find('.feedback-answer').val(),  
110 - // _feedback = $li.find('.feedback-id').val(),  
111 - // _question = $li.find('.question-id').val();  
112 - //  
113 - // $li.find(':checked').each(function() {  
114 - // _solution.push($(this).val());  
115 - // });  
116 - //  
117 - // $.ajax({  
118 - // url: '//www.yohobuy.com/common/suggestfeedback?callback=?',  
119 - // dataType: 'jsonp',  
120 - // data: {  
121 - // feedback_id: _feedback || 0,  
122 - // question_id: _question || 0,  
123 - // answer: _answer || '',  
124 - // solution: _solution.join(',')  
125 - // },  
126 - // success: function(data) {  
127 - // var next = index + 1;  
128 - //  
129 - // if (~~data.data.result === 1) {  
130 - // if (index === count - 1) {  
131 - // alert('感谢您的参与!'); // eslint-disable-line  
132 - // return;  
133 - // }  
134 - //  
135 - // $li.addClass('hide');  
136 - //  
137 - // $vote.children(':eq(' + (index + 1) + ')').removeClass('hide');  
138 - // $feedBackPage.children('.cur').removeClass('cur');  
139 - // $feedBackPage.children(':eq(' + next + ')').addClass('cur');  
140 - // }  
141 - // }  
142 - // });  
143 - // });  
144 } 96 }
145 97
146 function rePosReturn() { 98 function rePosReturn() {
@@ -105,7 +105,7 @@ @@ -105,7 +105,7 @@
105 .button { 105 .button {
106 height: 24px; 106 height: 24px;
107 line-height: 24px; 107 line-height: 24px;
108 - width: 55px; 108 + width: 60px;
109 font-size: 12px; 109 font-size: 12px;
110 margin-top: 11px; 110 margin-top: 11px;
111 margin-right: 10px; 111 margin-right: 10px;
@@ -122,6 +122,13 @@ @@ -122,6 +122,13 @@
122 text-align: center; 122 text-align: center;
123 } 123 }
124 124
  125 + .description {
  126 + font-size: 12px;
  127 + height: 72px;
  128 + overflow-x: hidden;
  129 + overflow-y: auto;
  130 + }
  131 +
125 .feed-back-none { 132 .feed-back-none {
126 margin-top: 35px; 133 margin-top: 35px;
127 } 134 }