Merge branch 'hotfix/question2.2' into 'gray'
Hotfix/question2.2 question source See merge request !149
Showing
7 changed files
with
38 additions
and
52 deletions
@@ -8,6 +8,11 @@ const getQuestionnaire = (req, res) => { | @@ -8,6 +8,11 @@ const getQuestionnaire = (req, res) => { | ||
8 | res.redirect(helpers.urlFormat(`/3party/questionnaire/${id}`, null, 'm')); | 8 | res.redirect(helpers.urlFormat(`/3party/questionnaire/${id}`, null, 'm')); |
9 | }; | 9 | }; |
10 | 10 | ||
11 | +const getQuestionList = (req, res) => { | ||
12 | + res.redirect(helpers.urlFormat('/3party/questionnaire', null, 'm')); | ||
13 | +}; | ||
14 | + | ||
11 | module.exports = { | 15 | module.exports = { |
12 | - getQuestionnaire | 16 | + getQuestionnaire, |
17 | + getQuestionList | ||
13 | }; | 18 | }; |
@@ -32,4 +32,5 @@ router.get('/material/getRecommendlist', auth, materialController.getRecommendli | @@ -32,4 +32,5 @@ router.get('/material/getRecommendlist', auth, materialController.getRecommendli | ||
32 | router.get('/activate-count', auth, activate.index); | 32 | router.get('/activate-count', auth, activate.index); |
33 | router.get('/activate-count/getList', auth, activate.getList); | 33 | router.get('/activate-count/getList', auth, activate.getList); |
34 | router.get('/questionnaire/:id', auth, questionnaire.getQuestionnaire); | 34 | router.get('/questionnaire/:id', auth, questionnaire.getQuestionnaire); |
35 | +router.get('/questionnaire', auth, questionnaire.getQuestionList); | ||
35 | module.exports = router; | 36 | module.exports = router; |
1 | -/** | ||
2 | - * suggestFeedBack model | ||
3 | - * @author: gxh<xuhui.ge@yoho.cn> | ||
4 | - * @date: 2017/04/06 | ||
5 | - */ | ||
6 | - | ||
7 | -'use strict'; | ||
8 | - | ||
9 | -const service = global.yoho.ServiceAPI; | ||
10 | -const URL_ACTIVITY_QUESTION = '/activity/question/'; | ||
11 | - | ||
12 | -/** | ||
13 | - * 获取用户信息 | ||
14 | - * @param uid | ||
15 | - * @return string | ||
16 | - */ | ||
17 | -const feedBackApi = (uid) => { | ||
18 | - | ||
19 | - return service.get(URL_ACTIVITY_QUESTION + 'questionList', {uid: uid}); | ||
20 | -}; | ||
21 | - | ||
22 | -module.exports = { | ||
23 | - feedBackApi | ||
24 | -}; |
@@ -5,32 +5,27 @@ | @@ -5,32 +5,27 @@ | ||
5 | */ | 5 | */ |
6 | 'use strict'; | 6 | 'use strict'; |
7 | 7 | ||
8 | -const api = require('./suggestFeedBack-api'); | ||
9 | -const helpers = global.yoho.helpers; | 8 | +const api = require('./getBanner'); |
10 | const _ = require('lodash'); | 9 | const _ = require('lodash'); |
11 | 10 | ||
12 | -const suggestFeedBack = (uid) => { | 11 | +const QUESTION_CODE = '1337a9f26f3972060bb2a2ca3aba81fd'; |
13 | 12 | ||
14 | - return api.feedBackApi(uid).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 | - }; | 13 | +const suggestFeedBack = () => { |
14 | + return api.getResource(QUESTION_CODE).then(result => { | ||
15 | + if (result.code === 200) { | ||
16 | + let data = _.dropWhile(_.get(result, 'data', []), o => { | ||
17 | + return o.template_name !== 'single_image'; // 取一张图资源位 | ||
18 | + }); | ||
19 | + let list = []; | ||
27 | 20 | ||
28 | - suggestData.push(item); | 21 | + _.forEach(data, value => { |
22 | + list.push(_.get(value, 'data[0]', '')); | ||
29 | }); | 23 | }); |
30 | - } | 24 | + |
25 | + result.data = _.compact(list); | ||
31 | } | 26 | } |
32 | 27 | ||
33 | - return suggestData; | 28 | + return result; |
34 | }); | 29 | }); |
35 | }; | 30 | }; |
36 | 31 |
@@ -9,13 +9,9 @@ | @@ -9,13 +9,9 @@ | ||
9 | {{#if suggestData}} | 9 | {{#if suggestData}} |
10 | {{#each suggestData}} | 10 | {{#each suggestData}} |
11 | <li key="{{@index}}" {{#unless @first}}class="hide"{{/unless}}> | 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> | 12 | + <a href="{{url}}" class="img-item"> |
13 | + <img src="{{image2 src w=330 h=130}}"> | ||
14 | + </a> | ||
19 | </li> | 15 | </li> |
20 | {{/each}} | 16 | {{/each}} |
21 | {{else}} | 17 | {{else}} |
@@ -90,7 +90,9 @@ function actionhomeFootChange() { | @@ -90,7 +90,9 @@ function actionhomeFootChange() { | ||
90 | 90 | ||
91 | return $.getJSON('//www.yohobuy.com/common/suggestfeedback?callback=?', param, | 91 | return $.getJSON('//www.yohobuy.com/common/suggestfeedback?callback=?', param, |
92 | function(suggestData) { | 92 | function(suggestData) { |
93 | - $feedBackBox.html(suggestFeedBackHbs({suggestData: suggestData})); | 93 | + if (suggestData.code === 200 && suggestData.data.length) { |
94 | + $feedBackBox.html(suggestFeedBackHbs({suggestData: suggestData.data})); | ||
95 | + } | ||
94 | } | 96 | } |
95 | ); | 97 | ); |
96 | } | 98 | } |
@@ -140,6 +140,17 @@ | @@ -140,6 +140,17 @@ | ||
140 | margin: 5px 0 0; | 140 | margin: 5px 0 0; |
141 | resize: none; | 141 | resize: none; |
142 | } | 142 | } |
143 | + | ||
144 | + .img-item { | ||
145 | + display: block; | ||
146 | + width: 100%; | ||
147 | + height: 130px; | ||
148 | + | ||
149 | + img { | ||
150 | + width: 100%; | ||
151 | + height: 100%; | ||
152 | + } | ||
153 | + } | ||
143 | } | 154 | } |
144 | 155 | ||
145 | .vote-item p { | 156 | .vote-item p { |
-
Please register or login to post a comment