Yansen 11 months ago
parent
commit
b8fffac16e
1 changed files with 18 additions and 14 deletions
  1. 18
    14
      src/layouts/index.jsx

+ 18
- 14
src/layouts/index.jsx View File

@@ -17,23 +17,27 @@ export default (props) => {
17 17
   const containerClass = `${laySty["page-conatiner"]} ${
18 18
     tabBar ? laySty["with-tabbar"] : ""
19 19
   } ${className}`;
20
-console.log(11111111111111111111111111111111111111111111111111111111)
20
+
21 21
   React.useEffect(() => {
22 22
     const currentPage = Taro.getCurrentPages().slice().pop();
23
-console.log("--user***************************",user)
24
-    if (!user) {
25
-      current().then((res) => {
26
-        console.log('---当前人员----', res);
27
-      }).catch((err) => {
28
-        console.log('---当前人员--报错了--');
29
-        console.error(err);
30 23
 
31
-        if (!currentPage.route.includes("pages/login/index")) {
32
-          Taro.navigateTo({
33
-            url: "/pages/login/index",
34
-          });
35
-        }
36
-      });
24
+    if (!user) {
25
+      try {
26
+        current().then((res) => {
27
+          console.log('---当前人员----', res);
28
+        }).catch((err) => {
29
+          console.log('---当前人员--报错了--');
30
+          console.error(err);
31
+  
32
+          if (!currentPage.route.includes("pages/login/index")) {
33
+            Taro.navigateTo({
34
+              url: "/pages/login/index",
35
+            });
36
+          }
37
+        });
38
+      } catch (error) {
39
+        console.error(error);
40
+      }
37 41
     }
38 42
 
39 43
     // if (!person || !user) {