Authored by htoooth

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

... ... @@ -149,13 +149,13 @@ app.use((req, res, next) => {
req.session = {};
}
req.app.locals = _.merge(req.app.locals, {
pc: {
geetest: {
validation: false
}
}
});
// req.app.locals = _.merge(req.app.locals, {
// pc: {
// geetest: {
// validation: true
// }
// }
// });
next();
});
... ...
... ... @@ -325,14 +325,18 @@ const checkFav = (req, res) => {
co(function * () {
let uid = req.user.uid;
let pids = req.body.pidList.split(',');
let ret = {
code: 200,
code: 400,
message: '是否收藏',
data: {}
};
ret.data = yield service.checkUserIsFav(uid, pids);
if (uid && req.body.pidList) {
let pids = req.body.pidList.split(',');
Object.assign(ret, {code: 200,
data: yield service.checkUserIsFav(uid, pids)});
}
return res.send(ret);
})();
... ...
... ... @@ -89,7 +89,7 @@
<ul class="package-goods clearfix">
{{#each goods_list}}
<li class="left">
<img class="lazy package-goods-img" data-original="{{image goods_images 68 90}}">
<img class="lazy package-goods-img" data-original="{{image2 goods_images w=68 h=90}}">
{{#isEqual goods_type 'gift'}}
<span>赠品</span>
{{/isEqual}}
... ... @@ -124,7 +124,7 @@
<td{{#if @first}} class="border-top"{{/if}}></td>
<td class="border-top aline-left">
<a class="image" href="{{linkToGoods}}">
<img src="{{image goods_images 64 85}}" class="thumb">
<img src="{{image2 goods_images w=64 h=85}}" class="thumb">
<p class="name">
{{#isEqual goods_type 'gift'}}
<span>赠品</span>
... ...
... ... @@ -4,7 +4,7 @@
{{# imgBrand}}
<li class="img-item">
<a href="{{url}}" target= "_blank" title="{{title}}">
<img data-original="{{image src 378 175}}" src="{{image2 src w=378 h=175}}" alt="{{alt}}">
<img data-original="{{image2 src w=378 h=175}}" src="{{image2 src w=378 h=175}}" alt="{{alt}}">
</a>
</li>
{{/ imgBrand}}
... ...
... ... @@ -26,13 +26,6 @@ const checkAPI = (req, res) => {
img.checkAPI)(req, res);
};
// 重定向调用
const requiredPage = (req, res, next) => {
return (_.get(req.app.locals.pc, 'geetest.validation', false) ?
gee.requiredPage :
img.requiredPage)(req, res, next);
};
const passwordRequired = (req, res, next) => {
if (req.body.loginType === 'password') {
return requiredAPI(req, res, next);
... ... @@ -43,7 +36,6 @@ const passwordRequired = (req, res, next) => {
module.exports = {
requiredAPI,
requiredPage,
generate,
checkAPI,
passwordRequired
... ...
... ... @@ -9,8 +9,6 @@ const Geetest = require('../models/captcha-gee-service');
const config = global.yoho.config;
const logger = global.yoho.logger;
const helpers = global.yoho.helpers;
const CAPTCHA = config.UNIVERSAL_CAPTCHA;
// 对比函数
... ... @@ -126,40 +124,8 @@ const checkAPI = (req, res) => {
});
};
// 重定向调用
const requiredPage = (req, res, next) => {
let verifyCode = req.body.verifyCode || '';
let captcha = verifyCode.split(',');
if (!verifyCode) {
return res.redirect(helpers.urlFormat('/passport/back/index'));
}
if (_mustEqual(req)) {
return next();
} else {
pcGeetest.validate({
challenge: captcha[0],
validate: captcha[1],
seccode: captcha[2]
}, function(err, success) {
logger.info(`geetest captcha auth [${err ? 'fail' : 'success'}]`,
`CLIENT [${req.body.verifyCode}] SERVER [${err}]`);
if (err) {
return res.redirect(helpers.urlFormat('/passport/back/index'));
} else if (!success) {
return res.redirect(helpers.urlFormat('/passport/back/index'));
} else {
return next();
}
});
}
};
module.exports = {
generate,
requiredAPI,
checkAPI,
requiredPage
checkAPI
};
... ...
... ... @@ -7,7 +7,6 @@
// const _ = require('lodash');
const captchaService = require('../models/captcha-img-service');
const helpers = global.yoho.helpers;
const CAPTCHA = global.yoho.config.UNIVERSAL_CAPTCHA;
const request = require('request');
const logger = global.yoho.logger;
... ... @@ -47,24 +46,6 @@ const requiredAPI = (req, res, next) => {
}
};
// 重定向调用
const requiredPage = (req, res, next) => {
let count = req.session.captchaCount;
if (count >= 4) {
req.session.captcha = CAPTCHA;
return res.redirect(helpers.urlFormat('/passport/back/index'));
}
req.session.captchaCount = count + 1;
if (_mustEqual(req)) {
return next();
} else {
return res.redirect(helpers.urlFormat('/passport/back/index'));
}
};
// 七牛验证码
const generate = (req, res, next) => {
captchaService.generateCaptcha().then((result) => {
... ... @@ -108,7 +89,6 @@ const checkAPI = (req, res) => {
module.exports = {
requiredAPI,
requiredPage,
generate,
checkAPI
};
... ...
... ... @@ -62,7 +62,7 @@
{{#each trendList}}
<li>
<a href="{{href}}">
<img src="{{image src 264 173}}" />
<img src="{{image2 src w=264 h=173}}" />
<div class="main-title">{{mainTitle}}</div>
<div class="sub-title">{{Subtitle}}</div>
</a>
... ...
{{# mainBanner}}
<div class="main-banner slide-container"{{#unless list}} style="background:url({{image src 1920 450}}) no-repeat top center;"{{/unless}}>
<div class="main-banner slide-container"{{#unless list}} style="background:url({{image2 src w=1920 h=450}}) no-repeat top center;"{{/unless}}>
{{#if list}}
<div class="slide-wrapper">
<ul>
{{# list}}
<li class="banner-img" style="background: {{bgColor}} url({{image src 1920 450}}) no-repeat top center;">
<li class="banner-img" style="background: {{bgColor}} url({{image2 src w=1920 h=450}}) no-repeat top center;">
{{#if url}}
<a href="{{url}}" target= "_blank"></a>
{{/if}}
... ...
{{# banner}}
<div class="brand-banner" style="background:{{bgColor}}{{#if bgImg}} url({{image bgImg 1920 45}}){{/if}}">
<div class="brand-banner" style="background:{{bgColor}}{{#if bgImg}} url({{image2 bgImg w=1920 h=45}}){{/if}}">
{{#if homeUrl}}
<div class="center-content clearfix">
<a class="pull-left" href="{{homeUrl}}">
<img src="{{image logo 45 45}}">
<img src="{{image2 logo w=45 h=45}}">
</a>
<div class="opt pull-right">
... ...
{
"name": "yohobuy-node",
"version": "5.5.3",
"version": "5.5.8",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ... @@ -10,6 +10,7 @@
"scripts": {
"start": "node app.js",
"dev": "nodemon -e js,hbs -i public/ app.js",
"build": "gulp ge --cwd=public",
"online": "NODE_ENV=\"production\" node app.js",
"debug": "DEBUG=\"express:*\" nodemon -e js,hbs -i public/ app.js",
"lint-js": "eslint -c .eslintrc --cache --fix .",
... ...
... ... @@ -5,7 +5,7 @@
<div class="color-row">
{{#each colors}}
<div class="dt {{#if active}} active current-color{{/if}} {{#if disable}} disabled{{/if}}"
data-pic="{{image pic 100 134}}"
data-pic="{{image2 pic w=100 h=134}}"
data-pid="{{pid}}"
{{!--data-target="{{proId}}-color-{{@index}}"
data-title="{{this.color}}" --}}
... ... @@ -40,9 +40,9 @@
{{# colors}}
<div class="big-img {{#unless active}} hide{{/unless}}">
{{#if pic}}
<img src="{{image pic 100 134}}" />
<img src="{{image2 pic w=100 h=134}}" />
{{else}}
<img src="{{image ../defaultImg 100 134}}" />
<img src="{{image2 ../defaultImg w=100 h=134}}" />
{{/if}}
</div>
{{/ colors}}
... ...
... ... @@ -14,7 +14,7 @@
<div class="good-info" data-skn="{{skn}}" data-id="{{id}}" data-index="{{@index}}">
<div class="good-detail-img">
<a class="good-thumb" href="{{url}}" target="_blank">
<img class="lazy" src="{{image src 100 135}}" style="display: block;">
<img class="lazy" src="{{image2 src w=100 h=135}}" style="display: block;">
</a>
</div>
<div class="good-detail-text stu-good-detail ">
... ...