yuhan 1 anno fa
parent
commit
aaee3775b3
1 ha cambiato i file con 78 aggiunte e 3 eliminazioni
  1. 78 3
      public/index.html

+ 78 - 3
public/index.html

@@ -252,15 +252,32 @@
     <div class="load_title">正在加载 可知可视项目平台,请耐心等待
 
     </div>
+
+    <!-- <div class="homeContent">
+               
+      <ul>
+          <li>
+              <a id="xinchou" href="javascript:go_url('http://192.168.2.216:3000','');">
+                  <img class="bj" src="img/diamonds.png"/>
+                  <div class="">
+                      <img src="img/emolument.png"/>
+                      <p>前往成本可知可视系统</p>
+                  </div>
+              </a>
+          </li>
+        
+      </ul>
+    </div> -->
   </div>
 </div>
 
 </body>
 
-<script>
+<!-- <script>
   // console.log(111111111111)
+  var href = "http://192.168.2.216:3000/"
   // var href = "http://localhost:3000"
-  var href = "http://10.67.0.64:9988"
+  // var href = "http://10.67.0.64:9988"
 
   // 1.
   window.onload = function () {
@@ -293,7 +310,9 @@
     */
     // console.log(url)
     // console.log(objShell)
-    objShell.Run("cmd.exe /c start chrome " + url, 0, false);
+    var path_chrome = '"C:/Program Files (x86)/Google/Chrome/Application/chrome.exe"';
+    objShell.Run(path_chrome + url, 0, false);
+    // objShell.Run("cmd.exe /c start chrome " + url, 0, false);
     // console.log(':',objShell.Run("cmd.exe /c start chrome " + url, 0, false))
   }
   function getChromePath(objShell) {
@@ -348,6 +367,62 @@
 
   // redirectToGoogle();
 
+</script> -->
+
+<script type="text/javascript">
+  
+  // 部署 
+  // location.href("javascript:go_url('http://10.67.0.64:9988','');");
+  // 本地测试
+  location.href("javascript:go_url('http://192.168.2.216:3000','');");
+
+  //关闭IE浏览器
+  window.opener = null;
+  window.open('','_self')
+  window.close();
+
+  function go_chrome(url, usename){
+    //判断浏览器是否支持ActiveX控件,
+    if(!!window.ActiveXObject || "ActiveXObject" in window){
+      var shell = new ActiveXObject("WScript.shell");
+      //var path_chrome = 'C:/Program File (x86)/Google/chrome/Application/chrome.exe';
+      //var path_chrome = 'C:/Documents and Settings/'+ username +'Local Settings/Application Data/Google/chrome/Application/chrome.exe';
+            //var path_chrome = 'C:/Users/xinchserver/AppData/Local/Google/Chrome/Application/chrome.exe';
+      // 部署
+      // var  path_chrome = '"%USERPROFILE%/local Settings/Application Data/360Chrome/Chrome/Application/360chrome.exe"';
+      // 本地测试
+      var path_chrome = '"C:/Program Files (x86)/Google/Chrome/Application/chrome.exe"';
+      var cmd_str = path_chrome + ' ' + url;
+      //console.log(cmd_str);
+      try{
+          shell.run(path_chrome+url, 0, false);
+      }catch(e){
+          path_chrome = '"%LOCALAPPDATA%/360Chrome/Chrome/Application/360chrome.exe" ';
+          // alert('请登陆工资系统');
+          shell.run(path_chrome+url, 0, false);
+      }
+
+
+      //shell.run(cmd_str);
+      //console.log(cmd_str);
+    }else{
+      alert('请打开浏览器的ActiveX控件支持');
+    }
+  }
+
+  function go_url(url, username){
+    //判断是否为IE浏览器
+    //if(window.document.documentMode){
+      //alert("IE");
+    //}
+    var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
+    var isChrome = userAgent.indexOf('Chrome') > -1 && userAgent.indexOf("Safari") > -1; //判断是否为chrome浏览器
+    if(!isChrome){
+      go_chrome(url, username); //打开chrome浏览器
+    }else{
+      top.location = url;  //本浏览器跳转链接
+    }
+  }
 </script>
 
 </html>