blob: 32dba4c932f875761a669614b70475c414feeee5 [file] [log] [blame]
var dict;
var app = {
// Application Constructor
initialize: function() {
document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
},
onDeviceReady: function() {
var phone = window.localStorage.getItem("phoneX");
if(!isEmpty(phone)){
$("#phone").text(phone)
}else{
phone = window.localStorage.getItem("phone");
$("#phone").text(phone)
}
$("#codebtn").attr("disabled","disabled")
$("#codebtn").addClass("vcodedisabled")
btnTime('codebtn');
},
getCode: function() {
var name = window.localStorage.getItem("name");
var cardno = window.localStorage.getItem("cardno");
var idtype = window.localStorage.getItem("idtype");
var idno = window.localStorage.getItem("idno");
$.showLoading("正在请求");
var param = {
"cardno": cardno,
"idtype": idtype,
"name": name,
"idno": idno
}
V1Bindcard(param, function(ok, ret) {
if (ok) {
$.hideLoading();
if (ret.code == 200) {
$("#codebtn").attr("disabled","disabled")
$("#codebtn").addClass("vcodedisabled")
btnTime('codebtn');
} else {
if (ret.code == -1) {
$.alert(ret.msg, "提示", function() {
window.location = "main.html"
});
} else {
$.alert(ret.msg, "错误");
}
}
} else {
$.hideLoading();
$.alert("请求失败了 " + ret.status + ",请稍后再试", "错误");
}
})
},
doNext: function() {
var code = $("#code").val();
if(isEmpty(code)){
return;
}
var personid = window.localStorage.getItem("personid");
$.showLoading("正在处理");
var param={
"personid":personid,
"code":code,
}
V1Checkcode(param,function(ok,ret){
if(ok){
$.hideLoading();
console.log(ret)
if(ret.code==200){
window.localStorage.setItem("paypwdtype", "new");
window.localStorage.setItem("userid", personid);
var signed = window.localStorage.getItem("signed");
var paypwdset = window.localStorage.getItem("paypwdset");
console.log(paypwdset)
if (!paypwdset||'false'==paypwdset) {
window.location = "paypwdset.html";
} else {
if (!isEmpty(signed) && signed == 'yes') {
window.location = 'main.html'
} else {
window.location = 'signxy.html'
}
}
}else{
$.alert(ret.msg, "错误");
}
}else{
$.hideLoading();
$.alert("请求失败了"+ret.status+",请稍后再试", "错误");
}
})
}
};
app.initialize();