| 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) |
| } |
| app.getCode(); |
| }, |
| 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; |
| } |
| $.showLoading("正在处理"); |
| var param={ |
| "code":code |
| } |
| V1UnSignbxy(param, function(ok, ret, err) { |
| if (ok) { |
| $.hideLoading(); |
| if (ret.code == 200) { |
| window.localStorage.setItem("signed", ret.signed); |
| $.alert('解除成功', "提示", function() { |
| window.location = 'main.html' |
| }); |
| } else { |
| $.alert(ret.msg, "错误"); |
| } |
| } else { |
| $.hideLoading(); |
| $.alert("请求失败了:" + ret.status + "请稍后再试", "错误"); |
| } |
| }) |
| } |
| }; |
| app.initialize(); |