Authored by 梁志锋

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

... ... @@ -45,8 +45,8 @@ $btnNext.on('touchstart', function() {
url: '/passport/back/sendcode',
type: 'POST',
data: {
area: country.split('+')[1],
mobile: pn
areaCode: country.split('+')[1],
phoneNum: pn
},
success: function(data) {
if (data.code === 200) {
... ...
... ... @@ -14,7 +14,7 @@ var tip = require('../../plugin/tip');
var trim = $.trim;
var showErrTip = tip.show;
var $mobile = $('#mobile');
var $phoneNum = $('#phone-num');
api.bindEyesEvt();
... ... @@ -40,13 +40,13 @@ $btnOk.on('touchstart', function() {
password: pwd
};
if ($mobile.length === 0) {
if ($phoneNum.length === 0) {
mobileBack = false;
}
if (mobileBack) {
$.extend(setting, {
mobile: $mobile.val(),
phoneNum: $phoneNum.val(),
areaCode: $('#areaCode').val(),
token: $('#token').val()
});
... ... @@ -72,7 +72,7 @@ $btnOk.on('touchstart', function() {
//1000ms后跳转页面
setTimeout(function() {
location.href = '/';
location.href = data.data;
}, 1000);
} else {
showErrTip(data.message);
... ...
... ... @@ -8,7 +8,9 @@ var $ = require('yoho.zepto');
module.exports = function(useInRegister) {
var $captcha = $('#captcha'),
$btnNext = $('#btn-next'),
$captchaTip = $('#captcha-tip');
$captchaTip = $('#captcha-tip'),
phoneNum = $('#phone-num').val(),
areaCode = $('#area-code').val().split('+')[1];
var api = require('./api');
var tip = require('../plugin/tip');
... ... @@ -16,7 +18,7 @@ module.exports = function(useInRegister) {
var trim = $.trim;
var showErrTip = tip.show;
var urlMid = useInRegister ? 'register' : 'back';
var urlMid = useInRegister ? 'reg' : 'back';
function countDown() {
var count = 59,
... ... @@ -50,7 +52,11 @@ module.exports = function(useInRegister) {
$.ajax({
type: 'POST',
url: '/passport/' + urlMid + '/sendPhone',
url: '/passport/' + urlMid + '/sendcode',
data: {
phoneNum: phoneNum,
areaCode: areaCode
},
success: function(data) {
if (data.code === 200) {
$captchaTip.text('重发验证码 (60秒)').addClass('disable');
... ... @@ -73,7 +79,10 @@ module.exports = function(useInRegister) {
type: 'POST',
url: '/passport/' + urlMid + '/verifycode',
data: {
verifyCode: trim($captcha.val())
phoneNum: phoneNum,
areaCode: areaCode,
code: trim($captcha.val()),
token: $('#token').val()
},
success: function(data) {
if (data.code === 200) {
... ...
... ... @@ -78,9 +78,9 @@ $loginBtn.on('touchstart', function() {
type: 'POST',
url: '/passport/signin/auth',
data: {
area: country.split('+')[1],
account: pn,
pwd: pwd
areaCode: country.split('+')[1],
phoneNum: pn,
password: pwd
},
success: function(data) {
if (data.code === 200) {
... ...
... ... @@ -83,7 +83,7 @@ $loginBtn.on('touchstart', function() {
url: '/passport/signin/auth',
data: {
account: acc,
pwd: pwd
password: pwd
},
success: function(data) {
if (data.code === 200) {
... ...
... ... @@ -36,9 +36,12 @@ $btnSure.on('touchstart', function() {
} else {
$.ajax({
type: 'POST',
url: '/passport/register/regmobile',
url: '/passport/reg/setpassword',
data: {
password: pwd
password: pwd,
phoneNum: $('#phone-num').val(),
areaCode: $('#area-code').val(),
token: $('#token').val()
},
success: function(data) {
if (data.code === 200) {
... ...
... ... @@ -16,6 +16,8 @@ var tip = require('../../plugin/tip');
var trim = $.trim;
var showErrTip = tip.show;
api.selectCssHack($('#country-select'));
api.bindClearEvt();
$phoneNum.bind('input', function() {
... ... @@ -40,15 +42,15 @@ $btnNext.on('touchstart', function() {
if (api.phoneRegx[country].test(pn)) {
$.ajax({
url: '/passport/register/sendphone',
url: '/passport/reg/verifymobile',
type: 'POST',
data: {
area: country.split('+')[1],
profile: pn
areaCode: country.split('+')[1],
phoneNum: pn
},
success: function(data) {
if (data.code === 200) {
location.href = '/passport/register/code';
location.href = data.data;
} else {
showErrTip(data.message);
}
... ...
... ... @@ -47,6 +47,10 @@ a {
color: #000;
}
*:focus {
outline: none;
}
@font-face {
font-family: "iconfont";
src: font-url('iconfont.eot'); /* IE9*/
... ...
... ... @@ -32,7 +32,7 @@
color: #4ecae8;
}
.clear {
.clear-input {
right: 170px;
}
}
\ No newline at end of file
... ...
... ... @@ -7,9 +7,9 @@
</div>
<span id="btn-ok" class="btn btn-ok disable">完成</span>
</div>
{{#if mobile}}
<input id="mobile" type="hidden" value={{mobile}}>
<input id="area" type="hidden" value={{areaCode}}>
{{#if phoneNum}}
<input id="phone-num" type="hidden" value={{phoneNum}}>
<input id="area-code" type="hidden" value={{areaCode}}>
<input id="token" type="hidden" value={{token}}>
{{/if}}
... ...
... ... @@ -7,5 +7,8 @@
</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}}
\ No newline at end of file
... ...
... ... @@ -11,4 +11,7 @@
<div id="captcha-tip" class="captcha-tip disable">重发验证码 (60秒)</div>
</div>
<span id="btn-next" class="btn btn-next disable row">下一步</span>
<input id="phone-num" type="hidden" value={{phoneNum}}>
<input id="area-code" type="hidden" value={{areaCode}}>
<input id="token" type="hidden" value={{token}}>
</div>
\ No newline at end of file
... ...
... ... @@ -108,7 +108,7 @@ class BackController extends AbstractAction
}
// 处理地区信息
foreach ($areas as &$val) {
$val['areaCode'] = $val['area'];
$val['areaCode'] = '+'.$val['area'];
if($val['area'] === '86')
{
$val['selected'] = true;
... ... @@ -145,28 +145,36 @@ class BackController extends AbstractAction
{
if($this->isAjax())
{
$mobile = $this->post('mobile', '');
$area = $this->post('area', 86);
$phoneNum = $this->post('phoneNum', '');
$areaCode = $this->post('areaCode', 86);
// 发送手机验证码
$result = BackData::sendCodeToMobile($mobile, $area);
$result = BackData::sendCodeToMobile($phoneNum, $areaCode);
if($result['code'] === 200)
{
$result['data'] = '/passport/back/mobilecode?phoneNum='.$phoneNum.'&areaCode='.$areaCode;
}
$this->echoJson($result);
}
}
/**
* 校验验证码页面
*/
public function mobilecodeAction()
{
$mobile = $this->get('mobile', '');
$area = $this->get('area', 86);
$areacode = '+'.$area;
$phoneNum = $this->get('phoneNum', '');
$areaCode = $this->get('areaCode', 86);
$areaCode = '+'.$areaCode;
$data = array(
'backUrl' => '/passport/back/mobile',
'headerText' => '找回密码',
'isPassportPage' => true,
'areaCode' => $areacode,
'phoneNum' => $mobile
'backCode' => true,
'areaCode' => $areaCode,
'phoneNum' => $phoneNum
);
$this->_view->assign('title', 'YOHO!有货');
... ... @@ -182,12 +190,16 @@ class BackController extends AbstractAction
{
if($this->isAjax())
{
$mobile = $this->post('mobile', '');
$phoneNum = $this->post('phoneNum', '');
$code = $this->post('code', '');
$area = $this->post('area', 86);
$areaCode = $this->post('areaCode', 86);
// 校验手机验证码
$result = BackData::validateMobileCode($mobile, $code, $area);
$result = BackData::validateMobileCode($phoneNum, $code, $areaCode);
if($result['code'] === 200)
{
$result['data'] = '/passport/back/password?phoneNum='.$phoneNum.'&token='.$result['token'].'&areaCode='.$areaCode;
}
$this->echoJson($result);
}
... ... @@ -195,10 +207,10 @@ class BackController extends AbstractAction
public function passwordAction()
{
$mobile = $this->get('mobile', '');
$phoneNum = $this->get('phoneNum', '');
// 手机验证令牌
$token = $this->get('token', '');
$area = $this->get('area', 86);
$areaCode = $this->get('areaCode', 86);
// 邮箱验证码
$code = $this->get('code', '');
... ... @@ -208,9 +220,9 @@ class BackController extends AbstractAction
'headerText' => '找回密码',
'isPassportPage' => true,
'backNewPwd' => true,
'mobile' => $mobile,
'phoneNum' => $phoneNum,
'token' => $token,
'areaCode' => $area,
'areaCode' => $areaCode,
'code' => $code
);
... ... @@ -227,13 +239,17 @@ class BackController extends AbstractAction
{
if($this->isAjax())
{
$mobile = $this->post('mobile', '');
$phoneNum = $this->post('phoneNum', '');
$token = $this->post('token', '');
$newpwd = $this->post('password', '');
$area = $this->post('area', 86);
$areaCode = $this->post('areaCode', 86);
// 根据手机验证码修改密码
$result = BackData::modifyPasswordByMobile($mobile, $token, $newpwd, $area);
$result = BackData::modifyPasswordByMobile($phoneNum, $token, $newpwd, $areaCode);
if($result['code'] === 200)
{
$result['data'] = '/';
}
$this->echoJson($result);
}
... ...