소스 검색

Merge branch 'master' of http://182.92.126.35:3000/msx/Vent-App

lxh 3 일 전
부모
커밋
4b4ccf43d8
3개의 변경된 파일109개의 추가작업 그리고 72개의 파일을 삭제
  1. 58 32
      pages/home/home.vue
  2. 24 13
      pages/ipConfig/ipConfig.vue
  3. 27 27
      pages/login/login.vue

+ 58 - 32
pages/home/home.vue

@@ -2,11 +2,11 @@
   <view class="container">
     <view v-if="!menushow" class="main">
       <view class="u-page">
-        <u-list :class="{ empty: curlist.length === 0 }">
-          <template v-if="curlist.length > 0">
+        <u-list :class="{ empty: showList.length === 0 }">
+          <template v-if="showList.length > 0">
             <u-list-item
               class="itemback"
-              v-for="(item, index) in curlist"
+              v-for="(item, index) in showList"
               :key="index"
             >
               <div>
@@ -108,6 +108,10 @@
                               ? "行人"
                               : item[showitem.monitorcode] == "1"
                               ? "行车"
+                              : item[showitem.monitorcode] == "3"
+                              ? "短路"
+                              : item[showitem.monitorcode] == "3"
+                              ? "行车/短路"
                               : "-"
                           }}
                         </view>
@@ -121,10 +125,10 @@
                           "
                         >
                           {{
-                            item.readData[showitem.monitorcode] == null ||
-                            item.readData[showitem.monitorcode] == ""
+                            item[showitem.monitorcode] == null ||
+                            item[showitem.monitorcode] == ""
                               ? "-"
-                              : item.readData[showitem.monitorcode]
+                              : item[showitem.monitorcode]
                           }}
                         </view>
                         <view
@@ -170,7 +174,6 @@
                         "
                       >
                         <view
-                          v-if="showitem.datatype == 1"
                           class="demo-layout bg-purple-light"
                           style="
                             margin-top: 10rpx;
@@ -181,17 +184,26 @@
                         >
                           {{
                             item[
-                              showitem.monitorcode.startsWith("Fan")
+                              showitem.monitorcode.startsWith("fan")
+                                ? showitem.monitorcode.replace(/^fan/, "fan1")
+                                : showitem.monitorcode.startsWith("Fan")
                                 ? showitem.monitorcode.replace(/^Fan/, "Fan1")
                                 : showitem.monitorcode
                             ] !== undefined &&
                             item[
-                              showitem.monitorcode.startsWith("Fan")
+                              showitem.monitorcode.startsWith("fan")
+                                ? showitem.monitorcode.replace(/^fan/, "fan1")
+                                : showitem.monitorcode.startsWith("Fan")
                                 ? showitem.monitorcode.replace(/^Fan/, "Fan1")
                                 : showitem.monitorcode
                             ] !== null
                               ? item[
-                                  showitem.monitorcode.startsWith("Fan")
+                                  showitem.monitorcode.startsWith("fan")
+                                    ? showitem.monitorcode.replace(
+                                        /^fan/,
+                                        "fan1"
+                                      )
+                                    : showitem.monitorcode.startsWith("Fan")
                                     ? showitem.monitorcode.replace(
                                         /^Fan/,
                                         "Fan1"
@@ -201,7 +213,7 @@
                               : "-"
                           }}
                         </view>
-                        <view
+                        <!-- <view
                           v-else-if="showitem.datatype == 2"
                           class="demo-layout bg-purple-light"
                           style="
@@ -231,7 +243,7 @@
                                 ]
                               : "-"
                           }}
-                        </view>
+                        </view> -->
 
                         <view
                           class="demo-layout bg-purple-light"
@@ -273,7 +285,6 @@
                         "
                       >
                         <view
-                          v-if="showitem.datatype == 1"
                           class="demo-layout bg-purple-light"
                           style="
                             margin-top: 10rpx;
