Browse Source

NFC提交

lxh 3 months ago
parent
commit
4ba7e39f57
3 changed files with 97 additions and 65 deletions
  1. 2 2
      common/service/config.service.js
  2. 62 60
      manifest.json
  3. 33 3
      pages/gasreport/gasreport.vue

+ 2 - 2
common/service/config.service.js

@@ -3,13 +3,13 @@ let BASE_URL = "";
 if (process.env.NODE_ENV == "development") {
   BASE_URL = "http://182.92.126.35:9999"; // 开发环境
 } else {
-  BASE_URL = "http://10.246.95.4:9999"; // 布尔台
+  // BASE_URL = "http://10.246.95.4:9999"; // 布尔台
   // BASE_URL = "http://10.248.135.10:9999"; // 大柳塔进
   // BASE_URL = "http://10.248.135.121:9999"; // 活鸡兔井
   // BASE_URL = "http://10.246.63.125:9999"; // 寸草塔二矿
   // BASE_URL = "http://10.246.183.35:9999"; // 乌兰木伦
   // BASE_URL = "http://10.120.120.164:9999"; // 察哈素
-  // BASE_URL = "http://182.92.126.35:9999"; // 生产环境
+  BASE_URL = "http://182.92.126.35:9999"; // 生产环境
 }
 let staticDomainURL = BASE_URL + "/sys/common/static";
 

+ 62 - 60
manifest.json

