blob: f97f3d468121a7aa81297ac67d60f6be632f2183 [file] [log] [blame]
qiaoweif044a742019-07-10 16:04:20 +08001var db = null;
2var app = {
3
4 // Application Constructor
5 initialize: function() {
6 document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
7 },
8
9 onDeviceReady: function() {
10 $.showLoading("加载中");
11 V1Bxy(function(ok, ret, err) {
12 if (ok) {
13 $.hideLoading();
14 if(ret.code==200){
15 $("#content").html(ret.page);
16 if(isEmpty(ret.signed)||ret.signed!='yes'){
17 $("#btn").show();
18 $("#content").css("bottom","135px");
19 }else{
20 $("#content").css("bottom","10px");
21 }
22 }else{
23 $.alert(ret.msg, "错误");
24 }
25 } else {
26 $.hideLoading();
27 $.alert("加载失败了:" + ret.status, "错误");
28 }
29 })
30 },
31 agreeXY:function(){
32 var agree = $("input[type=checkbox]:checked").val();
33 if(isEmpty(agree)){
34 $.alert("请同意签约代扣协议", "提示");
35 return;
36 }
37 $.showLoading("正在请求");
38 var param={
39 "agree":agree
40 }
41 V1Signbxy(param,function(ok, ret, err) {
42 if (ok) {
43 $.hideLoading();
44 if(ret.code==200){
45 window.localStorage.setItem("signed",ret.signed);
46 window.location="main.html";
47 }else{
48 $.alert(ret.msg, "错误");
49 }
50 } else {
51 $.hideLoading();
52 $.alert("请求失败了:" + ret.status+"请稍后再试", "错误");
53 }
54 })
55 }
56};
57app.initialize();