qiaowei | f044a74 | 2019-07-10 16:04:20 +0800 | [diff] [blame^] | 1 | var app = { |
| 2 | |
| 3 | // Application Constructor |
| 4 | initialize: function() { |
| 5 | document.addEventListener('deviceready', this.onDeviceReady.bind(this), false); |
| 6 | }, |
| 7 | |
| 8 | onDeviceReady: function() { |
| 9 | var uid = window.localStorage.getItem("uid"); |
| 10 | var phone = window.localStorage.getItem("phoneX"); |
| 11 | if(!isEmpty(phone)){ |
| 12 | $("#phone").val(phone) |
| 13 | }else{ |
| 14 | phone = window.localStorage.getItem("phone"); |
| 15 | $("#phone").val(phone) |
| 16 | } |
| 17 | }, |
| 18 | doNext: function() { |
| 19 | var code = $("#code").val(); |
| 20 | var cardnum = $("#cardnum").val(); |
| 21 | var name = $("#name").val(); |
| 22 | if(isEmpty(name)||isEmpty(code)||isEmpty(cardnum)){ |
| 23 | return; |
| 24 | } |
| 25 | /*var agree = $("input[type=checkbox]:checked").val(); |
| 26 | if(isEmpty(agree)){ |
| 27 | $.alert("请同意用户协议与隐私条款", "提示"); |
| 28 | return; |
| 29 | }*/ |
| 30 | $.showLoading("正在处理"); |
| 31 | var param={ |
| 32 | "card":cardnum, |
| 33 | "code":code, |
| 34 | "name":name |
| 35 | } |
| 36 | V1Bindcard(param,function(ok,ret){ |
| 37 | if(ok){ |
| 38 | $.hideLoading(); |
| 39 | console.log(ret) |
| 40 | if(ret.code==200){ |
| 41 | window.localStorage.setItem("paypwdtype","new"); |
| 42 | window.localStorage.setItem("userid",ret.userid); |
| 43 | window.localStorage.setItem("signed",ret.signed); |
| 44 | window.localStorage.setItem("name",name); |
| 45 | window.localStorage.setItem("paypwdset",ret.paypwdset); |
| 46 | if(ret.paypwdset){ |
| 47 | if(!isEmpty(ret.signed)&&signed=='yes'){ |
| 48 | window.location='main.html' |
| 49 | }else{ |
| 50 | window.location='signxy.html' |
| 51 | } |
| 52 | }else{ |
| 53 | window.location="paypwdset.html"; |
| 54 | } |
| 55 | }else{ |
| 56 | if(ret.code==-1){ |
| 57 | $.alert(ret.msg, "提示",function(){ |
| 58 | window.location="main.html" |
| 59 | }); |
| 60 | }else{ |
| 61 | $.alert(ret.msg, "错误"); |
| 62 | } |
| 63 | } |
| 64 | }else{ |
| 65 | $.hideLoading(); |
| 66 | $.alert("请求失败了 "+ret.status+",请稍后再试", "错误"); |
| 67 | } |
| 68 | }) |
| 69 | }, |
| 70 | getCode :function(){ |
| 71 | $.showLoading("请求中"); |
| 72 | V1Code(function(ok,ret){ |
| 73 | if(ok){ |
| 74 | $.hideLoading(); |
| 75 | if(ret.code==200){ |
| 76 | $("#codebtn").attr("disabled","disabled") |
| 77 | $("#codebtn").addClass("vcodedisabled") |
| 78 | btnTime('codebtn'); |
| 79 | }else{ |
| 80 | $.alert(ret.msg, "错误"); |
| 81 | } |
| 82 | }else{ |
| 83 | $.hideLoading(); |
| 84 | $.alert("请求失败了"+ret.status+",请稍后再试", "错误"); |
| 85 | } |
| 86 | }) |
| 87 | } |
| 88 | }; |
| 89 | app.initialize(); |