Browse Source

fix:判断跳转

shenchunlv 1 year ago
parent
commit
6d48e0695c
1 changed files with 7 additions and 19 deletions
  1. 7 19
      public/isMobile.js

+ 7 - 19
public/isMobile.js

@@ -1,27 +1,15 @@
 ;(function () {
-  console.log('进来了')
   // 判断移动端
   var sUserAgent = navigator.userAgent.toLowerCase()
-  if (
-    /ipad|iphone|midp|rv:1.2.3.4|ucweb|android|windows ce|windows mobile/.test(
-      sUserAgent
-    )
-  ) {
+  if (/ipad|iphone|midp|rv:1.2.3.4|ucweb|android|windows ce|windows mobile/.test(sUserAgent)) {
     //跳转移动端页面
     if (window.location.href.indexOf('mobile') < 0) {
-      window.location.replace('/m_user') //跳转后没有后退功能
+      if(window.location.pathname =='/'){
+        window.location.replace('/m_user') //跳转后没有后退功能
+        }
     }
   } else {
-    // PC端
-    console.log('pc')
+        // PC端
+       console.log('pc',)
   }
-})()
-(function(window){
-  window.onresize=function(){
-      rem();
-  }
-  function rem(){
-      document.documentElement.style.fontSize = document.documentElement.clientWidth /7.2 + "px";
-  }
-  rem();
-})(window);
+})()