解决安卓扫码问题
diff --git a/www/js/main.js b/www/js/main.js
index 3b01a2a..90977da 100644
--- a/www/js/main.js
+++ b/www/js/main.js
@@ -4,11 +4,61 @@
     initialize: function() {
         this.initTab();
         document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
+        document.addEventListener('jpush.receiveRegistrationId', function(event) {
+             console.log(event.registrationId)
+        }, false)
+        document.addEventListener("jpush.openNotification", function (event) {
+          var refno
+          console.log("openNotify:"+event);
+          if(device.platform == "Android") {
+            refno = event.extras.refno
+          } else {
+            refno = event.refno
+            window.JPush.setApplicationIconBadgeNumber(0);
+          }
+          app.openBill(refno);
+          console.log("openNotify:"+refno);
+        }, false)
+    },
+    openBill:function(billno){
+        window.localStorage.setItem("currentrefno",billno);
+        window.location='billdetail.html';
+    },
+    initJpush: function() {
+        if(device.platform == "Android") {
+        } else {
+         window.JPush.setApplicationIconBadgeNumber(0);
+        }
+        window.JPush.init();
+        window.JPush.setDebugMode(true);
+        window.JPush.isPushStopped(function(result) {
+            if (result == 0) {
+                //window.JPush.resumePush();
+            } else {
+                window.JPush.resumePush();
+            }
+        });
+        window.JPush.getUserNotificationSettings(function(result) {
+          if(result == 0) {
+          } else if(result > 0) {
+          }
+         });
+        var uid = window.localStorage.getItem("uid");
+        window.JPush.setAlias({ sequence: 1, alias: uid },
+          (result) => {
+            var sequence = result.sequence
+            var alias = result.alias
+            //alert(JSON.stringify(result))
+          }, (error) => {
+            var sequence = error.sequence
+            var errorCode = error.code
+            //alert(JSON.stringify(error))
+          })
     },
 
     onDeviceReady: function() {
         var uid = window.localStorage.getItem("token");
-        console.log(CURRENT_INDEX);
+        this.initJpush();
         $('#scanBtn').click(function() {
             //window.location = "scan.html";
             app.checkBefore(function() {
@@ -42,11 +92,12 @@
             })
         });
         $('#secBtn').click(function() {
-            app.checkBefore(function() {
+            window.location = "security.html";
+            /*app.checkBefore(function() {
                 app.checkOther(function() {
                     window.location = "security.html";
                 })
-            })
+            })*/
         });
         $('#usersec').click(function() {
             app.checkBefore(function() {
@@ -57,22 +108,23 @@
         });
         this.initData();
     },
-    initTab:function(){
+    initTab: function() {
         $("#maincontent").css("top", $("#maintop").height())
         var tab = new auiTab({
             element: document.getElementById("footer"),
         }, function(ret) {
-            window.localStorage.setItem("tabindex",ret.index); 
-            
+            window.localStorage.setItem("tabindex", ret.index);
+
             changeTab(ret.index);
         });
-        var tabindex =  window.localStorage.getItem("tabindex"); 
-        if(!tabindex||tabindex==0){
+        var tabindex = window.localStorage.getItem("tabindex");
+        if (!tabindex || tabindex == 0) {
             tabindex = 1
         }
         changeTab(tabindex);
         tab.setActive(tabindex)
-        function changeTab(index){
+
+        function changeTab(index) {
             if (index == 1) {
                 $("#main1").show();
                 $("#main2").hide();
@@ -93,8 +145,9 @@
         }
         V1Bills(param, function(ok, ret) {
             if (ok) {
-                console.log(ret)
+                //console.log(ret)
                 if (ret.code == 200) {
+                    app.checkVersion(ret.version,ret.minversion,ret.versionmsg);
                     $("#maingt").text(ret.t + "!")
                     $("#user-amount").text(ret.amount)
                     $("#user-point").text(ret.point)
@@ -131,7 +184,17 @@
             }
         })
     },
-
+    checkVersion:function(ver,minver,msg){
+        cordova.getAppVersion.getVersionNumber(function (version) {
+            //alert(version);
+            if(version<minver){
+                //TODO 强制升级
+                alert("当前版本过低,为了不影响您的使用,请先升级");
+            }else if(ver>version){
+                alert("有新的版本");    
+            }
+        });
+    },
     initBillView: function(page) {
         var html = '';
         for (var i = 0; i < page.data.length; i++) {
@@ -255,4 +318,4 @@
         }
     }
 };
-app.initialize();
\ No newline at end of file
+app.initialize();