qlg.tsgz.moe/static/app2/js/individual.js
2020-06-10 13:23:50 +08:00

180 lines
4.0 KiB
JavaScript
Executable File

mui.plusReady(function() {
var wait = 120;
var count = 0;
var authId = '';
JZL.getItems('auth_personal');
$('.header_con_bc').on('tap', function() {
JZL.saveItems('.localinp', 'auth_personal');
mui.toast('保存成功');
})
// //console.log($('#headImg').val());
if ('' == $('#headImg').val()) {
$("#headImgTag").attr("src", "../img/touxiang.jpg")
}
if ('' == $('#accountBookImg').val()) {
$("#accountBookImgTag").attr("src", "../img/hukou.jpg")
}
JZL.ajax(qlgUrl('app/auth/getAuthInfo'), {}, function(data) {
//console.log(data);
// //console.log(typeof(data.data));
if ('undefined' != typeof(data.data) && 1 == data.status) { //编辑
count = 1;
authId = data.data.id
$('.mobileCode').hide()
$('.userPhone').hide()
$('.payPwd').show()
mui.each(data.data, function(index, element) {
if ($('#' + index).attr("type") == "hidden") {
// var imgindex = index.substring(0, index.length - 3);
var imgindex = index + 'Tag'
var obj = '#' + imgindex
// //console.log('#' + imgindex + '')
if (imgindex != "") {
if ($(obj).is('img')) {
$(obj).attr("src", hyhImgUrl(element))
$('#' + index + '').val(element)
}
}
} else {
$('#' + index).val(element)
}
})
// if (data.status == 1) {
// $('.qrbb').show();
// $('.qrrz').show();
// } else {
// $('.qrbb').hide();
// $('.qrrz').hide();
// }
} else {
//console.log(2222);
$('.userPhone').show()
$('.mobileCode').show()
$('.payPwd').hide()
JZL.getItems('auth_company');
}
})
function time() {
if (wait == 0) {
$('.HQYZM').removeAttr("disabled");
$('.HQYZM').html("重新发送");
wait = 120;
} else {
$('.HQYZM').attr("disabled", true);
$('.HQYZM').html("重新发送(" + wait + ")");
wait--;
setTimeout(function() {
time()
},
1000)
}
}
$(".HQYZM").on("tap", function() {
var userPhone = $('#userPhone').val();
if ('' == userPhone) {
mui.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))) {
mui.alert("手机号码有误,请重填!");
return;
}
$(".HQYZM").attr("disabled", true);
JZL.ajax(qlgUrl('app/auth/getPhoneCode'), {
userPhone: userPhone
}, function(data) {
//console.log(data);
if (data.status == 1) {
time();
$('.YZM').focus();
} else {
mui.alert(data.msg);
}
})
})
$('.bc_btn').on('tap', function() {
var params = JZL.getParams(".inp");
if ('' == params.houseAddress) {
mui.alert("请输入地址");
return;
}
if ('' == params.householdIdCard) {
mui.alert("请输入身份证号");
return;
}
if ('' == params.householdName) {
mui.alert("请输入户主姓名");
return;
}
if (0 == count) {
if ('' == params.mobileCode) {
mui.alert("请输入验证码");
return;
}
} else if (1 == count) {
if ('' == params.payPwd) {
mui.alert("请输入操作密码");
return;
}
params.authId = authId;
}
//console.log(params);
JZL.ajax(qlgUrl('app/auth/setAuthInfo'), params, function(data) {
//console.log(data);
if (data.status == 1) {
JZL.saveItems('.localinp', 'auth_personal');
localStorage.setItem("authType","1")
mui.toast("提交成功 请等待审核")
// $(".mui-table-view").attr("readonly", "readonly")
$(".mobileCode").attr("display", "none")
mui.back();
} else {
mui.alert(data.msg);
}
})
})
mui('.mui-table-content').on('tap', '.qrbb', function() {
JZL.openWindow('qrbb.html', 'qrbb.html');
})
mui('.mui-table-content').on('tap', '.qrrz', function() {
JZL.openWindow('qrrz.html', 'qrrz.html');
})
$(".ossfile").on("tap", '#accountBookImgTag', function() {
UP.init("accountBookImg", "test", "accountBookImgTag")
// UP.init("id", "test", "imgId")
openCamera();
})
//更换头像
$("#headerimg").on("tap", '#headImgTag', function() {
UP.init("headImg", "test", "headImgTag")
openCamera();
})
})