Authored by 徐炜

Merge remote-tracking branch 'origin/release/4.9.1.0' into 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,13 @@ 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);
// yoho.isStudent = false;
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 +175,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 +232,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,12 +344,17 @@ exports.verifystudent = (req, res, next) => {
prompt = '你的学校信息未通审核';
if (datas[2].code === 200) {
if (datas[2].data.isStudent === 1) {
isverify = true;
prompt = datas[2].data.prompt;
if (datas[2].code === 200) {
if (datas[2].data.isStudent === 1) {
isverify = true;
prompt = datas[2].data.prompt;
}
} else {
prompt = datas[2].message;
}
} else {
prompt = datas[2].message;
prompt = '认证失败';
}
datas[1].data.product_list = datas[1].data.product_list.map(function(value) {
value.goodsId = value.goods_list[0].goods_id;
... ... @@ -375,7 +371,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}}
... ...
... ... @@ -16,11 +16,11 @@
<section class='s-section clearfix'>
<div class='s-verify-img s-verify-fail'></div>
<p class='s-verify-title'>太遗憾了,{{./prompt}}</p>
<p class='s-verify-txt'>可以<a class='red' href='//m.yohobuy.com/activity/student/register'>重新验证 ></a></p>
<p class='s-verify-txt'>可以<a class='red' href='//m.yohobuy.com/activity/student/register'>重新验证 ></a></p>
</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>
... ...
... ... @@ -37,6 +37,7 @@ exports.index = (req, res, next) => {
res.render('plusstar/index', Object.assign({
page: 'plusstar-index',
result: result,
isApp: isApp,
title: title
}, parameter));
}).catch(next);
... ...
... ... @@ -95,7 +95,7 @@ const getResources = (params, options) => {
}
break;
case 'title_image':
case 'title_image' :
if (typeof data[res.template_name] === 'undefined') {
data[res.template_name] = [];
}
... ...
... ... @@ -12,6 +12,10 @@
{{/if}}
<!--/tab-nav-->
{{#if isApp}}
<div class='empty-height'></div>
{{/if}}
<div class="plusstar-resources">
<!--资源位数据模板-->
</div><!--/plusstar-resources-->
... ...
... ... @@ -10,7 +10,9 @@ var plusstar = {},
require('../common');
plusstar = {
scrollObj: {},
common: {
codeDefault: ''
},
init: function() {
var that = this,
$liDom,
... ... @@ -18,6 +20,13 @@ plusstar = {
$tabUlDom = $('.plusstar-page .tab-nav ul');
// 重置tab code位置
if (window.localStorage) {
$tabUlDom.find('li').each(function() {
localStorage.setItem($(this).data('code'), 0);
});
}
$tabUlDom.find('li').css({
width: 100 / $tabUlDom.find('li').length + '%'
});
... ... @@ -50,13 +59,10 @@ plusstar = {
tabNav: function(code) {
var that = this;
if (typeof this.scrollObj[code] === 'undefined') {
// 如果不是第一次点击,回顶部
$(document).scrollTop(0);
this.scrollObj[code] = true;
}
this.common.codeDefault = code;// 记住最后一次的tab code
loading.showLoadingMask();
$.ajax({
type: 'GET',
url: '/guang/plusstar/resources-template',
... ... @@ -86,6 +92,11 @@ plusstar = {
}
});
}, 40);
// 设置滚动条的位置
if (window.localStorage) {
$(document).scrollTop(localStorage.getItem(code) || 0);
}
},
error: function() {
tip.show('网络断开连接了~');
... ... @@ -111,10 +122,24 @@ plusstar = {
};
$(function() {
if ($footer.length > 0) {
$footer.before(
if (!(window.queryString.app_version || window.queryString.appVersion)) {
$('.tab-nav').css({
position: 'absolute'
});
$footer.css({
'max-width': '650px'
}).before(
'<div style="height: ' + parseInt($footer.css('height'), 0) + 'px"></div>'
);
}
plusstar.init();
if (window.localStorage) {
$(document).scroll(function() {
localStorage.setItem(plusstar.common.codeDefault, $(this).scrollTop());
});
}
});
... ...
... ... @@ -410,6 +410,9 @@
input {
border: 0 none;
padding: 12px 0;
height: 60px;
line-height: 60px;
}
.s-red {
... ...
... ... @@ -56,13 +56,13 @@
display: inline-block;
width: 52px;
height: 54px;
background-image: url('/channel/click-txt.png');
background-image: url("/channel/click-txt.png");
}
&.received {
width: 113px;
height: 132px;
background-image: url('/channel/received.png');
height: 134px;
background-image: url("/channel/received.png");
position: absolute;
top: 0;
right: 0;
... ... @@ -70,8 +70,8 @@
&.zero {
width: 111px;
height: 132px;
background-image: url('/channel/zero.png');
height: 134px;
background-image: url("/channel/zero.png");
position: absolute;
top: 0;
right: 0;
... ...
... ... @@ -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,8 +11,9 @@
.tab-nav {
width: 100%;
max-width: inherit;
height: 80px;
font-size: 16px;
font-size: 26px;
text-align: center;
position: fixed;
z-index: 10;
... ... @@ -28,6 +29,7 @@
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
cursor: pointer;
&:first-child {
margin-left: -10px;
... ... @@ -52,10 +54,8 @@
}
}
.plusstar-resources:before {
.empty-height {
height: 72px;
content: "";
display: inline-block;
}
.resources {
... ... @@ -81,13 +81,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;
... ... @@ -115,7 +114,6 @@
.swipe-indicators {
display: none;
}
}
.swipe-item {
... ...