@@ -284,17 +295,26 @@
                         >
                           {{
                             item[
-                              showitem.monitorcode.startsWith("Fan")
+                              showitem.monitorcode.startsWith("fan")
+                                ? showitem.monitorcode.replace(/^fan/, "fan2")
+                                : showitem.monitorcode.startsWith("Fan")
                                 ? showitem.monitorcode.replace(/^Fan/, "Fan2")
                                 : showitem.monitorcode
                             ] !== undefined &&
                             item[
-                              showitem.monitorcode.startsWith("Fan")
+                              showitem.monitorcode.startsWith("fan")
+                                ? showitem.monitorcode.replace(/^fan/, "fan2")
+                                : showitem.monitorcode.startsWith("Fan")
                                 ? showitem.monitorcode.replace(/^Fan/, "Fan2")
                                 : showitem.monitorcode
                             ] !== null
                               ? item[
-                                  showitem.monitorcode.startsWith("Fan")
+                                  showitem.monitorcode.startsWith("fan")
+                                    ? showitem.monitorcode.replace(
+                                        /^fan/,
+                                        "fan2"
+                                      )
+                                    : showitem.monitorcode.startsWith("Fan")
                                     ? showitem.monitorcode.replace(
                                         /^Fan/,
                                         "Fan2"
@@ -304,7 +324,7 @@
                               : "-"
                           }}
                         </view>
-                        <view
+                        <!-- <view
                           v-else-if="showitem.datatype == 2"
                           class="demo-layout bg-purple-light"
                           style="
@@ -334,7 +354,7 @@
                                 ]
                               : "-"
                           }}
-                        </view>
+                        </view> -->
 
                         <view
                           class="demo-layout bg-purple-light"
@@ -380,6 +400,7 @@ export default {
       isWarnVisible: false,
       deviceType1: "",
       devices1: [],
+      showList: [],
     };
   },
   props: ["showColum", "deviceType"],
