qiaowei | c5a87f7 | 2020-03-27 12:40:19 +0800 | [diff] [blame^] | 1 | var dict; |
| 2 | var app = { |
| 3 | |
| 4 | // Application Constructor |
| 5 | initialize: function() { |
| 6 | document.addEventListener('deviceready', this.onDeviceReady.bind(this), false); |
| 7 | }, |
| 8 | onDeviceReady: function() { |
| 9 | var phone = window.localStorage.getItem("phoneX"); |
| 10 | if(!isEmpty(phone)){ |
| 11 | $("#phone").text(phone) |
| 12 | }else{ |
| 13 | phone = window.localStorage.getItem("phone"); |
| 14 | $("#phone").text(phone) |
| 15 | } |
| 16 | app.getCode(); |
| 17 | }, |
| 18 | getCode: function() { |
| 19 | $.showLoading("正在请求"); |
| 20 | var param = { |
| 21 | } |
| 22 | V1Bindcardcode(param, function(ok, ret) { |
| 23 | if (ok) { |
| 24 | $.hideLoading(); |
| 25 | if (ret.code == 200) { |
| 26 | $("#codebtn").attr("disabled","disabled") |
| 27 | $("#codebtn").addClass("vcodedisabled") |
| 28 | btnTime('codebtn'); |
| 29 | } else { |
| 30 | if (ret.code == -1) { |
| 31 | $.alert(ret.msg, "提示", function() { |
| 32 | window.location = "main.html" |
| 33 | }); |
| 34 | } else { |
| 35 | $.alert(ret.msg, "错误"); |
| 36 | } |
| 37 | } |
| 38 | } else { |
| 39 | $.hideLoading(); |
| 40 | $.alert("请求失败了 " + ret.status + ",请稍后再试", "错误"); |
| 41 | } |
| 42 | }) |
| 43 | }, |
| 44 | doNext: function() { |
| 45 | var code = $("#code").val(); |
| 46 | if(isEmpty(code)){ |
| 47 | return; |
| 48 | } |
| 49 | $.showLoading("正在处理"); |
| 50 | var param={ |
| 51 | "code":code |
| 52 | } |
| 53 | V1UnSignbxy(param, function(ok, ret, err) { |
| 54 | if (ok) { |
| 55 | $.hideLoading(); |
| 56 | if (ret.code == 200) { |
| 57 | window.localStorage.setItem("signed", ret.signed); |
| 58 | $.alert('解除成功', "提示", function() { |
| 59 | window.location = 'main.html' |
| 60 | }); |
| 61 | } else { |
| 62 | $.alert(ret.msg, "错误"); |
| 63 | } |
| 64 | } else { |
| 65 | $.hideLoading(); |
| 66 | $.alert("请求失败了:" + ret.status + "请稍后再试", "错误"); |
| 67 | } |
| 68 | }) |
| 69 | } |
| 70 | }; |
| 71 | app.initialize(); |