Authored by ccbikai(👎🏻🍜)

Merge branch 'release/5.2' into gray

... ... @@ -276,6 +276,7 @@ exports.check = (req, res, next) => {
code: 200,
redirect,
newer: true,
registerCode: r1.data.code
});
return;
... ... @@ -329,7 +330,7 @@ exports.password = (req, res, next) => {
let mobile = _.get(req.session, 'smsLogin.mobile');
let area = _.get(req.session, 'smsLogin.area');
let password = (req.body.password || '').trim();
let smsCode = +req.body.smsCode || 0;
let registerCode = +req.body.registerCode || 0;
if (!password) {
data.message = PASSWORD_REQUIRED;
... ... @@ -349,7 +350,7 @@ exports.password = (req, res, next) => {
let shoppingKey = cookie.getShoppingKey(req);
RegService.regMobileAes(area, mobile, password, shoppingKey, smsCode).then(result => {
RegService.regMobileAes(area, mobile, password, shoppingKey, registerCode).then(result => {
if (!result.code || result.code !== 200) {
return Promise.reject(result);
}
... ...
{{#data}}
<div style="background-image:url({{src}})" class="divide-image"></div>
<div style="background-image:url({{image src 640 26}})" class="divide-image"></div>
{{/data}}
\ No newline at end of file
... ...
... ... @@ -2,7 +2,7 @@
<div class="hot-single">
{{> common/floor-header-more}}
{{> resources/new-floor-banner}}
<div class="hot-single-goods-list" {{#background}}style="background-image: url({{src}})"{{/background}}>
<div class="hot-single-goods-list" {{#background}}style="background-image: url({{image src 640 330}})"{{/background}}>
<ul>
{{#list}}
<li class="hot-single-goods">
... ...
{{#appIconList}}
<div class="icons-wrapper" style="background-image:url({{back_image}})">
<div class="icons-wrapper" style="background-image:url({{image back_image 640 360}})">
<ul class="icons-list clearfix">
{{#data}}
<li class="icons-item item-{{../number}}"><a href="{{url}}" class="imagebar"><img src="{{image src 98 98}}" alt=""></a><a href="{{url}}" class="linkbar">{{title}}</a></li>
... ...
... ... @@ -3,7 +3,7 @@
{{> common/floor-header-more}}
<div class="new-user-icon">新人专享</div>
{{> resources/new-floor-banner}}
<div class="new-user-goods-container" {{#background}} style="background-image: url({{src}})" {{/background}}>
<div class="new-user-goods-container" {{#background}} style="background-image: url({{image src 640 213}})" {{/background}}>
<ul>
{{#list}}
<li class="new-user-good">
... ...
... ... @@ -4,7 +4,7 @@
{{> resources/new-floor-banner}}
<div class="vip-only-goods-list" {{#background}} style="background-image: url({{src}})" {{/background}}>
<div class="vip-only-goods-list" {{#background}} style="background-image: url({{image src 640 330}})" {{/background}}>
<ul>
{{#list}}
<a href="//m.yohobuy.com/product/show_{{product_skn}}">
... ...
... ... @@ -35,7 +35,8 @@ $pwd.bind('input', function() {
});
$btnSure.toggleClass('disable', !bool);
});
})
qs = window.queryString;
... ... @@ -131,3 +132,9 @@ $btnSure.on('touchstart', function() {
$('.agreement-detail').on('click', function() {
$(this).attr('href', '//m.yohobuy.com/passport/agreement' + window.location.search);
});
// 如果有值, 立刻校验
if ($pwd.val()) {
$pwd.triggerHandler('input');
}
\ No newline at end of file
... ...
... ... @@ -146,7 +146,7 @@ page = {
checkPoint('YB_MOBILE_LOGIN_C'); // 埋点
if (res.newer) {
res.redirect = res.redirect + '&smsCode=' + code;
res.redirect = res.redirect + '&registerCode=' + res.registerCode;
}
location.href = res.redirect;
... ...
... ... @@ -154,6 +154,6 @@ require('./detail/page-render')(function() {
$(function() {
if ($('#product-coupon-switch').val() === 'true') {
require(['./detail/brand-coupon']); // amd
require('./detail/brand-coupon'); // amd
}
});
... ...
/* global define */
// amd
define(function(require) {
'use strict';
/**
* 商品详情: 品牌券
*/
var tip = require('plugin/tip');
var $ = require('yoho-jquery');
var $body = $(document.body);
var brandCoupon = {
skn: null,
brandId: null,
$entry: null,
$couponDrawer: null,
template: require('product/detail/coupon-list.hbs'),
init: function(skn, brandId) {
var self = this;
this.skn = skn;
this.brandId = brandId;
if (!(skn && brandId)) {
return;
}
'use strict';
this.fetchCoupons(this.skn, this.brandId)
.done(function(data) {
if (data.length) {
self.render(data);
self.domInit();
self.bindEvents();
self.$entry.removeClass('hide');
}
})
.fail();
},
domInit: function() {
this.$entry = $('.brand-coupon').removeClass('hide');
},
bindEvents: function() {
var self = this;
this.$entry.on('click', function() {
self.toggleDrawer(true);
});
this.$couponDrawer
.on('click', '.coupon-drawer-mask', $.proxy(this.toggleDrawer, this, false))
.on('click', '.coupon-btn-valid', $.proxy(this.saveCouponHandler, this));
},
render: function(data) {
this.$couponDrawer = $(this.template({
coupons: data
}));
this.$couponDrawer.appendTo('.good-detail-page');
return this;
},
// 获取 品牌券
fetchCoupons: function(skn, brandId) {
return $.get('/product/detail/coupon.json', {
skn: skn,
brandId: brandId
});
},
saveCoupon: function(couponId, callback) {
$.post('/product/detail/coupon/save.json', {
couponId: couponId
}).done(function(res) {
tip.show(res.message);
if (res.code === 200) {
callback(); // eslint-disable-line
} else {
tip.show(
res.message || '抱歉,您不符合领用条件'
);
if (res.redirect) {
setTimeout(function() {
location.href = res.redirect;
}, 1000);
}
}
}).fail(function() {
tip.show('网络异常,请稍后再试');
});
},
// 收藏 品牌券
saveCouponHandler: function(event) {
var $btn = $(event.target);
var couponId = $btn.closest('.coupon').data('coupon');
this.saveCoupon(couponId, function() {
$btn.prop('disabled', true)
.removeClass('coupon-btn-valid')
.text('已领取');
});
event.stopPropagation();
},
toggleDrawer: function(bool) {
this.$couponDrawer.toggleClass('open', bool);
$body.toggleClass('coupon-drawer-open', bool);
/**
* 商品详情: 品牌券
*/
var tip = require('plugin/tip');
var $ = require('yoho-jquery');
var $body = $(document.body);
var brandCoupon = {
skn: null,
brandId: null,
$entry: null,
$couponDrawer: null,
template: require('product/detail/coupon-list.hbs'),
init: function(skn, brandId) {
var self = this;
this.skn = skn;
this.brandId = brandId;
if (!(skn && brandId)) {
return;
}
};
brandCoupon.init(
$('#productSkn').val(),
$('#brand-id').val()
);
});
this.fetchCoupons(this.skn, this.brandId)
.done(function(data) {
if (data.length) {
self.render(data);
self.domInit();
self.bindEvents();
self.$entry.removeClass('hide');
}
})
.fail();
},
domInit: function() {
this.$entry = $('.brand-coupon').removeClass('hide');
},
bindEvents: function() {
var self = this;
this.$entry.on('click', function() {
self.toggleDrawer(true);
});
this.$couponDrawer
.on('click', '.coupon-drawer-mask', $.proxy(this.toggleDrawer, this, false))
.on('click', '.coupon-btn-valid', $.proxy(this.saveCouponHandler, this));
},
render: function(data) {
this.$couponDrawer = $(this.template({
coupons: data
}));
this.$couponDrawer.appendTo('.good-detail-page');
return this;
},
// 获取 品牌券
fetchCoupons: function(skn, brandId) {
return $.get('/product/detail/coupon.json', {
skn: skn,
brandId: brandId
});
},
saveCoupon: function(couponId, callback) {
$.post('/product/detail/coupon/save.json', {
couponId: couponId
}).done(function(res) {
tip.show(res.message);
if (res.code === 200) {
callback(); // eslint-disable-line
} else {
tip.show(
res.message || '抱歉,您不符合领用条件'
);
if (res.redirect) {
setTimeout(function() {
location.href = res.redirect;
}, 1000);
}
}
}).fail(function() {
tip.show('网络异常,请稍后再试');
});
},
// 收藏 品牌券
saveCouponHandler: function(event) {
var $btn = $(event.target);
var couponId = $btn.closest('.coupon').data('coupon');
this.saveCoupon(couponId, function() {
$btn.prop('disabled', true)
.removeClass('coupon-btn-valid')
.text('已领取');
});
event.stopPropagation();
},
toggleDrawer: function(bool) {
this.$couponDrawer.toggleClass('open', bool);
$body.toggleClass('coupon-drawer-open', bool);
}
};
brandCoupon.init(
$('#productSkn').val(),
$('#brand-id').val()
);
... ...
.divide-image {
height: 30px;
height: 26px;
width: 100%;
background-size: 100% 100%;
}
\ No newline at end of file
... ...
... ... @@ -75,13 +75,6 @@ module.exports = (list) => {
floor.data.length === 1 &&
(floor.singleOne = true);
// vip专享 人气单品背景处理
if ((floor.vipUse || floor.popularSingleProduct || floor.newUserFloor) && floor.data && floor.data.background) {
let a = floor.data.background.src;
a = a.substr(0, a.indexOf('?'));
floor.data.background.src = a;
}
// 处理价格两位小数
if ((floor.vipUse || floor.popularSingleProduct || floor.newUserFloor) && floor.data) {
for (let item of floor.data.list) {
... ... @@ -93,24 +86,11 @@ module.exports = (list) => {
}
}
// 图标楼层背景图
if (floor.appIconList && floor.back_image) {
let a = floor.back_image;
a = a.substr(0, a.indexOf('?'));
floor.back_image = a;
}
// sale banner名字
if (floor.sale1T1L4R && floor.data && floor.data.big_image) {
floor.data.banner_image = floor.data.big_image;
}
// 分隔图楼层
if (floor.divideImage && floor.divideImage.data && floor.divideImage.data.src) {
let a = floor.divideImage.data.src;
a = a.substr(0, a.indexOf('?'));
floor.divideImage.data.src = a;
}
formatData.push(floor);
});
... ...