From 04771b0a0544284aa06bbf6227ae60a4659bab4c Mon Sep 17 00:00:00 2001 From: qiaowei Date: Wed, 7 Aug 2019 09:23:56 +0800 Subject: [PATCH] =?utf8?q?=E4=BF=AE=E6=94=B9QRCode=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../android/app/src/main/AndroidManifest.xml | 2 +- www/js/qrcode.js | 61 ++++++++++++++++--- www/js/security.js | 11 ++-- www/js/server.js | 5 +- www/qrcode.html | 8 +-- www/security.html | 9 +++ 6 files changed, 76 insertions(+), 20 deletions(-) diff --git a/platforms/android/app/src/main/AndroidManifest.xml b/platforms/android/app/src/main/AndroidManifest.xml index 5a16756..f8296a8 100644 --- a/platforms/android/app/src/main/AndroidManifest.xml +++ b/platforms/android/app/src/main/AndroidManifest.xml @@ -2,7 +2,7 @@ - + diff --git a/www/js/qrcode.js b/www/js/qrcode.js index 35fe7a3..4664a9b 100644 --- a/www/js/qrcode.js +++ b/www/js/qrcode.js @@ -7,17 +7,58 @@ var app = { onDeviceReady: function() { var uid = window.localStorage.getItem("token"); - var qrcode = new QRCode(document.getElementById("qrcode"), { - text: uid, - width: 150, - height: 150, - colorDark : "#000000", - colorLight : "#ffffff", - correctLevel : QRCode.CorrectLevel.L - }); + this.loadQrcode(); + setInterval(function () { + window.location.reload(); + },100000); }, - toBillDetail :function(refno){ - + loadQrcode: function() { + $.showLoading("加载中"); + V1Qrcode(function(ok, ret) { + if (ok) { + console.log(ret) + if (ret.code == 200) { + $.hideLoading(); + var qrcode = new QRCode(document.getElementById("qrcode"), { + text: ret.qrcode, + width: 150, + height: 150, + colorDark: "#000000", + colorLight: "#ffffff", + correctLevel: QRCode.CorrectLevel.L + }); + } else { + $.hideLoading(); + $.alert("请求失败,请稍后再试", "错误"); + } + } else { + $.hideLoading(); + $.alert("请求失败了:" + ret.status + "请稍后再试", "错误"); + } + }) + }, + refresh:function(){ + V1Qrcode(function(ok, ret) { + if (ok) { + if (ret.code == 200) { + $.hideLoading(); + var qrcode = new QRCode(document.getElementById("qrcode"), { + text: ret.qrcode, + width: 150, + height: 150, + colorDark: "#000000", + colorLight: "#ffffff", + correctLevel: QRCode.CorrectLevel.L + }); + } else { + $.hideLoading(); + $.alert("请求失败,请稍后再试", "错误"); + } + } else { + $.hideLoading(); + $.alert("请求失败了:" + ret.status + "请稍后再试", "错误"); + } + }) } }; app.initialize(); \ No newline at end of file diff --git a/www/js/security.js b/www/js/security.js index 3586930..f12a1cc 100644 --- a/www/js/security.js +++ b/www/js/security.js @@ -4,11 +4,7 @@ var app = { initialize: function() { document.addEventListener('deviceready', this.onDeviceReady.bind(this), false); }, - onDeviceReady: function() { - var uid = window.localStorage.getItem("uid"); - var phone = window.localStorage.getItem("phoneX"); - }, editPwd: function() { window.location = "editpwd.html"; @@ -19,6 +15,13 @@ var app = { logout:function(){ window.localStorage.removeItem("token"); window.location = "login.html"; + }, + loginByTouchId: function() { + Fingerprint.isAvailable(function(result){ + alert("Fingerprint available"); + }, function(message){ + alert(message); + }); } }; app.initialize(); diff --git a/www/js/server.js b/www/js/server.js index 94f7c65..2bd6a73 100644 --- a/www/js/server.js +++ b/www/js/server.js @@ -1,11 +1,14 @@ var dev = true; -var SERVER = ""; +var SERVER = "http://ykt.supwisdom.com:10010/payapi/mobileapi"; var GLOBAL_TODAY=""; var GLOBAL_YESTERDAY=""; var CURRENT_INDEX=1; if (dev) { SERVER = "http://172.28.43.3:8099/payapi/mobileapi"; } +function V1Qrcode(callback) { + ajaxPost("/v1/qrcode", {}, callback) +} function V1Idtypes(callback) { ajaxPost("/v1/idtypes", {}, callback) } diff --git a/www/qrcode.html b/www/qrcode.html index 3391537..ca6cb07 100644 --- a/www/qrcode.html +++ b/www/qrcode.html @@ -23,10 +23,10 @@
-

请将二维码对准扫描设备

-
-
手动刷新二维码
-
+

请将二维码对准扫描设备

+ diff --git a/www/security.html b/www/security.html index 6994b22..049a988 100644 --- a/www/security.html +++ b/www/security.html @@ -31,6 +31,15 @@
+
  • -- 2.17.1