Authored by hf

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop

... ... @@ -608,7 +608,28 @@
//注册页
{
countrys: [...], //区域列表
countryCode: '' //默认区号
countryCode: '' //默认区号
}
//验证码
{
areaCode: '',
phoneNum: ''
}
//密码页
{
... //仅头部
}
### 绑定手机号
//绑定页
{
countrys: [...], //区域列表
areaCode: '', //默认区号
sourceType: 'qq', //用户在登录页选择的第三方登录平台
openId: '' //第三方登录平台id,用于绑定手机号
}
//验证码
... ...
... ... @@ -92,7 +92,7 @@ class BindData
$param['area'] = $area;
if (!empty($password))
{
$param['passport'] = $password;
$param['password'] = $password;
}
$param['client_secret'] = Sign::getSign($param);
... ...
/**
* 注册
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/10/8
*/
var $ = require('jquery');
var $phoneNum = $('#phone-num'),
$countrySelect = $('#country-select'),
$areaCode = $('#area-code'),
$openId = $('#openId'),
$nickname = $('#nickname'),
$sourceType = $('#sourceType'),
$btnNext = $('#btn-next');
var api = require('../api'),
tip = require('../../plugin/tip'),
dialog = require('../../me/dialog');
var trim = $.trim;
var showErrTip = tip.show;
function nextStep(url, mobileNo, areaCode) {
$.ajax({
type: 'POST',
url: '/passport/bind/sendBindMsg',
data: {
phoneNum: mobileNo,
areaCode: areaCode.replace('+', '')
},
success: function(res) {
console.log(res.data);
location.href = url;
},
error: function() {
tip.show('出错了,请重试!');
}
});
}
api.selectCssHack($('#country-select'));
api.bindClearEvt();
$phoneNum.bind('input', function() {
if (trim($phoneNum.val()) === '') {
$btnNext.addClass('disable');
} else {
$btnNext.removeClass('disable');
}
});
$countrySelect.change(function() {
$areaCode.text($countrySelect.val());
});
$btnNext.on('touchstart', function() {
var pn = trim($phoneNum.val()),
openId = trim($openId.val()),
nickname = trim($nickname.val()),
sourceType = trim($sourceType.val()),
areaCode = $countrySelect.val();
if ($btnNext.hasClass('disable')) {
return;
}
if (api.phoneRegx[areaCode].test(pn)) {
$.ajax({
url: '/passport/bind/bindCheck',
type: 'POST',
data: {
areaCode: areaCode.replace('+', ''),
phoneNum: pn,
openId: openId,
sourceType: sourceType,
nickname: nickname
},
success: function(res) {
console.log(res);
//res : {
// code: 'xxx',
// data: {
// isReg: 0,
// next: 'xxxx'
// },
// message: 'xxxx',
//}
if (res.code === 200) {
if (res.data.isReg === 1) {
dialog.showDialog({
dialogText: '该手机号已注册过有货\n' + pn + ',确定绑定吗?',
hasFooter: {
leftBtnText: '更换号码',
rightBtnText: '继续绑定'
}
}, function() {
nextStep(res.data.next, pn, areaCode);
});
} else {
nextStep(res.data.next, pn, areaCode);
}
} else {
showErrTip(res.message);
}
}
});
} else {
showErrTip('手机号格式不正确,请重新输入');
}
});
... ...
/**
* 注册-验证码
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/10/8
*/
require('../code')(true, true);
... ...
/**
* 注册-密码
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/10/8
*/
var $ = require('jquery');
var $pwd = $('#pwd'),
$btnSure = $('#btn-sure');
var api = require('../api');
var tip = require('../../plugin/tip');
var trim = $.trim;
var showErrTip = tip.show;
var nickname = $('#nickname').val(),
sourceType = $('#sourceType').val(),
openId = $('#openId').val(),
phoneNum = $('#phone-num').val(),
areaCode = $('#area-code').val().replace('+', '');
function startBind(password) {
$.ajax({
url: '/passport/bind/bindMobile',
type: 'post',
data: {
areaCode: areaCode.replace('+', ''),
phoneNum: phoneNum,
openId: openId,
sourceType: sourceType,
nickname: nickname,
password: password
},
success: function(res) {
if (res.code === 200) {
tip.show('登录成功');
setTimeout(function() {
location.href = res.data.refer;
}, 2000);
} else {
tip.show(res.message);
}
},
error: function(err) {
tip.show('登录失败,请重试!');
}
});
}
api.bindEyesEvt({
status: 'open' //默认眼睛打开
});
$pwd.bind('input', function() {
if (trim($pwd.val()) === '') {
$btnSure.addClass('disable');
} else {
$btnSure.removeClass('disable');
}
});
$btnSure.on('touchstart', function() {
var pwd = trim($pwd.val());
if ($btnSure.hasClass('disable')) {
return;
}
if (api.pwdValidate(pwd) === false) {
showErrTip('密码6-20位,请重新输入');
} else {
startBind(pwd);
}
});
... ...
... ... @@ -5,10 +5,14 @@
*/
var $ = require('jquery');
module.exports = function(useInRegister) {
module.exports = function(useInRegister, useForBind) {
var $captcha = $('#captcha'),
$btnNext = $('#btn-next'),
$captchaTip = $('#captcha-tip'),
isReg = parseInt($('#isReg').val()),
nickname = $('#nickname').val(),
sourceType = $('#sourceType').val(),
openId = $('#openId').val(),
phoneNum = $('#phone-num').val(),
areaCode = $('#area-code').val().replace('+', '');
... ... @@ -20,6 +24,34 @@ module.exports = function(useInRegister) {
var urlMid = useInRegister ? 'reg' : 'back';
function startBind() {
$.ajax({
url: '/passport/bind/bindMobile',
type: 'post',
data: {
areaCode: areaCode.replace('+', ''),
phoneNum: phoneNum,
openId: openId,
sourceType: sourceType,
nickname: nickname,
password: ''
},
success: function(res) {
if (res.code === 200) {
tip.show('登录成功');
setTimeout(function() {
location.href = res.data.refer;
}, 2000);
} else {
tip.show(res.message);
}
},
error: function(err) {
tip.show('登录失败,请重试!');
}
});
}
function countDown() {
var count = 59,
itime;
... ... @@ -52,7 +84,7 @@ module.exports = function(useInRegister) {
$.ajax({
type: 'POST',
url: '/passport/' + urlMid + '/sendcode',
url: useForBind ? '/passport/bind/sendBindMsg' : '/passport/' + urlMid + '/sendcode',
data: {
phoneNum: phoneNum,
areaCode: areaCode
... ... @@ -77,7 +109,7 @@ module.exports = function(useInRegister) {
$.ajax({
type: 'POST',
url: '/passport/' + urlMid + '/verifycode',
url: useForBind ? '/passport/bind/checkBindMsg' : '/passport/' + urlMid + '/verifycode',
data: {
phoneNum: phoneNum,
areaCode: areaCode,
... ... @@ -86,15 +118,26 @@ module.exports = function(useInRegister) {
},
success: function(data) {
if (data.code === 200) {
location.href = data.data;
if (useForBind) {
if (isReg) {
startBind();
} else {
location.href = '/passport/bind/password?phoneNum=' +
phoneNum + '&areaCode=' + areaCode + '&openId=' +
openId + '&sourceType=' + sourceType + '&nickname=' + nickname;
}
} else {
location.href = data.data;
}
} else {
//验证码不正确,显示提示
showErrTip(data.message);
}
}
});
});
countDown();
};
\ No newline at end of file
};
... ...
... ... @@ -3,3 +3,15 @@
color: #fff;
font-size: 15px;
}
#yohood {
background-image: image-url('yohood.png');
background-size: 40%;
background-repeat: no-repeat;
background-color: transparent;
background-position-x: 10%;
background-position-y: 40%;
border: none;
border-bottom: 4px solid #fff;
}
... ...
{{> layout/header}}
<div class="reg-code-page passport-page yoho-page">
<input type="hidden" id="isReg" value="{{isReg}}">
<input type="hidden" id="openId" value="{{openId}}">
<input type="hidden" id="sourceType" value="{{sourceType}}">
<input type="hidden" id="nickname" value="{{nickname}}">
{{> passport/code}}
</div>
{{> layout/footer}}
... ...
{{> layout/header}}
<div class="bind-page passport-page yoho-page">
<input type="hidden" id="openId" value="{{openId}}">
<input type="hidden" id="sourceType" value="{{sourceType}}">
<input type="hidden" id="nickname" value="{{nickname}}">
{{> passport/header}}
<div class="content">
{{> passport/country_list}}
... ... @@ -8,7 +11,7 @@
<input id="phone-num" class="input phone-num" type="text" placeholder="手机号">
</div>
<span id="btn-next" class="btn btn-next disable row">下一步</span>
<p class="bind-tip">YOHO!Family账号可登录Yoho!Buy有货、YOHO!Boys、YOHO!Girls及SHOW</p>
<p class="bind-tip">绑定手机号码后,可选择{{platform}}和手机号登录此帐号</p>
</div>
</div>
{{> layout/footer}}
... ...
{{> layout/header}}
<div class="bind-password-page passport-page yoho-page">
<input type="hidden" id="openId" value="{{openId}}">
<input type="hidden" id="sourceType" value="{{sourceType}}">
<input type="hidden" id="nickname" value="{{nickname}}">
{{> passport/header}}
<div class="content">
<div class="input-container row has-eye">
<input id="pwd" class="input pwd" type="text" placeholder="请输入密码" autocomplete="off" maxlength="20">
</div>
<span id="btn-sure" class="btn btn-sure disable row">确定</span>
</div>
<input id="phone-num" type="hidden" value={{phoneNum}}>
<input id="area-code" type="hidden" value={{areaCode}}>
<input id="token" type="hidden" value={{token}}>
</div>
{{> layout/footer}}
... ...
... ... @@ -52,6 +52,22 @@
seajs.use('js/passport/register/password');
</script>
{{/if}}
{{!-- 绑定手机号 --}}
{{#if bindIndex}}
<script>
seajs.use('js/passport/bind/bind');
</script>
{{/if}}
{{#if bindCode}}
<script>
seajs.use('js/passport/bind/code');
</script>
{{/if}}
{{#if bindPwd}}
<script>
seajs.use('js/passport/bind/password');
</script>
{{/if}}
{{!-- 登陆 --}}
{{#if loginIndex}}
<script>
... ...
... ... @@ -168,7 +168,7 @@ class DetailModel
foreach ($baseInfo['goodsList'] as $value) {
$sizeList = array();
$colorStorageNum = 0;
$sizeStorageStr = ''; // clear to empty
$sizeStorageStr = '';
// 商品分组
if (isset($value['goodsImagesList'])) {
... ... @@ -210,7 +210,7 @@ class DetailModel
// 缩略图
$thumbImageList[] = array('img' => Helpers::getImageUrl($value['colorImage'], 60, 60) );
// 统计每个尺码对应的各个颜色的库存量
// 统计尺码对应的各个颜色的库存量
foreach ($sizeList as &$sizeArr) {
$sizeArr['colorNumStr'] = implode('/', array_values($colorStorageGroup[ $sizeArr['name'] ]) );
}
... ...
... ... @@ -86,6 +86,7 @@ class BindController extends AbstractAction
$sourceType = $this->get('sourceType');
$nickname = $this->get('nickname');
$areaCode = $this->get('areaCode', '86');
$phoneNum=$this->get('phoneNum');
$data = array(
'bindPwd'=>true,//js标识
'backUrl' => '/', // 返回的URL链接
... ... @@ -94,7 +95,8 @@ class BindController extends AbstractAction
'sourceType' => $sourceType, // 第三方登录来源
'openId' => $openId, // openId
'nickname' => $nickname, //昵称
'areaCode' => $areaCode //国别码
'areaCode' => $areaCode, //国别码
'phoneNum' => $phoneNum //国别码
);
// 渲染模板
... ...