blob: 32dba4c932f875761a669614b70475c414feeee5 [file] [log] [blame]
qiaowei60c27e42019-07-11 16:43:54 +08001var dict;
2var 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 }
qiaowei5f8f92f2019-11-15 10:27:57 +080016 $("#codebtn").attr("disabled","disabled")
17 $("#codebtn").addClass("vcodedisabled")
18 btnTime('codebtn');
19 },
20 getCode: function() {
21 var name = window.localStorage.getItem("name");
22 var cardno = window.localStorage.getItem("cardno");
23 var idtype = window.localStorage.getItem("idtype");
24 var idno = window.localStorage.getItem("idno");
25
26 $.showLoading("正在请求");
27 var param = {
28 "cardno": cardno,
29 "idtype": idtype,
30 "name": name,
31 "idno": idno
32 }
33 V1Bindcard(param, function(ok, ret) {
34 if (ok) {
35 $.hideLoading();
36 if (ret.code == 200) {
37 $("#codebtn").attr("disabled","disabled")
38 $("#codebtn").addClass("vcodedisabled")
39 btnTime('codebtn');
40 } else {
41 if (ret.code == -1) {
42 $.alert(ret.msg, "提示", function() {
43 window.location = "main.html"
44 });
45 } else {
46 $.alert(ret.msg, "错误");
47 }
48 }
49 } else {
50 $.hideLoading();
51 $.alert("请求失败了 " + ret.status + ",请稍后再试", "错误");
52 }
53 })
qiaowei60c27e42019-07-11 16:43:54 +080054 },
55 doNext: function() {
56 var code = $("#code").val();
57 if(isEmpty(code)){
58 return;
59 }
60 var personid = window.localStorage.getItem("personid");
61 $.showLoading("正在处理");
62 var param={
63 "personid":personid,
64 "code":code,
65 }
66 V1Checkcode(param,function(ok,ret){
67 if(ok){
68 $.hideLoading();
69 console.log(ret)
70 if(ret.code==200){
71 window.localStorage.setItem("paypwdtype", "new");
72 window.localStorage.setItem("userid", personid);
73 var signed = window.localStorage.getItem("signed");
74 var paypwdset = window.localStorage.getItem("paypwdset");
75 console.log(paypwdset)
76 if (!paypwdset||'false'==paypwdset) {
77 window.location = "paypwdset.html";
78 } else {
79 if (!isEmpty(signed) && signed == 'yes') {
80 window.location = 'main.html'
81 } else {
82 window.location = 'signxy.html'
83 }
84 }
85 }else{
86 $.alert(ret.msg, "错误");
87 }
88 }else{
89 $.hideLoading();
90 $.alert("请求失败了"+ret.status+",请稍后再试", "错误");
91 }
92 })
93 }
94};
95app.initialize();