@@ -448,26 +469,31 @@ export default {
             if (response.data.code == 200) {
               this.deviceList[type] = response.data.result.msgTxt[0].datalist;
               this.curlist = this.deviceList[type];
-              this.curlist.forEach((item) => {
-                if (item.readData.frontGateOpen == 1) {
-                  item.readData.frontGateOpen = "打开";
+              const processedList = this.curlist.map((item) => {
+                const { readData, ...baseFields } = item;
+                return { ...baseFields, ...readData };
+              });
+              this.showList = processedList;
+              this.showList.forEach((item) => {
+                if (item.frontGateOpen == 1) {
+                  item.frontGateOpen = "打开";
                 } else {
-                  item.readData.frontGateOpen = "关闭";
+                  item.frontGateOpen = "关闭";
                 }
-                if (item.readData.midGateOpen == 1) {
-                  item.readData.midGateOpen = "打开";
+                if (item.midGateOpen == 1) {
+                  item.midGateOpen = "打开";
                 } else {
-                  item.readData.midGateOpen = "关闭";
+                  item.midGateOpen = "关闭";
                 }
-                if (item.readData.rearGateOpen == 1) {
-                  item.readData.rearGateOpen = "打开";
+                if (item.rearGateOpen == 1) {
+                  item.rearGateOpen = "打开";
                 } else {
-                  item.readData.rearGateOpen = "关闭";
+                  item.rearGateOpen = "关闭";
                 }
-                if (item.readData.midGateOpen == 1) {
-                  item.readData.midGateOpen = "打开";
+                if (item.midGateOpen == 1) {
+                  item.midGateOpen = "打开";
                 } else {
-                  item.readData.midGateOpen = "关闭";
+                  item.midGateOpen = "关闭";
                 }
                 this.deviceType1 = item.deviceType;
                 let original = this.TabCur;
@@ -490,7 +516,7 @@ export default {
             }
           })
           .catch((error) => {
-            console.log("catch===>response", response);
+            // console.log("catch===>response", response);
             reject(error);
           });
       });

+ 24 - 13
pages/ipConfig/ipConfig.vue

@@ -1,15 +1,27 @@
   <template>
-    <view class="zai-box">
-      <scroll-view scroll-y class="page">
-        <view class="IPSet">
-          <span class="text-style"><u-button :plain="true" color="#18a5ff" size="small" :text="IPSet ? IPSet : '选择IP地址'"
-              @tap="changeIP()"></u-button></span>
-          <u-picker :show="ipShow" :columns="IpConfig" @cancel="ipShow = false" @confirm="selectIpAddr"
-            keyName="label"></u-picker>
-        </view>
-      </scroll-view>
-    </view>
-  </template>
+  <view class="zai-box">
+    <scroll-view scroll-y class="page">
+      <view class="IPSet">
+        <span class="text-style"
+          ><u-button
+            :plain="true"
+            color="#18a5ff"
+            size="small"
+            :text="IPSet ? IPSet : '选择IP地址'"
+            @tap="changeIP()"
+          ></u-button
+        ></span>
+        <u-picker
+          :show="ipShow"
+          :columns="IpConfig"
+          @cancel="ipShow = false"
+          @confirm="selectIpAddr"
+          keyName="label"
+        ></u-picker>
+      </view>
+    </scroll-view>
+  </view>
+</template>
 
 <script>
 import configService from "@/common/service/config.service.js";
@@ -57,7 +69,6 @@ export default {
       configService.apiUrl = fullURL;
       uni.setStorageSync("selectedIP", true);
       uni.setStorageSync("apiUrl", fullURL);
-      uni.setStorageSync("savedIP", true);
       // uni.showModal({
       //   title: "提示",
       //   content: fullURL,
@@ -72,7 +83,7 @@ export default {
       this.ipShow = true;
     },
   },
-  beforeDestroy() { },
+  beforeDestroy() {},
 };
 </script>
 

+ 27 - 27
pages/login/login.vue

@@ -404,37 +404,37 @@ export default {
     //   });
     // },
     //正则判断ip地址
-    validateIP(ip) {
-      const regex =
-        /^(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)){3}$/;
-      return regex.test(ip);
-    },
-    //正则判断端口地址
-    validatePort(port) {
-      const regex = /^([1-9]\d{0,3}|[1-5]\d{4}|6[0-5]{2}[0-3][0-5])$/;
-      return regex.test(port);
-    },
+    // validateIP(ip) {
+    //   const regex =
+    //     /^(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)){3}$/;
+    //   return regex.test(ip);
+    // },
+    // //正则判断端口地址
+    // validatePort(port) {
+    //   const regex = /^([1-9]\d{0,3}|[1-5]\d{4}|6[0-5]{2}[0-3][0-5])$/;
+    //   return regex.test(port);
+    // },
     setIp() {
       console.log("点击成功");
       this.ipShow = !this.ipShow;
     },
-    saveIP() {
-      this.validateIP(this.IPValue);
-      this.validatePort(this.PortValue);
-      if (this.validateIP(this.IPValue) && this.validatePort(this.PortValue)) {
-        this.ipShow = false;
-        this.fullIPVal = `http://${this.IPValue}:${this.PortValue}`;
-        configService.apiUrl = this.fullIPVal;
-        uni.setStorageSync("apiUrl", configService.apiUrl);
-        // localStorage.setItem("apiUrl", apiUrl);
-      } else if (!this.validateIP(this.IPValue)) {
-        alert("请填写正确的IP地址");
-      } else if (!this.validatePort(this.PortValue)) {
-        alert("请填写正确的端口号");
-      } else {
-        alert("请检查输入的IP地址或端口号");
-      }
-    },
+    // saveIP() {
+    //   this.validateIP(this.IPValue);
+    //   this.validatePort(this.PortValue);
+    //   if (this.validateIP(this.IPValue) && this.validatePort(this.PortValue)) {
+    //     this.ipShow = false;
+    //     this.fullIPVal = `http://${this.IPValue}:${this.PortValue}`;
+    //     configService.apiUrl = this.fullIPVal;
+    //     uni.setStorageSync("apiUrl", configService.apiUrl);
+    //     // localStorage.setItem("apiUrl", apiUrl);
+    //   } else if (!this.validateIP(this.IPValue)) {
+    //     alert("请填写正确的IP地址");
+    //   } else if (!this.validatePort(this.PortValue)) {
+    //     alert("请填写正确的端口号");
+    //   } else {
+    //     alert("请检查输入的IP地址或端口号");
+    //   }
+    // },
     changeIP() {
       this.ipShow1 = true;
     },