| var db = null; |
| var app = { |
| |
| // Application Constructor |
| initialize: function() { |
| document.addEventListener('deviceready', this.onDeviceReady.bind(this), false); |
| }, |
| |
| onDeviceReady: function() { |
| $.showLoading("加载中"); |
| V1Bxy(function(ok, ret, err) { |
| if (ok) { |
| $.hideLoading(); |
| if (ret.code == 200) { |
| $("#content").html(ret.page); |
| if (isEmpty(ret.signed) || ret.signed != 'yes') { |
| $("#btn").show(); |
| $("#content").css("bottom", "135px"); |
| } else { |
| $("#content").css("bottom", "10px"); |
| } |
| } else { |
| if (ret.code == -1) { |
| $.alert(ret.msg, "提示", function() { |
| window.location = 'bindcard.html' |
| }); |
| } else { |
| $.alert(ret.msg, "错误"); |
| } |
| } |
| } else { |
| $.hideLoading(); |
| $.alert("加载失败了:" + ret.status, "错误"); |
| } |
| }) |
| }, |
| agreeXY: function() { |
| var agree = $("input[type=checkbox]:checked").val(); |
| if (isEmpty(agree)) { |
| $.alert("请同意签约代扣协议", "提示"); |
| return; |
| } |
| $.showLoading("正在请求"); |
| var param = { |
| "agree": agree |
| } |
| 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(); |