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