bobo04052021@163.com 3 hafta önce
ebeveyn
işleme
dd5497fc87
2 değiştirilmiş dosya ile 51 ekleme ve 40 silme
  1. 24 13
      pages/ipConfig/ipConfig.vue
  2. 27 27
      pages/login/login.vue

+ 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;
     },