修改QRCode问题
authorqiaowei <jov123@163.com>
Wed, 7 Aug 2019 01:23:56 +0000 (09:23 +0800)
committerqiaowei <jov123@163.com>
Wed, 7 Aug 2019 01:23:56 +0000 (09:23 +0800)
platforms/android/app/src/main/AndroidManifest.xml
www/js/qrcode.js
www/js/security.js
www/js/server.js
www/qrcode.html
www/security.html

index 5a16756..f8296a8 100644 (file)
@@ -2,7 +2,7 @@
 <manifest android:hardwareAccelerated="true" android:versionCode="10000" android:versionName="1.0.0" package="com.supwisdom.dlapp" xmlns:android="http://schemas.android.com/apk/res/android">
     <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
     <uses-permission android:name="android.permission.INTERNET" />
-    <application android:hardwareAccelerated="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true">
+    <application android:hardwareAccelerated="true" android:icon="@mipmap/ic_launcher" android:label="@string/launcher_name" android:supportsRtl="true">
         <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:screenOrientation="portrait" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
             <intent-filter android:label="@string/launcher_name">
                 <action android:name="android.intent.action.MAIN" />
index 35fe7a3..4664a9b 100644 (file)
@@ -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
index 3586930..f12a1cc 100644 (file)
@@ -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();
index 94f7c65..2bd6a73 100644 (file)
@@ -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)
 }
index 3391537..ca6cb07 100644 (file)
     <div style="display: flex;flex-direction: row;justify-content: center;align-items: center;margin-top: 50px;">
         <div style="background: #fff;text-align: center;" id="qrcode"></div>
     </div>
-    <p style="text-align: center;margin-top:20px;color:#999">请将二维码对准扫描设备</p>
-    <div style="padding: 30px;">
-        <div class="aui-btn aui-btn-block aui-btn-info" tapmode onclick="app.refresh()">手动刷新二维码</div>
-    </div>
+    <p style="text-align: center;margin-top:40px;color:#999">请将二维码对准扫描设备</p>
+    <!--<div style="padding: 30px;">
+        <div class="aui-btn aui-btn-block aui-btn-info" tapmode onclick="window.location.reload();">刷新二维码</div>
+    </div>-->
 </body>
 </html>
 <script type="text/javascript" src="cordova.js"></script>
index 6994b22..049a988 100644 (file)
                     <div class="aui-list-item-right"></div>
                 </div>
             </li>
+            <!--<li class="aui-list-item" onclick="app.loginByTouchId()">
+                <div class="aui-list-item-label-icon">
+                    <i class="aui-iconfont aui-icon-lock aui-text-info"></i>
+                </div>
+                <div class="aui-list-item-inner ">
+                    <div class="aui-list-item-title">指纹\人脸登录</div>
+                    <div class="aui-list-item-right"><input type="checkbox" id="login" class="aui-switch" ></div>
+                </div>
+            </li>-->
             <li class="aui-list-item" onclick="app.toPayPwd()">
                 <div class="aui-list-item-label-icon">
                     <i class="aui-iconfont aui-icon-pencil aui-text-danger"></i>