Files
addons
app_download_files
extend
hyhproject
mobile
oss
static
app
css
img
js
activity1.js
activity10.js
activity2.js
activity3.js
activity4.js
activity5.js
activity6.js
activity7.js
activity8.js
activity9.js
appraise.js
binaryajax.js
canvasResize.js
choiceness.js
classify.js
collect.js
collect_commodity.js
collect_store.js
common.js
common_home.js
complain.js
confirmOrder.js
details.js
details_ac.js
discounts.js
dynamic.js
ect_address.js
ect_index.js
ect_list.js
ect_transfer_accounts.html.js
ect_transfer_accounts.js
editAddress.js
exif.js
goodsList.js
home.js
indent.js
indentcon.js
index.js
journalism.js
journalism_con.js
jquery-3.2.1.min.js
login.js
logistics.js
logisticscon.js
msg.js
msg_con.js
mui.js
mui.min.js
my.js
new_product.js
newuser.js
order_con.js
order_out.js
photoswipe-ui-default.min.js
photoswipe.js
pj.js
plupload.full.min.js
qrcode.js
register.js
setting.js
setting_address.js
setting_fogetPayPwd.js
setting_fogetPwd.js
setting_loginInfo.js
setting_payPwd.js
setting_phone.js
setting_pwd.js
setting_user.js
share.js
share_user_list.js
shopGoodsList.js
shoppingcart.js
shopsList.js
store_activity.js
store_class.js
store_commodity.js
store_home.js
store_info.js
store_new.js
storeout.js
swiper.min.js
time_limit.js
upload.js
upload1.js
app2
images
js
plugins
src
template
thinkphp
upload
vendor
wxtmp
.gitignore
.htaccess
.user.ini
404.html
H5436787D.wgt
admin.php
app-release.apk
app_download.html
cash.lock
demo.php
get_startup.php
get_version.php
get_version_new.php
index.html
index.php
reg.lock
robots.txt
qlg.tsgz.moe/static/app/js/setting_phone.js
2019-09-06 23:53:10 +08:00

256 lines
6.8 KiB
JavaScript
Executable File

mui.plusReady(function() {
var token = localStorage.getItem('token');
var isBang = 0;
var isOver = 1;
var wait = 120;
var wait1 = 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)
}
}
function time1() {
if(wait1 == 0) {
$('#mobileCode1').removeAttr("disabled");
$('#mobileCode1').val("重新发送");
wait1 = 120;
} else {
$('#mobileCode1').attr("disabled", true);
$('#mobileCode1').val("重新发送(" + wait1 + ")");
wait1--;
setTimeout(function() {
time1();
},
1000)
}
}
mui.ajax(hyhUrl('app/users/editPhone'), { 
headers: { 
"HYH-Token": token
},
data: {},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒;  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data);
if(data.status == 1) {
data = data.data;
if(data.userPhone) {
isBang = 1;
$('#userPhone').val(data.userPhone);
$('#userPhone').attr('disabled', 'disabled');
$('#next_btn').css('display', 'block');
} else {
$('#true').css('display', 'block');
}
} else {
alert(data.msg);
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
mui('.row').on('tap', '.codeBtn', function() {
var that = $(this)
var userPhone = $('#userPhone').val();
var url = $(this).attr('id') == 'mobileCode' ? 'sendCodeEdit' : 'sendCodeTie'
if(isBang == 0 || isOver == 0) {
if(userPhone == '') {
alert('手机号不能为空!');
return;
}
if(!(/^134[0-8]\d{7}$|^13[^4]\d{8}$|^14[5-9]\d{8}$|^15[^4]\d{8}$|^16[6]\d{8}$|^17[0-8]\d{8}$|^18[\d]{9}$|^19[8,9]\d{8}$/.test(userPhone))) {
alert("手机号码有误,请重填!");
return;
}
} else {
userPhone = '';
}
$(this).attr("disabled", true);
mui.ajax(hyhUrl('app/users/' + url), { 
data: {
userPhone: userPhone
},
dataType: 'json', //服务器返回json格式数据
type: 'post', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒
success: function(data) {
var data = toJson(data);
//服务器返回响应,根据响应结果,分析是否登录成功;
if(data.status == 1) {
if(that.attr('id') == 'mobileCode') {
time();
} else if(that.attr('id') == 'mobileCode1') {
time1();
}
} else {
alert(data.msg)
}
that.removeAttr('disabled');
},
error: function(xhr, type, errorThrown) {
//异常处理;
// alert(type)
// alert(type);      
}
}); 
})
//未绑定手机
mui('.down').on('tap', '#true', function() {
var phoneCode = $('#phoneCode').val();
var that = $(this);
if(phoneCode == '') {
alert('验证码不能为空!');
return;
} else if(phoneCode.length < 4) {
alert('验证码格式不正确!');
return;
}
that.attr('disabled', 'disabled');
mui.ajax(hyhUrl('app/users/phoneEdit'), { 
headers: { 
"HYH-Token": token
},
data: {
phoneCode: phoneCode
},
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) {
alert(data.msg);
mui.back();
} else {
alert(data.msg);
}
that.removeAttr('disabled')
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
})
//已绑定手机 1
mui('.down').on('tap', '#next_btn', function() {
var phoneCode = $('#phoneCode').val();
var that = $(this);
if(phoneCode == '') {
alert('验证码不能为空!');
return;
} else if(phoneCode.length < 4) {
alert('验证码格式不正确!');
return;
}
that.attr('disabled', 'disabled');
mui.ajax(hyhUrl('app/users/phoneEdito'), { 
headers: { 
"HYH-Token": token
},
data: {
phoneCode: phoneCode
},
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) {
$('#next_btn').css('display', 'none');
$('#next_true').css('display', 'block');
$('#userPhone').removeAttr('disabled');
$('#userPhone').val('');
$('#phoneCode').val('');
$('#mobileCode').css('display', 'none');
$('#mobileCode1').css('display', 'block');
isOver = 0;
} else {
alert(data.msg);
}
that.removeAttr('disabled');
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
})
//已绑定手机 2
mui('.down').on('tap', '#next_true', function() {
var phoneCode = $('#phoneCode').val();
var that = $(this);
if(phoneCode == '') {
alert('验证码不能为空!');
return;
} else if(phoneCode.length < 4) {
alert('验证码格式不正确!');
return;
}
that.attr('disabled', 'disabled');
mui.ajax(hyhUrl('app/users/phoneEdit'), { 
headers: { 
"HYH-Token": token
},
data: {
phoneCode: phoneCode
},
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) {
alert(data.msg);
mui.back();
} else {
alert(data.msg);
}
that.removeAttr('disabled');
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(type);      
}  
}); 
})
})