<template>
  <div id="app">
    <router-view></router-view>
  </div>
</template>

<script>
export default {
  name: "App",
  created() {
    const IP = sessionStorage.getItem("ip");
    let ipList = [
      "58.17.42.179",
      "218.64.4.4",
      "10.201.5.31",
      "10.205.64.222",
      "171.34.215.31",
      "182.105.82.9",
      "220.175.60.46",
    ];
    let isip = ipList.includes(IP);
    if (!isip) {
      alert("没有访问权限");
      this.closeWin();
    }
  },
  methods: {
    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>

<style>
html,
body,
#app {
  padding: 0;
  margin: 0;
  height: calc(100vh);
  width: 100%;
  background-color: #eaeaea;
}

a {
  text-decoration: none;
}
</style>
