Authored by weiqingting

Merge branch 'feature_student' into release/4.9.1.0

# Conflicts:
#	apps/product/models/detail.js
#	config/common.js
#	public/scss/common/_good.css
@@ -91,12 +91,20 @@ const getPlatForm = (req) => { @@ -91,12 +91,20 @@ const getPlatForm = (req) => {
91 let userAgent = req.get('User-Agent'); 91 let userAgent = req.get('User-Agent');
92 let yoho = {}; 92 let yoho = {};
93 let uids = req.get('User-Agent').match(/uid=([^;]+)/i); 93 let uids = req.get('User-Agent').match(/uid=([^;]+)/i);
  94 + let arrs=[];
  95 + let version = false;
94 const isProduction = process.env.NODE_ENV === 'production'; 96 const isProduction = process.env.NODE_ENV === 'production';
95 97
96 yoho.isiOS = /\(i[^;]+;( U;)? CPU.+Mac OS X/i.test(userAgent); 98 yoho.isiOS = /\(i[^;]+;( U;)? CPU.+Mac OS X/i.test(userAgent);
97 yoho.isAndroid = /Android/i.test(userAgent); 99 yoho.isAndroid = /Android/i.test(userAgent);
98 yoho.isApp = /YohoBuy/i.test(req.get('User-Agent')) || (req.query.app_version && req.query.client_type); 100 yoho.isApp = /YohoBuy/i.test(req.get('User-Agent')) || (req.query.app_version && req.query.client_type);
99 - yoho.isSupportStudent = !yoho.isApp || (/^4.9/i.test(req.query.app_version) && !/^4.9.0/i.test(req.query.app_version)); 101 + if(req.query.app_version){
  102 + arrs = req.query.app_version.split('.');
  103 + version = arrs.length>2 && Number(arrs.slice(0,2)+ arrs[2].slice(0,1))>490;
  104 + }
  105 +
  106 +
  107 + yoho.isSupportStudent = !yoho.isApp || version;
100 yoho.http = 'http:'; 108 yoho.http = 'http:';
101 if (isProduction) { 109 if (isProduction) {
102 yoho.http = 'https:'; 110 yoho.http = 'https:';
@@ -252,7 +260,8 @@ exports.index = (req, res, next) => { @@ -252,7 +260,8 @@ exports.index = (req, res, next) => {
252 options.loginUrl = options.loginUrl + '?openby:yohobuy={"action":"go.h5","params":{"islogin":"N","url":"' + req.__USER__.http + '//m.yohobuy.com/activity/student/register"}}'; 260 options.loginUrl = options.loginUrl + '?openby:yohobuy={"action":"go.h5","params":{"islogin":"N","url":"' + req.__USER__.http + '//m.yohobuy.com/activity/student/register"}}';
253 } 261 }
254 } else { 262 } else {
255 - options.loginUrl = options.loginUrl + '?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' + req.__USER__.http + '//m.yohobuy.com/activity/student"}}}'; 263 + //no login
  264 + options.loginUrl = options.loginUrl + '?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' + req.__USER__.http + '//m.yohobuy.com/activity/student/register"}}}';
256 } 265 }
257 } else { 266 } else {
258 if (options.isLogin) { 267 if (options.isLogin) {
@@ -287,14 +296,9 @@ exports.register = (req, res, next) => { @@ -287,14 +296,9 @@ exports.register = (req, res, next) => {
287 } 296 }
288 Promise.all([verifiedStudentTotal(), getEducationLevelList()]).then((arr) => { 297 Promise.all([verifiedStudentTotal(), getEducationLevelList()]).then((arr) => {
289 if (req.__USER__.isStudent) { 298 if (req.__USER__.isStudent) {
290 - refer = req.get('referer') || '/home?openby:yohobuy={"action":"go.mine"}';// TODO  
291 -  
292 - // if (refer) {  
293 - // refer = decodeURI(req.cookies.refer);  
294 - // } else {  
295 - // refer = '/activity/student';  
296 - // }  
297 - // refer = refer; 299 + refer = '/activity/student';// 所有认证过的,都跳转学生首页
  300 +
  301 +
298 res.redirect(helpers.urlFormat(refer)); 302 res.redirect(helpers.urlFormat(refer));
299 } else { 303 } else {
300 res.render('register', { 304 res.render('register', {
@@ -91,7 +91,7 @@ function isValidate(rules, datas) { @@ -91,7 +91,7 @@ function isValidate(rules, datas) {
91 if (rule.is !== void (0) && data !== rule.is) { 91 if (rule.is !== void (0) && data !== rule.is) {
92 message = rule.msg; 92 message = rule.msg;
93 } 93 }
94 - }else { 94 + } else {
95 message = 'cookie 存储数据不全'; 95 message = 'cookie 存储数据不全';
96 break; 96 break;
97 } 97 }