Authored by weiqingting

Merge branch 'release/4.9.1.0'

@@ -92,19 +92,29 @@ const getPlatForm = (req) => { @@ -92,19 +92,29 @@ const getPlatForm = (req) => {
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 = []; 94 let arrs = [];
95 - let version = false; 95 + let isNewVersion = false;
96 const isProduction = process.env.NODE_ENV === 'production'; 96 const isProduction = process.env.NODE_ENV === 'production';
97 97
98 yoho.isiOS = /\(i[^;]+;( U;)? CPU.+Mac OS X/i.test(userAgent); 98 yoho.isiOS = /\(i[^;]+;( U;)? CPU.+Mac OS X/i.test(userAgent);
99 yoho.isAndroid = /Android/i.test(userAgent); 99 yoho.isAndroid = /Android/i.test(userAgent);
100 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);
101 - if (req.query.app_version) {  
102 - arrs = req.query.app_version.split('.');  
103 - version = arrs.length > 2 && Number(arrs.slice(0, 2).join('') + arrs[2].slice(0, 1)) > 490; 101 + yoho.app_version = req.query.app_version || '';
  102 + if (yoho.app_version) {
  103 + arrs = yoho.app_version.split('.');
  104 + if (arrs.length > 2) {
  105 + if (arrs[0] && +arrs[0] < 4) {
  106 + isNewVersion = false;
  107 + } else if (arrs[1] && +arrs[1] < 9) {
  108 + isNewVersion = false;
  109 + } else if (arrs[2] && +arrs[2] <= 0) {
  110 + isNewVersion = false;
  111 + } else {
  112 + isNewVersion = true;
  113 + }
  114 + }
104 } 115 }
105 116
106 -  
107 - yoho.isSupportStudent = !yoho.isApp || version; 117 + yoho.isSupportStudent = !yoho.isApp || isNewVersion;
108 yoho.http = 'http:'; 118 yoho.http = 'http:';
109 if (isProduction) { 119 if (isProduction) {
110 yoho.http = 'https:'; 120 yoho.http = 'https:';
@@ -116,33 +126,12 @@ const getPlatForm = (req) => { @@ -116,33 +126,12 @@ const getPlatForm = (req) => {
116 let data = yield getUser(yoho.uid); 126 let data = yield getUser(yoho.uid);
117 127
118 yoho.isStudent = data.data && data.data.vip_info && data.data.vip_info.is_student ? true : false; 128 yoho.isStudent = data.data && data.data.vip_info && data.data.vip_info.is_student ? true : false;
119 -  
120 - // console.log(yoho);  
121 return yoho; 129 return yoho;
122 })(); 130 })();
123 131
124 132
125 }; 133 };
126 134
127 -// const getRequest = (url)=>{  
128 -//  
129 -// let regurl = /^[^\?]+\?([\w\W]+)$/;  
130 -// let regpara = /([^&=]+)=([\w\W]*?)(&|$|#)/g;  
131 -// let ret = {};  
132 -// let strpara,  
133 -// result;  
134 -//  
135 -// let arrurl = regurl.exec(url);  
136 -//  
137 -// if (arrurl && arrurl[1]) {  
138 -// strpara = arrurl[1];  
139 -// while ((result = regpara.exec(strpara)) !== null) {  
140 -// ret[result[1]] = result[2];  
141 -// }  
142 -// }  
143 -// return ret;  
144 -// };  
145 -  
146 135
147 exports.index = (req, res, next) => { 136 exports.index = (req, res, next) => {
148 let code = 'a83b7d55324fb65f96c1f85a3387ebd8'; 137 let code = 'a83b7d55324fb65f96c1f85a3387ebd8';
@@ -185,7 +174,7 @@ exports.index = (req, res, next) => { @@ -185,7 +174,7 @@ exports.index = (req, res, next) => {
185 } 174 }
186 }); 175 });
187 if (coupons && coupons.data) { 176 if (coupons && coupons.data) {
188 - coupons.link = link && link.data ? link.data[0].url + (req.__USER__.isApp ? '&app_version=1' : '') : ''; 177 + coupons.link = link && link.data ? link.data[0].url + (req.__USER__.isApp ? '&app_version=' + req.__USER__.app_version : '') : '';
189 coupons.data = (coupons.data || []).map((item) => { 178 coupons.data = (coupons.data || []).map((item) => {
190 couponids.push(item.couponID); 179 couponids.push(item.couponID);
191 180
@@ -242,7 +231,8 @@ exports.index = (req, res, next) => { @@ -242,7 +231,8 @@ exports.index = (req, res, next) => {
242 isLogin: req.__USER__.isLogin, 231 isLogin: req.__USER__.isLogin,
243 title: '有货学生专享优惠', 232 title: '有货学生专享优惠',
244 http: req.__USER__.http, 233 http: req.__USER__.http,
245 - uid: req.__USER__.uid 234 + uid: req.__USER__.uid,
  235 + app_version: req.__USER__.app_version
246 }; 236 };
247 if (!req.__USER__.isApp) { 237 if (!req.__USER__.isApp) {
248 options.pageHeader = headerModel.setNav({ 238 options.pageHeader = headerModel.setNav({
@@ -353,12 +343,17 @@ exports.verifystudent = (req, res, next) => { @@ -353,12 +343,17 @@ exports.verifystudent = (req, res, next) => {
353 prompt = '你的学校信息未通审核'; 343 prompt = '你的学校信息未通审核';
354 344
355 if (datas[2].code === 200) { 345 if (datas[2].code === 200) {
356 - if (datas[2].data.isStudent === 1) {  
357 - isverify = true;  
358 - prompt = datas[2].data.prompt; 346 + if (datas[2].code === 200) {
  347 + if (datas[2].data.isStudent === 1) {
  348 + isverify = true;
  349 + prompt = datas[2].data.prompt;
  350 + }
  351 + } else {
  352 + prompt = datas[2].message;
359 } 353 }
  354 +
360 } else { 355 } else {
361 - prompt = datas[2].message; 356 + prompt = '认证失败';
362 } 357 }
363 datas[1].data.product_list = datas[1].data.product_list.map(function(value) { 358 datas[1].data.product_list = datas[1].data.product_list.map(function(value) {
364 value.goodsId = value.goods_list[0].goods_id; 359 value.goodsId = value.goods_list[0].goods_id;
@@ -375,7 +370,8 @@ exports.verifystudent = (req, res, next) => { @@ -375,7 +370,8 @@ exports.verifystudent = (req, res, next) => {
375 isLogin: user.data && user.data.vip_info && user.data.vip_info.is_student ? true : false, 370 isLogin: user.data && user.data.vip_info && user.data.vip_info.is_student ? true : false,
376 title: '学生身份认证', 371 title: '学生身份认证',
377 http: req.__USER__.http, 372 http: req.__USER__.http,
378 - uid: req.__USER__.uid 373 + uid: req.__USER__.uid,
  374 + app_version: req.__USER__.app_version
379 }); 375 });
380 }).catch(next); 376 }).catch(next);
381 377
@@ -77,7 +77,7 @@ @@ -77,7 +77,7 @@
77 {{/activities}} 77 {{/activities}}
78 78
79 <section class='s-section clearfix'> 79 <section class='s-section clearfix'>
80 - <h1>学生专享商品<a class="more iconfont" href="//search.m.yohobuy.com/?students=1&title=学生专享商品&uid={{uid}}{{#isApp}}&app_version=1{{/isApp}}">&#xe618;</a></h1> 80 + <h1>学生专享商品<a class="more iconfont" href="//search.m.yohobuy.com/?students=1&title=学生专享商品&uid={{uid}}{{#isApp}}&app_version={{@root.app_version}}{{/isApp}}">&#xe618;</a></h1>
81 <div class='goods-list clearfix'> 81 <div class='goods-list clearfix'>
82 {{#each goods}} 82 {{#each goods}}
83 <div class="good-info"> 83 <div class="good-info">
@@ -119,7 +119,7 @@ @@ -119,7 +119,7 @@
119 </div> 119 </div>
120 {{/each}} 120 {{/each}}
121 </div> 121 </div>
122 - <a class='s-more' href='//search.m.yohobuy.com/?students=1&title=学生专享商品&uid={{uid}}{{#isApp}}&app_version=1{{/isApp}}'>查看更多</a> 122 + <a class='s-more' href='//search.m.yohobuy.com/?students=1&title=学生专享商品&uid={{uid}}{{#isApp}}&app_version={{@root.app_version}}{{/isApp}}'>查看更多</a>
123 </section> 123 </section>
124 124
125 {{#loginUrl}} 125 {{#loginUrl}}
@@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
20 </section> 20 </section>
21 {{/if}} 21 {{/if}}
22 <section class='s-section clearfix'> 22 <section class='s-section clearfix'>
23 - <h1>学生专享商品<a class="more iconfont" href="//search.m.yohobuy.com/?students=1&title=学生专享商品&uid={{uid}}{{#isApp}}&app_version=1{{/isApp}}">&#xe618;</a></h1> 23 + <h1>学生专享商品<a class="more iconfont" href="//search.m.yohobuy.com/?students=1&title=学生专享商品&uid={{uid}}{{#isApp}}&app_version={{@root.app_version}}{{/isApp}}">&#xe618;</a></h1>
24 <div class='goods-list clearfix'> 24 <div class='goods-list clearfix'>
25 {{#each goods}} 25 {{#each goods}}
26 <div class="good-info"> 26 <div class="good-info">
@@ -62,7 +62,7 @@ @@ -62,7 +62,7 @@
62 </div> 62 </div>
63 {{/each}} 63 {{/each}}
64 </div> 64 </div>
65 - <a class='s-more' href="//search.m.yohobuy.com/?students=1&title=学生专享商品{{#isApp}}&app_version=1{{/isApp}}">查看更多</a> 65 + <a class='s-more' href="//search.m.yohobuy.com/?students=1&title=学生专享商品{{#isApp}}&app_version={{@root.app_version}}{{/isApp}}">查看更多</a>
66 </section> 66 </section>
67 </div> 67 </div>
68 </div> 68 </div>
@@ -2,8 +2,8 @@ @@ -2,8 +2,8 @@
2 position: relative; 2 position: relative;
3 margin-right: auto; 3 margin-right: auto;
4 margin-left: auto; 4 margin-left: auto;
  5 + max-width: 640px;
5 width: 100%; 6 width: 100%;
6 - max-width: 750px;  
7 7
8 .margin-top-0 { 8 .margin-top-0 {
9 margin-top: 0; 9 margin-top: 0;
@@ -11,6 +11,7 @@ @@ -11,6 +11,7 @@
11 11
12 .tab-nav { 12 .tab-nav {
13 width: 100%; 13 width: 100%;
  14 + max-width: inherit;
14 height: 80px; 15 height: 80px;
15 font-size: 16px; 16 font-size: 16px;
16 text-align: center; 17 text-align: center;
@@ -81,13 +82,12 @@ @@ -81,13 +82,12 @@
81 .header-title { 82 .header-title {
82 position: relative; 83 position: relative;
83 width: 100%; 84 width: 100%;
84 - height: 70px; 85 + height: 80px;
85 font-size: 28px; 86 font-size: 28px;
86 - line-height: 70px; 87 + line-height: 80px;
87 text-align: center; 88 text-align: center;
88 font-weight: bold; 89 font-weight: bold;
89 margin: 0; 90 margin: 0;
90 - margin-top: 20px;  
91 91
92 .more { 92 .more {
93 position: absolute; 93 position: absolute;