Authored by xuqi

link test ajax

... ... @@ -8,7 +8,9 @@ var $ = require('yoho.zepto');
module.exports = function(useInRegister) {
var $captcha = $('#captcha'),
$btnNext = $('#btn-next'),
$captchaTip = $('#captcha-tip');
$captchaTip = $('#captcha-tip'),
mobile = $('#mobile').val(),
area = $('#area').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: mobile,
areaCode: area
},
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())
mobile: mobile,
area: area,
code: trim($captcha.val()),
token: $('#token').val()
},
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,
mobile: $('#phone-num').val(),
area: $('#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
mobile: pn
},
success: function(data) {
if (data.code === 200) {
location.href = '/passport/register/code';
location.href = data.data;
} else {
showErrTip(data.message);
}
... ...
... ... @@ -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="mobile" type="hidden" value={{phoneNum}}>
<input id="area" type="hidden" value={{areaCode}}>
<input id="token" type="hidden" value={{token}}>
</div>
\ No newline at end of file
... ...