@@ -1,17 +1,17 @@
 {
-    "name": "智能通风",
-    "appid": "__UNI__8193760",
-    "description": "",
-    "versionName": "2.2.22",
-    "versionCode": 1,
-    "transformPx": false,
-    "app-plus": {
-        "compatible": {
-            "ignoreVersion": false,
-            "runtimeVersion": "4.23,4.29",
-            "compilerVersion": "4.29"
+    "name" : "智能通风",
+    "appid" : "__UNI__8193760",
+    "description" : "",
+    "versionName" : "2.2.22",
+    "versionCode" : 1,
+    "transformPx" : false,
+    "app-plus" : {
+        "compatible" : {
+            "ignoreVersion" : false,
+            "runtimeVersion" : "4.23,4.29",
+            "compilerVersion" : "4.29"
         },
-        "orientation": [
+        "orientation" : [
             //竖屏正方向
             "portrait-primary",
             //竖屏反方向
@@ -24,16 +24,16 @@
             "default"
         ],
         /* 5+App特有相关 */
-        "modules": {
-            "Push": {},
-            "VideoPlayer": {}
+        "modules" : {
+            "Push" : {},
+            "VideoPlayer" : {}
         },
         /* 模块配置 */
-        "distribute": {
+        "distribute" : {
             /* 应用发布信息 */
-            "android": {
+            "android" : {
                 /* android打包配置 */
-                "permissions": [
+                "permissions" : [
                     "<uses-feature android:name=\"android.hardware.camera\"/>",
                     "<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
                     "<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>",
@@ -55,68 +55,70 @@
                     "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
                     "<uses-permission android:name=\"android.permission.WRITE_CONTACTS\"/>",
                     "<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>",
-                    "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
+                    "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>",
+                    "<uses-permission android:name=\"android.permission.NFC\"/>",
+                    "<uses-feature android:name=\"android.hardware.nfc\" android:required=\"true\"/>"
                 ]
             },
-            "ios": {
-                "dSYMs": false
+            "ios" : {
+                "dSYMs" : false
             },
             /* ios打包配置 */
-            "sdkConfigs": {
-                "ad": {},
-                "maps": {
-                    "amap": {
-                        "name": "",
-                        "appkey_ios": "87f4d2a4a0c42e0c86cf312c8b8154e8",
-                        "appkey_android": "87f4d2a4a0c42e0c86cf312c8b8154e8"
+            "sdkConfigs" : {
+                "ad" : {},
+                "maps" : {
+                    "amap" : {
+                        "name" : "",
+                        "appkey_ios" : "87f4d2a4a0c42e0c86cf312c8b8154e8",
+                        "appkey_android" : "87f4d2a4a0c42e0c86cf312c8b8154e8"
                     }
                 },
-                "push": {}
+                "push" : {}
             },
-            "splashscreen": {
-                "iosStyle": "default"
+            "splashscreen" : {
+                "iosStyle" : "default"
             },
-            "icons": {
-                "android": {
-                    "hdpi": "static/desk-img/72 – 1.png",
-                    "xhdpi": "static/desk-img/96.png",
-                    "xxhdpi": "static/desk-img/144.png",
-                    "xxxhdpi": "static/desk-img/192.png"
+            "icons" : {
+                "android" : {
+                    "hdpi" : "static/desk-img/72 – 1.png",
+                    "xhdpi" : "static/desk-img/96.png",
+                    "xxhdpi" : "static/desk-img/144.png",
+                    "xxxhdpi" : "static/desk-img/192.png"
                 }
             }
         }
     },
     /* SDK配置 */
-    "quickapp": {},
+    "quickapp" : {},
     /* 快应用特有相关 */
-    "mp-weixin": {
-        "appid": "wx2ba5c5690b35d173",
-        "setting": {
-            "urlCheck": false,
-            "es6": true
+    "mp-weixin" : {
+        "appid" : "wx2ba5c5690b35d173",
+        "setting" : {
+            "urlCheck" : false,
+            "es6" : true
         },
-        "permission": {
-            "scope.userLocation": {
-                "desc": "有定位功能需要导航定位"
+        "permission" : {
+            "scope.userLocation" : {
+                "desc" : "有定位功能需要导航定位"
             }
         }
     },
-    "h5": {
-        "title": "智能通风",
-        "domain": "myhjdc.cn",
-        "router": {
-            "mode": "history"
+    "h5" : {
+        "title" : "智能通风",
+        "domain" : "myhjdc.cn",
+        "router" : {
+            "mode" : "history"
         }
     },
-    "android": {
-        "theme": {
-            "primaryColor": "#000000",
-            "window": {
-                "fullscreen": true,
-                "navigationBarColor": "#000000"
+    "android" : {
+        "theme" : {
+            "primaryColor" : "#000000",
+            "window" : {
+                "fullscreen" : true,
+                "navigationBarColor" : "#000000"
             }
         },
-        "notch": true
+        "notch" : true
     },
-    "fallbackLocale": "zh-Hans"
-}
+    "fallbackLocale" : "zh-Hans"
+}

+ 33 - 3
pages/gasreport/gasreport.vue

@@ -251,6 +251,36 @@ export default {
         console.log(uni.getStorageSync('login_user_info'), 'ceshi00-----------')
         this.getGasList()
         this.getMcList()
+        // 在uniapp中使用NFC功能之前,首先需要检查是否有NFC权限
+        // uni.getSetting({
+        //     success(res) {
+        //         if (!res.authSetting['scope.nfcWrite']) {
+        //             // 如果没有权限,则发起授权请求
+        //             uni.authorize({
+        //                 scope: 'scope.nfc',
+        //                 success() {
+        //                     console.log('NFC权限获取成功');
+        //                     uni.showToast({
+        //                         title: '获取权限成功',
+        //                         icon: 'none'
+        //                     });
+        //                     // 权限授权成功后,可以进行NFC操作
+        //                     testNfc.listenNFCStatus()
+        //                 },
+        //                 fail() {
+        //                     // 用户拒绝授权,你可以引导用户到设置页面开启权限
+        //                     uni.showToast({
+        //                         title: '请在系统设置中打开NFC权限',
+        //                         icon: 'none'
+        //                     });
+        //                 }
+        //             });
+        //         } else {
+        //             // 已经有权限,可以直接进行NFC操作
+        //             console.log('已有NFC权限');
+        //         }
+        //     }
+        // });
     },
     methods: {
         hasPermission(param) {
@@ -2203,11 +2233,11 @@ export default {
             testNfc.writeData()
         },
         //nfc读取数据
-        getReads(){
+        getReads() {
             testNfc.listenNFCStatus()
             testNfc.readData()
-            let abc=testNfc.listenNFCStatus()
-            console.log(abc,'abc------------------')
+            let abc = testNfc.listenNFCStatus()
+            console.log(abc, 'abc------------------')
         }
     },