Authored by OF1706

suggestFeedBack

'use strict';
const helpers = global.yoho.helpers;
const getQuestionnaire = (req, res) => {
let id = req.param || '';
res.redirect(helpers.urlFormat(`/questionnaire/${id}`, null, 'm'));
};
module.exports = {
getQuestionnaire
};
... ...
... ... @@ -16,6 +16,7 @@ const ads = require(`${cRoot}/ads`); // 第三方广告平台对接
const robot = require(`${cRoot}/robot-check`); // 机器人检查
const materialController = require(`${cRoot}/material`);
const activate = require(`${cRoot}/activate`); // 激活点击统计
const questionnaire = require(`${cRoot}/questionnaire`);
router.get('/ads', ads.jump);
router.get('/check', captcha.tryGeetest, robot.index);
... ... @@ -29,5 +30,6 @@ router.get('/material/getRecommendlist', auth, materialController.getRecommendli
router.get('/activate-count', auth, activate.index);
router.get('/activate-count/getList', auth, activate.getList);
router.get('/questionnaire/:id', auth, questionnaire.getQuestionnaire);
module.exports = router;
... ...
... ... @@ -8,13 +8,10 @@
'use strict';
const suggestFeedBackModel = require('../models/suggestFeedBack-service');
const _ = require('lodash');
const getFeedBack = (req, res, next) => {
suggestFeedBackModel.suggestFeedBack().then((result) => {
console.log('result99999999999');
console.log(result);
res.jsonp(result);
}).catch(next);
};
... ...
... ... @@ -6,26 +6,27 @@
'use strict';
const api = require('./suggestFeedBack-api');
const helpers = global.yoho.helpers;
const _ = require('lodash');
const suggestFeedBack = () => {
return api.feedBackApi().then((result) => {
let suggestData = [];
if (result && result.code == 200 && _.get(result, 'data.rows')) {
if (result && result.code === 200 && _.get(result, 'data.rows')) {
if (_.get(result, 'data.rows')) {
_.forEach(_.get(result, 'data.rows', []), it => {
let item = {
description: it.description,
title: it.title,
id: it.id
id: it.id,
url: helpers.urlFormat(`/questionnaire/${it.id}`, null, 'm')
};
suggestData.push(item);
});
}
result = suggestData;
... ...
... ... @@ -19,7 +19,7 @@ module.exports = {
// test3
singleApi: 'http://api-test3.yohops.com:9999/',
api: 'http://api-test3.yohops.com:9999/',
service: 'http://192.168.102.14:8090/',
service: 'http://service-test3.yohops.com:9999/',
serviceNotify: 'http://service-test3.yohops.com:9999/',
global: 'http://global-test-soa.yohops.com:9999/',
... ...
... ... @@ -45,77 +45,6 @@
</p>
</dd>
<dd class="feed-back-box">
<!--<div id="feed-back-box-list" class="foot-panel">-->
<!--<div class="title">-->
<!--<div class="title-line"></div>-->
<!--<div class="text">-->
<!--<span>调研中心</span>-->
<!--</div>-->
<!--</div>-->
<!--<ul class="vote suggest-feed-back clearfix">-->
<!--</ul>-->
<!--&lt;!&ndash;<ul class="vote clearfix">&ndash;&gt;-->
<!--&lt;!&ndash;{{#each suggestData}}&ndash;&gt;-->
<!--&lt;!&ndash;<li key="0">&ndash;&gt;-->
<!--&lt;!&ndash;<form class="feed-back-form" action="#">&ndash;&gt;-->
<!--&lt;!&ndash;<p>{{description}}</p>&ndash;&gt;-->
<!--&lt;!&ndash;<p>{{title}}</p>&ndash;&gt;-->
<!--&lt;!&ndash;<div>&ndash;&gt;-->
<!--&lt;!&ndash;<span class="feed-back-btn button">我要参与</span>&ndash;&gt;-->
<!--&lt;!&ndash;</div>&ndash;&gt;-->
<!--&lt;!&ndash;</form>&ndash;&gt;-->
<!--&lt;!&ndash;</li>&ndash;&gt;-->
<!--&lt;!&ndash;{{/each}}&ndash;&gt;-->
<!--&lt;!&ndash;<li class="hide" key="1">&ndash;&gt;-->
<!--&lt;!&ndash;<form class="feed-back-form" action="#">&ndash;&gt;-->
<!--&lt;!&ndash;<div>您可以方便的找到想查看的内容吗?</div>&ndash;&gt;-->
<!--&lt;!&ndash;<div class="vote-item clearfix">&ndash;&gt;-->
<!--&lt;!&ndash;<p>&ndash;&gt;-->
<!--&lt;!&ndash;<input type="radio" name="solution" value="38">非常方便&ndash;&gt;-->
<!--&lt;!&ndash;</p>&ndash;&gt;-->
<!--&lt;!&ndash;<p>&ndash;&gt;-->
<!--&lt;!&ndash;<input type="radio" name="solution" value="39">方便&ndash;&gt;-->
<!--&lt;!&ndash;</p>&ndash;&gt;-->
<!--&lt;!&ndash;<p>&ndash;&gt;-->
<!--&lt;!&ndash;<input type="radio" name="solution" value="40">一般般&ndash;&gt;-->
<!--&lt;!&ndash;</p>&ndash;&gt;-->
<!--&lt;!&ndash;<p>&ndash;&gt;-->
<!--&lt;!&ndash;<input type="radio" name="solution" value="41">不方便&ndash;&gt;-->
<!--&lt;!&ndash;</p>&ndash;&gt;-->
<!--&lt;!&ndash;<p>&ndash;&gt;-->
<!--&lt;!&ndash;<input type="radio" name="solution" value="42">非常不方便&ndash;&gt;-->
<!--&lt;!&ndash;</p>&ndash;&gt;-->
<!--&lt;!&ndash;</div>&ndash;&gt;-->
<!--&lt;!&ndash;<div>&ndash;&gt;-->
<!--&lt;!&ndash;<span class="feed-back-btn button">提交</span>&ndash;&gt;-->
<!--&lt;!&ndash;</div>&ndash;&gt;-->
<!--&lt;!&ndash;<input class="question-id" type="hidden" value="39">&ndash;&gt;-->
<!--&lt;!&ndash;<input class="feedback-id" type="hidden" value="5">&ndash;&gt;-->
<!--&lt;!&ndash;</form>&ndash;&gt;-->
<!--&lt;!&ndash;</li>&ndash;&gt;-->
<!--&lt;!&ndash;<li class="hide" key="2">&ndash;&gt;-->
<!--&lt;!&ndash;<form class="feed-back-form" action="#">&ndash;&gt;-->
<!--&lt;!&ndash;<div>您对新版还有哪些意见或建议?</div>&ndash;&gt;-->
<!--&lt;!&ndash;<textarea name="answer" id="feedback-answer" class="feedback-answer"></textarea>&ndash;&gt;-->
<!--&lt;!&ndash;<div>&ndash;&gt;-->
<!--&lt;!&ndash;<span class="feed-back-btn button">提交</span>&ndash;&gt;-->
<!--&lt;!&ndash;</div>&ndash;&gt;-->
<!--&lt;!&ndash;<input class="question-id" type="hidden" value="37">&ndash;&gt;-->
<!--&lt;!&ndash;<input class="feedback-id" type="hidden" value="5">&ndash;&gt;-->
<!--&lt;!&ndash;</form>&ndash;&gt;-->
<!--&lt;!&ndash;</li>&ndash;&gt;-->
<!--&lt;!&ndash;<li class="hide" key="3">&ndash;&gt;-->
<!--&lt;!&ndash;<p>调研问卷时间未开始,有货君正在生成调研问卷,<br/>&ndash;&gt;-->
<!--&lt;!&ndash;请您先逛一逛,稍后再来~~&ndash;&gt;-->
<!--&lt;!&ndash;</p>&ndash;&gt;-->
<!--&lt;!&ndash;</li>&ndash;&gt;-->
<!--&lt;!&ndash;</ul>&ndash;&gt;-->
<!--</div>-->
<!--<p id="feed-back-page" class="item-nav center">-->
<!--<span class="iconfont cur">&#xe606;</span>-->
<!--<span class="iconfont ">&#xe606;</span>-->
<!--<span class="iconfont ">&#xe606;</span>-->
<!--</p>-->
</dd>
<dd class="last">
<div class="foot-panel">
... ...
... ... @@ -8,29 +8,30 @@
<ul class="vote clearfix">
{{#if suggestData}}
{{#each suggestData}}
<li key="0">
<li key="{{@index}}" {{#unless @first}}class="hide"{{/unless}}>
<form class="feed-back-form" action="#">
<p>{{description}}</p>
<p class="description">{{description}}</p>
<p>{{title}}</p>
<div>
<span class="feed-back-btn button">我要参与</span>
<a class="feed-back-btn button" href="{{url}}">我要参与</a>
</div>
</form>
</li>
{{/each}}
{{/if}}
{{#unless suggestData}}
<li key="3">
<p class="feed-back-none">调研问卷时间未开始,有货君正在生成调研问卷,<br/>
请您先逛一逛,稍后再来~~
</p>
</li>
{{/unless}}
<li {{#if suggestData}}class="hide"{{/if}}>
<p class="feed-back-none">调研问卷时间未开始,有货君正在生成调研问卷,<br/>
请您先逛一逛,稍后再来~~
</p>
</li>
</ul>
</div>
<p id="feed-back-page" class="item-nav center">
<span class="iconfont cur">&#xe606;</span>
<span class="iconfont ">&#xe606;</span>
<span class="iconfont ">&#xe606;</span>
{{#if suggestData}}
{{#each suggestData}}
<span class="iconfont {{#if @first}}cur{{/if}}">&#xe606;</span>
{{/each}}
{{/if}}
</p>
... ...
... ... @@ -66,10 +66,6 @@ function actionSubscription() {
}
function actionhomeFootChange() {
var $vote = $('.vote'),
$feedBackPage = $('#feed-back-page');
// count = $vote.children('li').length;
var param = {
return_type: 'jsonp',
... ... @@ -78,7 +74,7 @@ function actionhomeFootChange() {
};
// 意见反馈
$feedBackPage.on('click', 'span', function() {
$feedBackBox.on('click', '#feed-back-page span', function() {
var $this = $(this);
if ($this.hasClass('cur')) {
... ... @@ -87,8 +83,7 @@ function actionhomeFootChange() {
$this.siblings('.cur').removeClass('cur');
$this.addClass('cur');
$vote.children().not('.hide').addClass('hide')
$feedBackBox.find('.vote').children('li').not('.hide').addClass('hide')
.end()
.eq($this.index()).removeClass('hide');
});
... ... @@ -98,49 +93,6 @@ function actionhomeFootChange() {
$feedBackBox.html(suggestFeedBackHbs({suggestData: suggestData}));
}
);
// $vote.on('click', '.feed-back-btn', function() {
// var $this = $(this),
// $li = $this.closest('li'),
// index = $li.index(),
// _solution = [];
//
// var _answer = $li.find('.feedback-answer').val(),
// _feedback = $li.find('.feedback-id').val(),
// _question = $li.find('.question-id').val();
//
// $li.find(':checked').each(function() {
// _solution.push($(this).val());
// });
//
// $.ajax({
// url: '//www.yohobuy.com/common/suggestfeedback?callback=?',
// dataType: 'jsonp',
// data: {
// feedback_id: _feedback || 0,
// question_id: _question || 0,
// answer: _answer || '',
// solution: _solution.join(',')
// },
// success: function(data) {
// var next = index + 1;
//
// if (~~data.data.result === 1) {
// if (index === count - 1) {
// alert('感谢您的参与!'); // eslint-disable-line
// return;
// }
//
// $li.addClass('hide');
//
// $vote.children(':eq(' + (index + 1) + ')').removeClass('hide');
// $feedBackPage.children('.cur').removeClass('cur');
// $feedBackPage.children(':eq(' + next + ')').addClass('cur');
// }
// }
// });
// });
}
function rePosReturn() {
... ...
... ... @@ -105,7 +105,7 @@
.button {
height: 24px;
line-height: 24px;
width: 55px;
width: 60px;
font-size: 12px;
margin-top: 11px;
margin-right: 10px;
... ... @@ -122,6 +122,13 @@
text-align: center;
}
.description {
font-size: 12px;
height: 72px;
overflow-x: hidden;
overflow-y: auto;
}
.feed-back-none {
margin-top: 35px;
}
... ...