Browse Source

fix 跳出路径修改为middleware

anxiaoxia 2 năm trước cách đây
mục cha
commit
41e71d22d4
1 tập tin đã thay đổi với 14 bổ sung25 xóa
  1. 14 25
      src/layouts/index.jsx

+ 14 - 25
src/layouts/index.jsx

@@ -6,6 +6,7 @@ import Icon from '@/tenants-ui/SgIcon';
 
 import { Drawer, notification } from 'antd';
 import NavMenu from '@/sagacare_components/navMenu';
+import { Layout } from '/Users/isaac/Desktop/尚格云/sagacloud-manager-control/node_modules/@umijs/preset-dumi/lib/theme/layout';
 
 export default (props) => {
   const { menuVisible, closeMenu, toggleMenu } = useModel('controller');
@@ -106,39 +107,27 @@ export default (props) => {
   }, [location]);
 
   let setTimer = useRef();
-  clearTimeout(setTimer.current);
-  setTimer.current = null;
-  let timerTwo = useRef();
-  setTimer.current = setTimeout(() => {
-    console.log('----没有点击,退出');
-    clearTimeout(timerTwo.current);
-    timerTwo.current = null;
-    window.parent.localStorage.clear();
-    timerTwo.current = setTimeout(() => {
-      window.open('http://10.100.28.70/saasweb/login', '_top');
-    }, 1000);
-  }, 1000 * 60 * 5);
+
+  const logOut = (msg) => {
+    clearTimeout(setTimer.current);
+    setTimer.current = null;
+    setTimer.current = setTimeout(() => {
+      console.log(msg);
+      window.open('http://10.100.28.70/saasweb/middleware', '_top');
+    }, 1000 * 60 * 5);
+  };
+  logOut('----没有点击,退出');
+
   useEffect(() => {
     clearTimeout(setTimer.current);
     setTimer.current = null;
-    clearTimeout(timerTwo.current);
-    timerTwo.current = null;
   }, []);
   return (
     <div
       className={styles.layout}
       onClick={(event) => {
-        clearTimeout(setTimer.current);
-        setTimer.current = null;
-        setTimer.current = setTimeout(() => {
-          console.log('----点击,退出');
-          clearTimeout(timerTwo.current);
-          timerTwo.current = null;
-          window.parent.localStorage.clear();
-          timerTwo.current = setTimeout(() => {
-            window.open('http://10.100.28.70/saasweb/login', '_top');
-          }, 1000);
-        }, 1000 * 60 * 5);
+        console.log('----已点击等待超时,退出');
+        logOut('----点击后超时,退出');
       }}
     >
       <div className={styles.header}>