Bläddra i källkod

提交绑定设备,优化设备详情

wangming 3 veckor sedan
förälder
incheckning
89130ee207
3 ändrade filer med 122 tillägg och 73 borttagningar
  1. 1 1
      src/pages.json
  2. 121 59
      src/pagesA/adDevice/adDevice.vue
  3. 0 13
      src/pagesA/deviceDetail/deviceDetail.vue

+ 1 - 1
src/pages.json

@@ -26,7 +26,7 @@
                     "path": "adDevice/adDevice",
                     "style": {
                         "enablePullDownRefresh": false,
-                        "navigationBarTitleText": "添加设备",
+                        "navigationBarTitleText": "参数配置",
                         "navigationBarBackgroundColor": "#faede2",
                         "navigationBarTextStyle": "black"
                     }

+ 121 - 59
src/pagesA/adDevice/adDevice.vue

@@ -124,11 +124,11 @@
                         <text>3</text>
                     </view>
                 </view>
-                <view class="airCantInfo" v-if="environmentJudge">
+                <!-- <view class="airCantInfo" v-if="environmentJudge">
                     <text>暂未配置环境数据...</text>
-                </view>
+                </view> -->
                 <view class="airbody">
-                    <view class="airTitle">环境配置</view>
+                    <view class="airTitle">参数配置</view>
                     <view class="wifItem" style="margin-top: 30rpx">
                         <text>X轴范围(cm)</text>
                         <view class="inputBox">
@@ -202,6 +202,64 @@
                             </picker>
                         </view>
                     </view>
+                    <view class="wifItem" style="margin-top: 30rpx">
+                        <text>坐摔检测</text>
+                        <view class="inputBox">
+                            <switch
+                                :checked="enabled == 1"
+                                @change="onChange"
+                                :active-value="1"
+                                :inactive-value="0"
+                                size="24px"
+                                active-color="#07c160"
+                                inactive-color="#eeeff1"
+                                style="transform: scale(0.8); margin-left: auto"
+                            />
+                        </view>
+                    </view>
+                    <template v-if="enabled == 1">
+                        <view class="wifItem" style="margin-top: 30rpx">
+                            <text>坐摔最低高度(m)</text>
+                            <view class="inputBox">
+                                <input
+                                    type="number"
+                                    v-model="lowZMax"
+                                    placeholder="请输入坐摔最低高度"
+                                />
+                            </view>
+                        </view>
+                        <view class="wifItem" style="margin-top: 30rpx">
+                            <text>坐摔门限</text>
+                            <view class="inputBox">
+                                <input
+                                    type="number"
+                                    v-model="humanPredThreshold"
+                                    placeholder="请输入坐摔门限"
+                                />
+                            </view>
+                        </view>
+                        <view class="wifItem" style="margin-top: 30rpx">
+                            <text>最小连续坐摔判断</text>
+                            <view class="inputBox">
+                                <input
+                                    type="number"
+                                    v-model="minEventsForDetection"
+                                    placeholder="请输入最小连续坐摔判断"
+                                />
+                            </view>
+                        </view>
+                        <view class="wifItem" style="margin-top: 30rpx">
+                            <text>最小连续坐摔次数</text>
+                            <view class="inputBox">
+                                <input
+                                    type="number"
+                                    v-model="minHumanEventsForDetection"
+                                    placeholder="请输入最小连续坐摔次数"
+                                />
+                            </view>
+                        </view>
+                    </template>
+
                     <!-- <view class="wifItem" style="margin-top: 30rpx">
                         <text>安装方式</text>
                         <view class="inputBox">
@@ -242,7 +300,7 @@
     </view>
 </template>
 <script>
-const airkiss = requirePlugin("airkiss");
+// const airkiss = requirePlugin("airkiss");
 export default {
     name: "my",
     data() {
@@ -278,6 +336,12 @@ export default {
             // statusLight: 1,
             showDeviceInfo: false,
             devInfo: "",
+            // 坐摔参数
+            enabled: 0,
+            lowZMax: 0.5,
+            humanPredThreshold: 0.78,
+            minEventsForDetection: 3,
+            minHumanEventsForDetection: 2,
         };
     },
     watch: {
@@ -328,13 +392,9 @@ export default {
                 this.mountPlain = "Ceiling";
             }
         },
-        // onChange({ detail }) {
-        //     this.statusLight = detail;
-        //     if(detail){
-
-        //     }
-        //     console.log(this.statusLight, 9999);
-        // },
+        onChange({ detail }) {
+            this.enabled = detail.value == true ? 1 : 0;
+        },
         goNextTip() {
             if (!this.devName.length > 10) {
                 uni.showModal({
@@ -460,37 +520,39 @@ export default {
                             });
                         }
                     });
-            } else {
-                this.$http
-                    .post("wap/device/deviceBinding", deviceBandingParams, {
-                        header: {
-                            "Content-Type": "application/json;charset=UTF-8",
-                        },
-                    })
-                    .then((res) => {
-                        if (res.data.code == 200) {
-                            uni.showToast({
-                                title: "绑定成功",
-                                icon: "success",
-                                duration: 1500,
-                            });
-                            uni.setStorageSync("devId", res.data.data.devId);
-                            uni.reLaunch({
-                                url:
-                                    "/pagesA/roomSetting/roomSetting?devId=" +
-                                    res.data.data.devId +
-                                    "&clientId=" +
-                                    res.data.data.clientId,
-                            });
-                        } else {
-                            uni.showToast({
-                                title: res.data.message,
-                                icon: "none",
-                                duration: 1500,
-                            });
-                        }
-                    });
             }
