xiaoxin 2 lat temu
rodzic
commit
f868e939cb
1 zmienionych plików z 50 dodań i 50 usunięć
  1. 50 50
      src/App.vue

+ 50 - 50
src/App.vue

@@ -8,58 +8,58 @@
 export default {
   name: "App",
   created() {
-    this.getIp();
+    // this.getIp();
   },
   methods: {
-    async getIp() {
-      let res = await this.$axios({
-        url: "http://ip-api.com/json",
-        method: "get"
-      });
-      // console.log(res);
-      if (res.status == 200) {
-        let IP = res.data.query;
-        // console.log(IP);
-        let ipList = [
-          "58.17.42.179",
-          "10.201.5.31",
-          "10.205.64.222",
-          "171.34.215.31",
-          "182.105.82.9",
-          "220.175.60.46",
-          "39.160.30.198"
-        ];
-        let isip = ipList.includes(IP);
-        let isip2 = IP.indexOf("218.64.4") > -1;
-        if (!isip && !isip2) {
-          alert("没有访问权限");
-          this.closeWin();
-        }
-      }
-    },
-    closeWin() {
-      if (
-        navigator.userAgent.indexOf("Firefox") != -1 ||
-        navigator.userAgent.indexOf("Chrome") != -1
-      ) {
-        window.location.href =
-          "https://www.baidu.com" + "?v=" + new Date().getTime();
-        window.location.href = "about:blank";
-        window.close();
-      } else {
-        let iphone = navigator.userAgent.toLowerCase().indexOf("iphone");
-        let ipad = navigator.userAgent.toLowerCase().indexOf("ipad");
-        if (iphone != -1 || ipad != -1) {
-          window.location =
-            "https://www.baidu.com" + "?v=" + new Date().getTime();
-        }
-        window.location.href =
-          "https://www.baidu.com" + "?v=" + new Date().getTime();
-        window.opener = null;
-        window.open("", "_self");
-        window.close();
-      }
-    }
+    // async getIp() {
+    //   let res = await this.$axios({
+    //     url: "http://ip-api.com/json",
+    //     method: "get"
+    //   });
+    //   // console.log(res);
+    //   if (res.status == 200) {
+    //     let IP = res.data.query;
+    //     // console.log(IP);
+    //     let ipList = [
+    //       "58.17.42.179",
+    //       "10.201.5.31",
+    //       "10.205.64.222",
+    //       "171.34.215.31",
+    //       "182.105.82.9",
+    //       "220.175.60.46",
+    //       "39.160.30.198"
+    //     ];
+    //     let isip = ipList.includes(IP);
+    //     let isip2 = IP.indexOf("218.64.4") > -1;
+    //     if (!isip && !isip2) {
+    //       alert("没有访问权限");
+    //       this.closeWin();
+    //     }
+    //   }
+    // },
+    // closeWin() {
+    //   if (
+    //     navigator.userAgent.indexOf("Firefox") != -1 ||
+    //     navigator.userAgent.indexOf("Chrome") != -1
+    //   ) {
+    //     window.location.href =
+    //       "https://www.baidu.com" + "?v=" + new Date().getTime();
+    //     window.location.href = "about:blank";
+    //     window.close();
+    //   } else {
+    //     let iphone = navigator.userAgent.toLowerCase().indexOf("iphone");
+    //     let ipad = navigator.userAgent.toLowerCase().indexOf("ipad");
+    //     if (iphone != -1 || ipad != -1) {
+    //       window.location =
+    //         "https://www.baidu.com" + "?v=" + new Date().getTime();
+    //     }
+    //     window.location.href =
+    //       "https://www.baidu.com" + "?v=" + new Date().getTime();
+    //     window.opener = null;
+    //     window.open("", "_self");
+    //     window.close();
+    //   }
+    // }
   }
 };
 </script>