| 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() { |
| $.showLoading("正在请求"); |
| var param = { |
| } |
| V1Bindcardcode(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 agree = $("input[type=checkbox]:checked").val(); |
| if(isEmpty(agree)){ |
| $.alert("请同意市民卡免密代扣签约协议", "提示"); |
| return; |
| } |
| $.showLoading("正在处理"); |
| var param={ |
| "agree":code |
| } |
| V1Signbxy(param,function(ok, ret, err) { |
| if (ok) { |
| $.hideLoading(); |
| if(ret.code==200){ |
| window.localStorage.setItem("signed",ret.signed); |
| window.location="main.html"; |
| }else{ |
| $.alert(ret.msg, "错误"); |
| } |
| } else { |
| $.hideLoading(); |
| $.alert("请求失败了:" + ret.status+"请稍后再试", "错误"); |
| } |
| }) |
| } |
| }; |
| app.initialize(); |