+
+            //  else {
+            //     this.$http
+            //         .post("wap/device/deviceBinding", deviceBandingParams, {
+            //             header: {
+            //                 "Content-Type": "application/json;charset=UTF-8",
+            //             },
+            //         })
+            //         .then((res) => {
+            //             if (res.data.code == 200) {
+            //                 uni.showToast({
+            //                     title: "绑定成功",
+            //                     icon: "success",
+            //                     duration: 1500,
+            //                 });
+            //                 uni.setStorageSync("devId", res.data.data.devId);
+            //                 uni.reLaunch({
+            //                     url:
+            //                         "/pagesA/roomSetting/roomSetting?devId=" +
+            //                         res.data.data.devId +
+            //                         "&clientId=" +
+            //                         res.data.data.clientId,
+            //                 });
+            //             } else {
+            //                 uni.showToast({
+            //                     title: res.data.message,
+            //                     icon: "none",
+            //                     duration: 1500,
+            //                 });
+            //             }
+            //         });
+            // }
         },
         refreshWifi() {
             const that = this;
@@ -626,7 +688,7 @@ export default {
     },
 
     onUnload(options) {
-        airkiss.stopAirkiss();
+        // airkiss.stopAirkiss();
     },
     onShow() {},
 };
@@ -878,26 +940,26 @@ export default {
                 background-color: #e4c5b9;
             }
         }
-        .airCantInfo {
-            margin: 40rpx auto 0 auto;
-            opacity: 20%;
-            width: 300rpx;
-            height: 300rpx;
-            border: 18rpx solid;
-            border-color: #333333;
-            display: flex;
-            align-items: center;
-            justify-content: center;
-            text {
-                color: #999999;
-                font-size: 38rpx;
-                text-align: center;
-            }
-        }
+        // .airCantInfo {
+        //     margin: 40rpx auto 0 auto;
+        //     opacity: 20%;
+        //     width: 300rpx;
+        //     height: 300rpx;
+        //     border: 18rpx solid;
+        //     border-color: #333333;
+        //     display: flex;
+        //     align-items: center;
+        //     justify-content: center;
+        //     text {
+        //         color: #999999;
+        //         font-size: 38rpx;
+        //         text-align: center;
+        //     }
+        // }
         .airbody {
             margin: 110rpx auto 0 auto;
             width: 700rpx;
-            height: 650rpx;
+            max-height: 1000rpx;
             background: #ffffff;
             border-radius: 38rpx;
             padding: 38rpx 38rpx;

+ 0 - 13
src/pagesA/deviceDetail/deviceDetail.vue

@@ -353,10 +353,7 @@ export default {
             endDate: "",
             softWare: "",
             statusLight: 0,
-            currentDate: new Date().getTime(),
             lnbAction: "",
-            wsj: false,
-            todayWcTimes: "",
             stayDetail: "",
             todayDate: "",
             dev_id: "",
@@ -364,7 +361,6 @@ export default {
             devName: "",
             devType: "",
             localPhone: uni.getStorageSync("phone"),
-            startArr: [],
             freQuenceList: [],
             // mqtt相关
             currentIndex: 0,
@@ -436,7 +432,6 @@ export default {
                 animation: true,
                 animationDuration: 100,
             },
-            index: 0,
             showModle: false,
             zoomTimes: 2,
             // 设备分享权限判断
@@ -682,12 +677,6 @@ export default {
                     JSON.stringify(this.freQuenceList),
             });
         },
-        getCurrentDate() {
-            const now = new Date();
-            this.currentDate = `${now.getFullYear()}-${
-                now.getMonth() + 1
-            }月${now.getDate().toString().padStart(2, "0")}日`;
-        },
         receptionChange(val) {
             this.targetPoints = val;
         },
@@ -1054,8 +1043,6 @@ export default {
         this.getFrequency(devId);
         this.getdevInfo(devId);
         this.getdevRoomInfo(devId);
-        this.getCurrentDate();
-
         this.todayDate = this.$time(new Date(), 2);
 
         // 清理旧定时器