Authored by yyq

Merge branch 'release/1.0' of git.yoho.cn:fe/yoho-blk into release/1.0

... ... @@ -43,12 +43,13 @@ const _getBrandAdFloor = d => {
* @return {Object} 处理之后的数据
*/
const _getNewArrivals = d => {
console.log(d);
_.forEach(d, (data, index) => {
if (index === 0 || index === d.length - 1) {
data.smallImg = true;
}
if (index % 2 === 0) {
if (index % 2 !== 0) {
data.even = true;
}
});
... ...
... ... @@ -4,7 +4,7 @@
{{# slider}}
<li style="{{#if bgColor}}background:{{bgColor}}{{/if}}">
<a href="{{url}}" target= "_blank">
<img class="lazy" data-original="{{image src 1920 645}}" alt="">
<img class="lazy" data-original="{{image src 1150 570}}" alt="">
</a>
{{# tips}}
<div class="slide-tips">
... ...
... ... @@ -9,6 +9,7 @@ const _ = require('lodash');
const cache = global.yoho.cache;
const sign = global.yoho.sign;
const config = global.yoho.config;
const crypto = global.yoho.crypto;
const api = require('./login-api');
const UserService = require('./user-service');
... ... @@ -37,7 +38,7 @@ const syncUserSession = (uid, req, res) => {
let user = userInfo.data;
if (!_.isEmpty(user)) {
let uidCookie = `{data.profile_name}::${user.uid}::${user.username}::${token}`;
let uidCookie = `${user.profile_name}::${crypto.encryption('', user.uid + '')}::${user.username}::${token}`;
req.session._TOKEN = token;
req.session._LOGIN_UID = uid;
... ...
... ... @@ -13,8 +13,6 @@ module.exports = (req, res, next) => {
let refer = '';
if (req.method === 'GET') {
refer = req.getUrl();
} else {
refer = req.get('Referer');
}
... ...
... ... @@ -10,9 +10,6 @@ const LoginService = require('../../apps/passport/models/login-service');
*/
module.exports = () => {
return (req, res, next) => {
req.getUrl = function() {
return req.protocol + '://' + req.get('host') + req.originalUrl;
};
// 从 SESSION 中获取到当前登录用户的 UID
if (req.session && _.isNumber(req.session._LOGIN_UID)) {
... ... @@ -22,6 +19,7 @@ module.exports = () => {
// session 没有读取到的时候,从 cookie 读取 UID
if (!req.user.uid && req.cookies._UID) {
req.user.uid = cookie.getUid(req);
console.log('req.user.uid', req.user.uid);
}
// 从 SESSION 中获得 USERNAME
... ... @@ -49,7 +47,7 @@ module.exports = () => {
return LoginService.syncUserSession(result.data.uid, req, res);
}).then(()=> {
return res.redirect(req.getUrl());
return res.redirect(req.originalUrl);
}).catch(next);
} else {
return next();
... ...