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