Authored by weiqingting

Merge branch 'release/4.9.1.0'

... ... @@ -92,19 +92,29 @@ const getPlatForm = (req) => {
let yoho = {};
let uids = req.get('User-Agent').match(/uid=([^;]+)/i);
let arrs = [];
let version = false;
let isNewVersion = false;
const isProduction = process.env.NODE_ENV === 'production';
yoho.isiOS = /\(i[^;]+;( U;)? CPU.+Mac OS X/i.test(userAgent);
yoho.isAndroid = /Android/i.test(userAgent);
yoho.isApp = /YohoBuy/i.test(req.get('User-Agent')) || (req.query.app_version && req.query.client_type);
if (req.query.app_version) {
arrs = req.query.app_version.split('.');
version = arrs.length > 2 && Number(arrs.slice(0, 2).join('') + arrs[2].slice(0, 1)) > 490;
yoho.app_version = req.query.app_version || '';
if (yoho.app_version) {
arrs = yoho.app_version.split('.');
if (arrs.length > 2) {
if (arrs[0] && +arrs[0] < 4) {
isNewVersion = false;
} else if (arrs[1] && +arrs[1] < 9) {
isNewVersion = false;
} else if (arrs[2] && +arrs[2] <= 0) {
isNewVersion = false;
} else {
isNewVersion = true;
}
}
}
yoho.isSupportStudent = !yoho.isApp || version;
yoho.isSupportStudent = !yoho.isApp || isNewVersion;
yoho.http = 'http:';
if (isProduction) {
yoho.http = 'https:';
... ... @@ -116,33 +126,12 @@ const getPlatForm = (req) => {
let data = yield getUser(yoho.uid);
yoho.isStudent = data.data && data.data.vip_info && data.data.vip_info.is_student ? true : false;
// console.log(yoho);
return yoho;
})();
};
// const getRequest = (url)=>{
//
// let regurl = /^[^\?]+\?([\w\W]+)$/;
// let regpara = /([^&=]+)=([\w\W]*?)(&|$|#)/g;
// let ret = {};
// let strpara,
// result;
//
// let arrurl = regurl.exec(url);
//
// if (arrurl && arrurl[1]) {
// strpara = arrurl[1];
// while ((result = regpara.exec(strpara)) !== null) {
// ret[result[1]] = result[2];
// }
// }
// return ret;
// };
exports.index = (req, res, next) => {
let code = 'a83b7d55324fb65f96c1f85a3387ebd8';
... ... @@ -185,7 +174,7 @@ exports.index = (req, res, next) => {
}
});
if (coupons && coupons.data) {
coupons.link = link && link.data ? link.data[0].url + (req.__USER__.isApp ? '&app_version=1' : '') : '';
coupons.link = link && link.data ? link.data[0].url + (req.__USER__.isApp ? '&app_version=' + req.__USER__.app_version : '') : '';
coupons.data = (coupons.data || []).map((item) => {
couponids.push(item.couponID);
... ... @@ -242,7 +231,8 @@ exports.index = (req, res, next) => {
isLogin: req.__USER__.isLogin,
title: '有货学生专享优惠',
http: req.__USER__.http,
uid: req.__USER__.uid
uid: req.__USER__.uid,
app_version: req.__USER__.app_version
};
if (!req.__USER__.isApp) {
options.pageHeader = headerModel.setNav({
... ... @@ -353,6 +343,7 @@ exports.verifystudent = (req, res, next) => {
prompt = '你的学校信息未通审核';
if (datas[2].code === 200) {
if (datas[2].code === 200) {
if (datas[2].data.isStudent === 1) {
isverify = true;
prompt = datas[2].data.prompt;
... ... @@ -360,6 +351,10 @@ exports.verifystudent = (req, res, next) => {
} else {
prompt = datas[2].message;
}
} else {
prompt = '认证失败';
}
datas[1].data.product_list = datas[1].data.product_list.map(function(value) {
value.goodsId = value.goods_list[0].goods_id;
value.url = helpers.urlFormat(`/product/pro_${value.product_id}_${value.goodsId}/${value.cn_alphabet}.html`) + `?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":${value.product_skn}}}`;
... ... @@ -375,7 +370,8 @@ exports.verifystudent = (req, res, next) => {
isLogin: user.data && user.data.vip_info && user.data.vip_info.is_student ? true : false,
title: '学生身份认证',
http: req.__USER__.http,
uid: req.__USER__.uid
uid: req.__USER__.uid,
app_version: req.__USER__.app_version
});
}).catch(next);
... ...
... ... @@ -77,7 +77,7 @@
{{/activities}}
<section class='s-section clearfix'>
<h1>学生专享商品<a class="more iconfont" href="//search.m.yohobuy.com/?students=1&title=学生专享商品&uid={{uid}}{{#isApp}}&app_version=1{{/isApp}}">&#xe618;</a></h1>
<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>
<div class='goods-list clearfix'>
{{#each goods}}
<div class="good-info">
... ... @@ -119,7 +119,7 @@
</div>
{{/each}}
</div>
<a class='s-more' href='//search.m.yohobuy.com/?students=1&title=学生专享商品&uid={{uid}}{{#isApp}}&app_version=1{{/isApp}}'>查看更多</a>
<a class='s-more' href='//search.m.yohobuy.com/?students=1&title=学生专享商品&uid={{uid}}{{#isApp}}&app_version={{@root.app_version}}{{/isApp}}'>查看更多</a>
</section>
{{#loginUrl}}
... ...
... ... @@ -20,7 +20,7 @@
</section>
{{/if}}
<section class='s-section clearfix'>
<h1>学生专享商品<a class="more iconfont" href="//search.m.yohobuy.com/?students=1&title=学生专享商品&uid={{uid}}{{#isApp}}&app_version=1{{/isApp}}">&#xe618;</a></h1>
<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>
<div class='goods-list clearfix'>
{{#each goods}}
<div class="good-info">
... ... @@ -62,7 +62,7 @@
</div>
{{/each}}
</div>
<a class='s-more' href="//search.m.yohobuy.com/?students=1&title=学生专享商品{{#isApp}}&app_version=1{{/isApp}}">查看更多</a>
<a class='s-more' href="//search.m.yohobuy.com/?students=1&title=学生专享商品{{#isApp}}&app_version={{@root.app_version}}{{/isApp}}">查看更多</a>
</section>
</div>
</div>
... ...
... ... @@ -2,8 +2,8 @@
position: relative;
margin-right: auto;
margin-left: auto;
max-width: 640px;
width: 100%;
max-width: 750px;
.margin-top-0 {
margin-top: 0;
... ... @@ -11,6 +11,7 @@
.tab-nav {
width: 100%;
max-width: inherit;
height: 80px;
font-size: 16px;
text-align: center;
... ... @@ -81,13 +82,12 @@
.header-title {
position: relative;
width: 100%;
height: 70px;
height: 80px;
font-size: 28px;
line-height: 70px;
line-height: 80px;
text-align: center;
font-weight: bold;
margin: 0;
margin-top: 20px;
.more {
position: absolute;
... ...