Authored by OF1706

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

'use strict';
const helpers = global.yoho.helpers;
const getQuestionnaire = (req, res) => {
let id = req.params.id || '';
res.redirect(helpers.urlFormat(`/3party/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;
... ...
... ... @@ -7,34 +7,13 @@
'use strict';
const suggestFeedBackModel = require('../models/suggestFeedBack');
const _ = require('lodash');
const suggestFeedBackModel = require('../models/suggestFeedBack-service');
const getFeedBack = (req, res, next) => {
let feedbackId = req.query.feedback_id || 0;
let questionId = req.query.question_id || 0;
let answer = _.trim(req.query.answer) || '';
let solution = req.query.solution || 0;
if (!feedbackId || !questionId || !answer || !solution) {
suggestFeedBackModel.feedBackApi(feedbackId, questionId, answer, solution).then((result) => {
return res.jsonp({
code: 200,
data: result.data,
message: 'success'
});
}).catch(next);
} else {
return res.status(403).send({
message: '意见反馈失败'
});
}
suggestFeedBackModel.suggestFeedBack().then((result) => {
res.jsonp(result);
}).catch(next);
};
module.exports = {
... ...
... ... @@ -6,24 +6,17 @@
'use strict';
const api = global.yoho.API;
const config = global.yoho.config;
const service = global.yoho.ServiceAPI;
const URL_ACTIVITY_QUESTION = '/activity/question/';
/**
* 获取用户信息
* @param uid
* @return string
*/
const feedBackApi = (feedbackId, questionId, answer, solution) => {
let params = {
method: 'open.feedback.submit',
feedback_id: feedbackId,
question_id: questionId,
answer: answer,
solution: solution
};
const feedBackApi = () => {
return api.get('', params, config.apiCache);
return service.get(URL_ACTIVITY_QUESTION + 'questionList', {});
};
module.exports = {
... ...
/**
* suggestFeedBack model
* @author: gxh<xuhui.ge@yoho.cn>
* @date: 2017/05/25
*/
'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 (_.get(result, 'data.rows')) {
_.forEach(_.get(result, 'data.rows', []), it => {
let item = {
description: it.description,
title: it.title,
id: it.id,
url: helpers.urlFormat(`/3party/questionnaire/${it.id}`, null)
};
suggestData.push(item);
});
}
}
return suggestData;
});
};
module.exports = {
suggestFeedBack
};
... ...
... ... @@ -307,7 +307,7 @@ exports.detail = (req, res, next) => {
commentFirstPageUrl: '?pageSize=10'
}
}, {
title: `${info.title} | YOHO!BUY有货 | 年轻人潮流购物中心,中国潮流购物风向标,官方授权正品保证`,
title: `${info.title} | YOHO!BUY有货`,
keywords: info.tag.length > 0 ? `${info.tag}` :
['Yoho! 有货,潮流,时尚,流行,购物,B2C,正品,购物网站,网上购物,货到付款,品牌服饰,男士护肤,',
'黑框眼镜,匡威,板鞋,i.t,izzue,5cm,eastpak,vans,lylescott,g-shock,new balance,lacoste,melissa,',
... ...
... ... @@ -74,7 +74,7 @@
<select class="exchange-color" {{#if isLimitSkn}}disabled{{/if}}>
<option value="0">请选择颜色</option>
{{# colorSize}}
<option value="{{skc}}">{{color}}</option>
<option value="{{skc}}" data-goodsid="{{goodsId}}">{{color}}</option>
{{/ colorSize}}
</select>
{{# colorSize}}
... ...
... ... @@ -11,7 +11,7 @@ const isTest = process.env.NODE_ENV === 'test';
module.exports = {
app: 'web',
appVersion: '5.7.0', // 调用api的版本
appVersion: '5.7.1', // 调用api的版本
port: 6002,
siteUrl: 'http://www.yohobuy.com',
cookieDomain: '.yohobuy.com',
... ...
... ... @@ -60,3 +60,19 @@ var _gaq = _gaq || [];
s.parentNode.insertBefore(bp, s);
})();
</script>
<!-- 品众统计 -->
<script type='text/javascript'>
var _fxcmd=_fxcmd||[];
_fxcmd.sid='bb3b16fa1106a6ab8619da0095755f32';
_fxcmd.trackAll=false;
// 参数配置(可选)...
// 追踪配置(可选)...
(function () {
var _pzfx=document['createElement']('script');
_pzfx.type='text/javascript';
_pzfx.async=true;
_pzfx.src='//static.w3t.cn/fx/1/1/fx.js';
var sc=document.getElementsByTagName('script')[0];
sc.parentNode.insertBefore(_pzfx,sc);
})();
</script>
... ...
... ... @@ -44,86 +44,24 @@
<span class="iconfont cur" key="0">&#xe606;</span>
</p>
</dd>
<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>
<span>调研中心</span>
</div>
</div>
<ul class="vote clearfix">
<li key="0">
<form class="feed-back-form" action="#">
<div>您喜欢有货的新版吗?</div>
<div class="vote-item clearfix">
<p>
<input type="radio" name="solution" value="33">非常喜欢
</p>
<p>
<input type="radio" name="solution" value="34">喜欢
</p>
<p>
<input type="radio" name="solution" value="35">一般般
</p>
<p>
<input type="radio" name="solution" value="36">不喜欢
</p>
<p>
<input type="radio" name="solution" value="37">非常不喜欢
</p>
</div>
<div>
<span class="feed-back-btn button">提交</span>
</div>
<input class="question-id" type="hidden" name="question_id" value="38">
<input class="feedback-id" type="hidden" name="feedback_id" value="5">
</form>
</li>
<li class="hide" key="1">
<form class="feed-back-form" action="#">
<div>您可以方便的找到想查看的内容吗?</div>
<div class="vote-item clearfix">
<p>
<input type="radio" name="solution" value="38">非常方便
</p>
<p>
<input type="radio" name="solution" value="39">方便
</p>
<p>
<input type="radio" name="solution" value="40">一般般
</p>
<p>
<input type="radio" name="solution" value="41">不方便
</p>
<p>
<input type="radio" name="solution" value="42">非常不方便
</p>
</div>
<div>
<span class="feed-back-btn button">提交</span>
</div>
<input class="question-id" type="hidden" value="39">
<input class="feedback-id" type="hidden" value="5">
</form>
</li>
<li class="hide" key="2">
<form class="feed-back-form" action="#">
<div>您对新版还有哪些意见或建议?</div>
<textarea name="answer" id="feedback-answer" class="feedback-answer"></textarea>
<div>
<span class="feed-back-btn button">提交</span>
</div>
<input class="question-id" type="hidden" value="37">
<input class="feedback-id" type="hidden" value="5">
</form>
<li>
<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>
</p>
</dd>
<dd class="last">
... ...
{
"name": "yohobuy-node",
"version": "5.6.17",
"version": "5.7.1",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ...
<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 clearfix">
{{#if suggestData}}
{{#each suggestData}}
<li key="{{@index}}" {{#unless @first}}class="hide"{{/unless}}>
<form class="feed-back-form" action="#">
<p class="description">{{description}}</p>
<p>{{title}}</p>
<div>
<a class="feed-back-btn button" href="{{url}}">我要参与</a>
</div>
</form>
</li>
{{/each}}
{{else}}
<li>
<p class="feed-back-none">调研问卷时间未开始,有货君正在生成调研问卷,<br/>
请您先逛一逛,稍后再来~~
</p>
</li>
{{/if}}
</ul>
</div>
<p id="feed-back-page" class="item-nav center">
{{#if suggestData}}
{{#each suggestData}}
<span class="iconfont {{#if @first}}cur{{/if}}">&#xe606;</span>
{{/each}}
{{else}}
<span class="iconfont cur">&#xe606;</span>
{{/if}}
</p>
... ...
... ... @@ -747,7 +747,7 @@ $('#order-submit').click(function() {
url: '/cart/ensure/submit',
data: order
}).then(function(data) {
var rdata, subTip,
var rdata, subTip, newUser,
tongJi = {
num: 0,
skn: [],
... ... @@ -815,6 +815,19 @@ $('#order-submit').click(function() {
}).track('MC.ROh.yqkx8jgGASmo3McexF7XE0');
}
// 品众统计
if (window._fxcmd) {
newUser = window.cookie('__NEW_USER') || 0;
window._fxcmd.push(['trackOrder', {
oid: rdata.order_code,
otp: rdata.order_amount,
u_info: window.getUid(),
u_type: newUser
}, []]);
window.setCookie('__NEW_USER', 0);
}
location.href = rdata.url;
}
} else if (data.message) {
... ... @@ -829,9 +842,8 @@ multiPackage.init();
coupon.init();
yohoCoin.init();
// 删除品众统计 2017-4-24
// 获取用户是否新客(品众统计)写cookie
// $.ajax({type: 'GET', url: '/home/newuser'});
$.ajax({type: 'GET', url: '/home/newuser'});
// 订单确认页默认埋点
yas.givePoint('YB_SC_ORDER_ENSURE');
... ...
... ... @@ -10,6 +10,8 @@ var $ = require('yoho-jquery'),
var $returnTop = $('.return-top');
var $qrcodeHoverBox = $('.qrcode-hover-box');
var $rightFloatingLayer = $('.right-floating-layer');
var suggestFeedBackHbs = require('hbs/common/suggest-feed-back.hbs');
var $feedBackBox = $('.feed-back-box');
lazyLoad($('img.lazy'));
... ... @@ -64,12 +66,15 @@ function actionSubscription() {
}
function actionhomeFootChange() {
var $vote = $('.vote'),
$feedBackPage = $('#feed-back-page'),
count = $vote.children('li').length;
var param = {
return_type: 'jsonp',
client_secret: 'web',
code: 200
};
// 意见反馈
$feedBackPage.on('click', 'span', function() {
$feedBackBox.on('click', '#feed-back-page span', function() {
var $this = $(this);
if ($this.hasClass('cur')) {
... ... @@ -78,53 +83,16 @@ 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');
});
$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: '//new.yohobuy.com/common/suggestfeedback',
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');
}
}
});
});
return $.getJSON('//www.yohobuy.com/common/suggestfeedback?callback=?', param,
function(suggestData) {
$feedBackBox.html(suggestFeedBackHbs({suggestData: suggestData}));
}
);
}
function rePosReturn() {
... ...
... ... @@ -362,7 +362,7 @@ function packGoogsList() {
$checkBox.each(function() {
var $par = $(this).parent().parent(),
$next = $par.next(),
goodsInfo;
goodsInfo, cskc;
if (verifyTip.length) {
return;
... ... @@ -382,9 +382,16 @@ function packGoogsList() {
goodsInfo.returned_reason = goodsInfo.reason;
} else {
goodsInfo.exchange_reason = goodsInfo.reason;
goodsInfo.new_goods_id = $par.find('.exchange-color').val() * 1;
goodsInfo.new_product_sku = $par.find('.exchange-size').val() * 1;
cskc = $par.find('.exchange-color').val() * 1;
$par.find('.exchange-color').children().each(function() {
if (cskc === +$(this).attr('value')) {
goodsInfo.new_goods_id = $(this).data('goodsid');
}
});
if (!verifyTip && !goodsInfo.new_goods_id) {
verifyTip = '请选择要换的颜色';
}
... ...
... ... @@ -45,6 +45,7 @@
.foot-panel {
background: #fff;
padding: 20px;
min-height: 207px;
}
.title {
... ... @@ -75,6 +76,10 @@
}
}
.feed-back-form {
text-align: center;
}
.item-nav {
padding-top: 20px;
... ... @@ -100,7 +105,7 @@
.button {
height: 24px;
line-height: 24px;
width: 55px;
width: 60px;
font-size: 12px;
margin-top: 11px;
margin-right: 10px;
... ... @@ -112,8 +117,20 @@
}
p {
height: 24px;
overflow: hidden;
font-size: 14px;
line-height: 24px;
text-align: center;
}
.description {
font-size: 12px;
height: 72px;
overflow-x: hidden;
overflow-y: auto;
}
.feed-back-none {
margin-top: 35px;
}
textarea {
... ...