Authored by xuqi

build back

/**
* 找回密码-验证码
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/10/8
*/
require('../code')(false);
\ No newline at end of file
... ...
/**
* 找回密码-邮箱找回成功
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/10/8
*/
var $ = require('yoho.zepto');
var $resend = $('#resend');
var api = require('../api'),
showErrTip = api.showErrTip;
api.initErrTip();
$resend.on('touchstart', function(e) {
e.preventDefault();
$.ajax({
url: $resend.data('url'),
type: 'GET'
}).then(function(data) {
if (data.code === 200) {
showErrTip(data.message);
} else {
showErrTip(data.message);
}
});
});
\ No newline at end of file
... ...
/**
* 找回密码-邮箱找回
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/10/8
*/
var $ = require('yoho.zepto');
var $email = $('#email'),
$btnSure = $('#btn-sure');
var api = require('../api');
var trim = $.trim;
var showErrTip = api.showErrTip;
api.initErrTip();
api.bindClearEvt();
$email.bind('input', function() {
if (trim($email.val()) === '') {
$btnSure.addClass('disable');
} else {
$btnSure.removeClass('disable');
}
});
$btnSure.on('touchstart', function() {
var email = trim($email.val());
if ($btnSure.hasClass('disable')) {
return;
}
if (api.emailRegx.test(email)) {
$.ajax({
url: '/passport/back/sendemail',
type: 'POST',
data: {
email: email
}
}).then(function(data) {
if (data.code === 200) {
location.href = data.data;
} else {
showErrTip(data.message);
}
});
} else {
showErrTip('邮箱格式不正确,请重新输入');
}
});
\ No newline at end of file
... ...
/**
* 找回密码-手机
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/10/8
*/
var $ = require('yoho.zepto');
var $phoneNum = $('#phone-num'),
$countrySelector = $('#country-selector'),
$countryCode = $('#country-code'),
$btnNext = $('#btn-next');
var api = require('../api');
var trim = $.trim;
var showErrTip = api.showErrTip;
api.initErrTip();
api.bindClearEvt();
$phoneNum.bind('input', function() {
if (trim($phoneNum.val()) === '') {
$btnNext.addClass('disable');
} else {
$btnNext.removeClass('disable');
}
});
$countrySelector.change(function() {
$countryCode.text($countrySelector.val());
});
$btnNext.on('touchstart', function() {
var pn = trim($phoneNum.val()),
country = $countrySelector.val();
if ($btnNext.hasClass('disable')) {
return;
}
if (api.phoneRegx.test(pn)) {
$.ajax({
url: '/passport/back/sendcode',
type: 'POST',
data: {
area: country.split('+')[1],
mobile: pn
}
}).then(function(data) {
if (data.code === 200) {
location.href = '/passport/back/code';
} else {
showErrTip(data.message);
}
});
} else {
showErrTip('手机号格式不正确,请重新输入');
}
});
\ No newline at end of file
... ...
/**
* 密码找回-新密码
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/10/8
*/
var $ = require('yoho.zepto');
var $pwd = $('#pwd'),
$btnOk = $('#btn-ok');
var api = require('../api');
var trim = $.trim;
var showErrTip = api.showErrTip;
api.initErrTip();
api.bindEyesEvt();
$pwd.bind('input', function() {
if (trim($pwd.val()) === '') {
$btnOk.addClass('disable');
} else {
$btnOk.removeClass('disable');
}
});
$btnOk.on('touchstart', function() {
var pwd = trim($pwd.val());
if ($btnOk.hasClass('disable')) {
return;
}
if (api.pwdValidate(pwd)) {
$.ajax({
type: 'POST',
url: '/passport/back/update',
data: {
password: pwd
}
}).then(function(data) {
if (data.code === 200) {
showErrTip('密码修改成功');
//1000ms后跳转页面
setTimeout(function() {
location.href = '/';
}, 1000);
} else {
showErrTip(data.message);
}
});
} else {
showErrTip('密码6-20位,请重新输入');
}
});
\ No newline at end of file
... ...
.back-email-success-page {
.tip {
font-size: 20px;
color: #fff;
margin-top: 30px;
}
.sub-tip, .resend {
color: #939393;
font-size: 16px;
}
.go-email {
margin: 20px 0 10px;
}
.resend {
float: right;
}
}
\ No newline at end of file
... ...
<div class="back-email-success-page passport-page yoho-page">
{{> passport/header}}
<div class="content">
<p class="tip">验证邮件已发送至你的邮箱</p>
<p class="sub-tip">请在24小时内通过邮件内的链接设置新密码</p>
<a class="go-email btn" href="<?php echo $this->name;?>">去邮箱看看</a>
<a id="resend" class="resend" data-url={{resendUrl}}>重新发送邮件</a>
</div>
</div>
\ No newline at end of file
... ...
<div class="back-email-page passport-page yoho-page">
{{> passport/header}}
<div class="content">
<div class="input-container row has-clear">
<input id="email" class="input email" type="text" placeholder="请输入邮箱" autocomplete="off">
</div>
<span id="btn-sure" class="btn btn-sure disble row">确定</span>
</div>
</div>
\ No newline at end of file
... ...
<div class="back-code-page passport-page yoho-page">
{{> passport/code}}
</div>
\ No newline at end of file
... ...
<div class="back-mobile-page passport-page yoho-page">
{{> passport/header}}
<div class="content">
{{> passport/country_list}}
<div class="input-container phone-container row has-clear">
<span id="country-code" class="country-code">{{countryCode}}</span>
<input id="phone-num" class="input phone-num" type="text" placeholder="手机号">
</div>
<span id="btn-next" class="btn btn-next disble row">下一步</span>
</div>
</div>
\ No newline at end of file
... ...
<div class="back-new-password-page passport-page yoho-page">
{{> 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-ok" class="btn btn-ok disable">完成</span>
</div>
</div>
\ No newline at end of file
... ...