qlg.frontend/js/setting_fogetPwd.js
2019-09-06 10:45:33 +08:00

209 lines
5.7 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mui.plusReady(function() {
var wait = 120;
function time() {
if (wait == 0) {
$('#mobileCode').removeAttr("disabled");
$('#mobileCode').val("重新发送");
wait = 120;
} else {
$('#mobileCode').attr("disabled", true);
$('#mobileCode').val("重新发送(" + wait + ")");
wait--;
setTimeout(function() {
time();
},
1000)
}
}
mui('.row').on('tap', '#mobileCode', function() {
var that = $(this);
$(this).attr("disabled", true);
mui.ajax(qlgUrl('app/users/getfindPhone'), {
data: {},
dataType: 'json', //服务器返回json格式数据
type: 'post', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒
success: function(data) {
var data = toJson(data);
//服务器返回响应,根据响应结果,分析是否登录成功;
if (data.status == 1) {
time();
} else {
mui.alert(data.msg)
}
that.removeAttr('disabled');
},
error: function(xhr, type, errorThrown) {
//异常处理;
// mui.alert(type)
// mui.alert(type);
}
});
})
mui('.down').on('tap', '#true0', function() {
var loginName0 = $('#loginName0').val();
var that = $(this);
if (loginName0 == '') {
mui.alert('用户名不能为空!');
return;
}
that.attr('disabled', 'disabled');
mui.ajax(qlgUrl('app/users/findPass'), {
data: {
loginName: loginName0,
step: 1
},
dataType: 'json', //服务器返回json格式数据
type: 'post', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
// //console.log(data.data.goodsFavoritesNum)
// //console.log(data.data.Rows)
var data = toJson(data);
if (data.status == 1) {
$('#con0').css('display', 'none');
$('#down0').css('display', 'none');
$('#con1').css('display', 'block');
$('#down1').css('display', 'block');
mui.ajax(hyhUrl('app/users/forgetPasst'), {
data: {},
dataType: 'json', //服务器返回json格式数据
type: 'post', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
// //console.log(data.data.goodsFavoritesNum)
// //console.log(data.data.Rows)
var data = toJson(data);
if (data.status == 1) {
$('#loginName').val(data.data.loginName);
$('#loginName').attr('disabled', 'disabled');
$('#userPhone').val(data.data.userPhone);
$('#userPhone').attr('disabled', 'disabled');
} else {
mui.alert(data.msg);
}
that.removeAttr('disabled')
},
error: function(xhr, type, errorThrown) { //异常处理;
// mui.alert(type);
}
});
} else {
mui.alert(data.msg);
}
that.removeAttr('disabled')
},
error: function(xhr, type, errorThrown) { //异常处理;
// mui.alert(type);
}
});
})
mui('.down').on('tap', '#true', function() {
var phoneCode = $('#phoneCode').val();
var that = $(this);
if (phoneCode == '') {
mui.alert('验证码不能为空!');
return;
} else if (phoneCode.length < 4) {
mui.alert('验证码格式不正确!');
return;
}
that.attr('disabled', 'disabled');
mui.ajax(qlgUrl('app/users/findPass'), {
data: {
Checkcode: phoneCode,
modes: 1,
step: 2
},
dataType: 'json', //服务器返回json格式数据
type: 'post', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
// //console.log(data.data.goodsFavoritesNum)
// //console.log(data.data.Rows)
var data = toJson(data);
if (data.status == 1) {
////console.log(data);
//alert(1)
document.getElementById("con1").style.display = "none";
document.getElementById("down1").style.display = "none";
document.getElementById("con2").style.display = "block";
document.getElementById("down2").style.display = "block";
//$('#con1').css('display', 'none');
//$('#down1').css('display', 'none');
//$('#con2').css('display', 'block');
//$('#down2').css('display', 'block');
} else {
mui.alert(data.msg);
}
that.removeAttr('disabled')
},
error: function(xhr, type, errorThrown) { //异常处理;
mui.alert(type);
}
});
})
mui('.down').on('tap', '#true2', function() {
var loginPwd = $('#loginPwd').val();
var repassword = $('#repassword').val();
var that = $(this);
if (loginPwd == '') {
mui.alert('登录密码不能为空!');
return;
} else if (loginPwd.length < 6) {
mui.alert('登录密码最少为6位');
return;
} else if (loginPwd != repassword) {
mui.alert('两次支付密码不相同!');
return;
}
that.attr('disabled', 'disabled');
mui.ajax(qlgUrl('app/users/findPass'), {
data: {
step: 3,
loginPwd: loginPwd,
repassword: repassword
},
dataType: 'json', //服务器返回json格式数据
type: 'post', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
// //console.log(data.data.goodsFavoritesNum)
// //console.log(data.data.Rows)
var data = toJson(data);
if (data.status == 1) {
mui.alert(data.msg);
mui.back();
} else {
mui.alert(data.msg);
}
that.removeAttr('disabled');
},
error: function(xhr, type, errorThrown) { //异常处理;
// mui.alert(type);
}
});
})
})