@yyp92-cli/template-react-mobile 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @yyp92-cli/template-react-mobile
2
2
 
3
+ ## 1.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 模板修改
8
+
3
9
  ## 1.2.0
4
10
 
5
11
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yyp92-cli/template-react-mobile",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -6,6 +6,8 @@ import { permissionStore } from '@/store/permission'
6
6
  import { routerConfig, type RouterConfigItemProps } from '@/router/router'
7
7
 
8
8
  import styles from './index.module.scss'
9
+ import { localCache } from '@/utils'
10
+ import { LOGIN_TOKEN } from '@/global/constants'
9
11
 
10
12
  interface ContentProps {
11
13
  [key: string]: any
@@ -35,21 +37,38 @@ const Content: React.FC<ContentProps> = ({}) => {
35
37
  navigate('/403')
36
38
  }
37
39
  }
40
+ else {
41
+ const token = localCache.getCache(LOGIN_TOKEN)
42
+
43
+ if (!token) {
44
+ navigate('/login')
45
+ }
46
+ }
38
47
  }, [location])
39
48
 
40
49
 
41
50
  // ********** 渲染 **********
42
- return (
43
- <div className={styles.layoutContent}>
44
- {!currentRouter?.showFullScreen && <NavBar />}
51
+ const renderContent = () => {
52
+ const token = localCache.getCache(LOGIN_TOKEN)
53
+
54
+ if (!token) {
55
+ return null
56
+ }
57
+
58
+ return (
59
+ <div className={styles.layoutContent}>
60
+ {!currentRouter?.showFullScreen && <NavBar />}
61
+
62
+ <div className={styles.wraper}>
63
+ <Outlet />
64
+ </div>
45
65
 
46
- <div className={styles.wraper}>
47
- <Outlet />
66
+ {!currentRouter?.showFullScreen && <TabBar />}
48
67
  </div>
68
+ )
69
+ }
49
70
 
50
- {!currentRouter?.showFullScreen && <TabBar />}
51
- </div>
52
- )
71
+ return renderContent()
53
72
  }
54
73
 
55
74
  export default Content