houjie 3 роки тому
батько
коміт
349e8761bc

+ 16 - 3
pages.json

@@ -6,7 +6,6 @@
                 "navigationBarTitleText": "猫王妙播"
             }
         },
-
         {
             "path": "pages/play/play",
             "style": {
@@ -44,7 +43,16 @@
                 "enablePullDownRefresh": false
             }
 
-        }, {
+        }, 
+        {
+            "path": "pages/demo/ble/activateDevice/activateDevice",
+            "style": {
+                "navigationBarTitleText": "設備激活",
+                "enablePullDownRefresh": false
+            }
+
+        }, 
+        {
             "path": "pages/addDevice/selectDevice/selectDevice",
             "style": {
                 "navigationBarTitleText": "选择设备型号",
@@ -117,7 +125,7 @@
         "list": [{
                 "name": "设备详情",
                 "path": "pages/mine/device/deviceDetail/deviceDetail",
-                "query": "model=MW-M3&name=猫王·MW-M3&uuid=89860474192070498495"
+				"query": "model=MW-M3&name=猫王·MW-M3&uuid=89860474192070498495"
             },
             {
                 "name": "管理设备",
@@ -144,6 +152,11 @@
             {
                 "name": "登录组件",
                 "path": "pages/login/login"
+            },
+            {
+                "name": "connectDevice",
+                "path": "pages/demo/ble/activateDevice/activateDevice",
+                "query": "model=MW-M3&name=猫王·MW-M3"
             }
         ]
     }

+ 24 - 0
pages/addDevice/connectDevice/connectDevice.vue

@@ -232,6 +232,30 @@ export default {
                 that.showLink = true;
                 that.btnName = "connect";
                 break;
+              } else if (
+                "MW_BLE_M3" == devices[i].name ||
+                "MW_BLE_M4" == devices[i].name
+              ) {
+                //devices[i].advertisData
+                let iccid = Buffer.from(devices[i].advertisData).toString()
+                let uuid = `AIrSMArT_${iccid.substring(8,iccid.length)}`
+                console.warn(iccid);
+                that.device = {
+                  name: devices[i].name,
+                  mac: iccid,
+                };
+                if (that.device) {
+
+                  that.device.uuid = uuid;
+                }
+                //配网成功
+                that.hintText = "连接成功";
+                that.btnName = "finish";
+                that.showStateIcon = true;
+                that.showLink = false;
+                that.stateIcon = "../../../static/common/ic_green_success.svg";
+                that.stopScan()
+                break;
               }
             }
           });

+ 0 - 1
pages/demo/ble/activateDevice/activateDevice.vue

@@ -106,7 +106,6 @@ export default {
     },
   },
   methods: {
-    
     //关闭弹窗
     btAlertClose() {
       this.showAlert = false;

+ 36 - 27
pages/mine/mine.vue

@@ -1,35 +1,44 @@
 <template>
-	<view>
-		<button type="primary" @click="goDevice">设备管理</button>
-		<button type="primary" @click="goWebview('product/manual')">产品手册</button>
-		<button type="primary" @click="goWebview('help')">帮助与反馈</button>
-		<button type="primary" @click="goWebview('about')">关于</button>
-		
-	</view>
+  <view>
+    <button type="primary" @click="goDevice">设备管理</button>
+    <button @click="activateDevice">设备激活</button>
+    <button type="primary" @click="goWebview('product/manual')">
+      产品手册
+    </button>
+    <button type="primary" @click="goWebview('help')">帮助与反馈</button>
+    <button type="primary" @click="goWebview('about')">关于</button>
+  </view>
 </template>
 
 <script>
-	export default {
-		data() {
-			return {
-				
-			}
-		},
-		methods: {
-			goWebview(path){
-				uni.navigateTo({
-					url:`../webview/webview?path=${path}`
-				})
-			},
-			goDevice(){
-				uni.navigateTo({
-					url:'device/deviceManager/deviceManager'
-				})
-			}
-		}
-	}
+import BleActivate from "../../Lib/BleActivateDevice.js";
+export default {
+  data() {
+    return {};
+  },
+  methods: {
+    goWebview(path) {
+      uni.navigateTo({
+        url: `../webview/webview?path=${path}`,
+      });
+    },
+    goDevice() {
+      uni.navigateTo({
+        url: "device/deviceManager/deviceManager",
+      });
+    },
+    activateDevice() {
+    //   let data = "E2E7A1A90C89E81A62BACA5DD386F2A8ADD1192C5F3400F4D4D5B2FBF32B3B60B1209598A82C679D30C4604726D30DC09A31E241B716258CC2887FE6395D6181B9D55476A4F8F4C3D11A850BE4FE10BC42F126D74053F7A1B9FB44F76FE79B9903F48B0C5FB38746E6CDCA35121C785F46FC66460C56A8382D7656FBE4D0DB3A363149E0BCF94C05C69D2120241A98C83C8D05BA409C6F981F3491226AFBB7ACF987BD8E72E7B53AE77CFFE51E8CDE6F787BA7641B4F601BC5744FB99C50E7AC"
+    //   BleActivate.sendLongData("sdf",data)
+
+	uni.navigateTo({
+		url:"../demo/ble/activateDevice/activateDevice?model=MW-M3&name=猫王·MW-M3"
+	})
+      
+    },
+  },
+};
 </script>
 
 <style>
-
 </style>