MS-CIAZDCOIXVRW\Administrator 4 лет назад
Родитель
Сommit
73aafcc70d
3 измененных файлов с 73 добавлено и 31 удалено
  1. 2 2
      config/index.js
  2. 18 10
      index.html
  3. 53 19
      src/App.vue

+ 2 - 2
config/index.js

@@ -21,8 +21,8 @@ module.exports = {
       },
       '/diseaseRight': {
         // target: 'http://192.168.161.230:8089/disease-command',
-        // target: 'http://58.17.42.179:90/diseaseRight',
-        target: 'http://chuanghai-dev.natapp1.cc/disease-command',
+        target: 'http://58.17.42.179:90/diseaseRight',
+        // target: 'http://chuanghai-dev.natapp1.cc/disease-command',
         changeOrigin: true,
         pathRewrite: {
           '^/diseaseRight': ''

+ 18 - 10
index.html

@@ -1,12 +1,20 @@
 <!DOCTYPE html>
 <html>
-	<head>
-		<meta charset="utf-8">
-		<meta name="viewport" content="width=device-width,initial-scale=1.0">
-		<title>靖安县数据上传平台</title>
-	</head>
-	<body>
-		<div id="app"></div>
-		<!-- built files will be auto injected -->
-	</body>
-</html>
+
+<head>
+	<meta charset="utf-8">
+	<meta name="viewport" content="width=device-width,initial-scale=1.0">
+	<title>靖安县数据上传平台</title>
+</head>
+<script src="http://pv.sohu.com/cityjson?ie=utf-8"></script>
+<script type="text/javascript">
+	sessionStorage.setItem('ip', returnCitySN["cip"])
+	sessionStorage.setItem('area', returnCitySN["cname"])
+</script>
+
+<body>
+	<div id="app"></div>
+	<!-- built files will be auto injected -->
+</body>
+
+</html>

+ 53 - 19
src/App.vue

@@ -1,27 +1,61 @@
 <template>
-	<div id="app">
-		<router-view></router-view>
-	</div>
+  <div id="app">
+    <router-view></router-view>
+  </div>
 </template>
 
 <script>
-	export default {
-		name: 'App'
-	}
+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"];
+    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;
-	}
+html,
+body,
+#app {
+  padding: 0;
+  margin: 0;
+  height: calc(100vh);
+  width: 100%;
+  background-color: #eaeaea;
+}
+
+a {
+  text-decoration: none;
+}
 </style>