@yyp92-cli/template-react-pc 1.1.1 → 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,17 @@
1
1
  # @yyp92-cli/template-react-pc
2
2
 
3
+ ## 1.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 模板修改
8
+
9
+ ## 1.2.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 项目模板修改
14
+
3
15
  ## 1.1.1
4
16
 
5
17
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yyp92-cli/template-react-pc",
3
- "version": "1.1.1",
3
+ "version": "1.2.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -1,5 +1,6 @@
1
1
  {
2
- "name": "vite-react-template",
2
+ "name": "<%= projectName %>",
3
+ "description": "脚手架创建的 <%= projectName %> 项目",
3
4
  "private": true,
4
5
  "version": "0.0.0",
5
6
  "type": "module",
@@ -4,6 +4,8 @@ import type { MenuProps } from 'antd';
4
4
  import {useNavigate, useLocation} from 'react-router-dom'
5
5
  import {ComponentMap} from '@/router/router'
6
6
  import { menusStore } from '@/store/menus'
7
+ import { localCache } from '@/utils'
8
+ import { LOGIN_TOKEN } from '@/global/constants'
7
9
 
8
10
  import styles from './index.module.scss'
9
11
 
@@ -44,12 +46,19 @@ export const Side: React.FC<SideProps> = () => {
44
46
  const newPathname = pathname.slice(1)
45
47
 
46
48
  if (newPathname === '') {
47
- const openKey = menus[0]?.key
48
- const selectedKey = menus[0]?.children?.[0]?.key
49
+ const token = localCache.getCache(LOGIN_TOKEN)
49
50
 
50
- setOpenKeys([openKey])
51
- setSelectedKeys([selectedKey])
52
- navigate(`/${menus[0]?.key}/${menus[0]?.children?.[0]?.key}`)
51
+ if (token) {
52
+ const openKey = menus[0]?.key
53
+ const selectedKey = menus[0]?.children?.[0]?.key
54
+
55
+ setOpenKeys([openKey])
56
+ setSelectedKeys([selectedKey])
57
+ navigate(`/${menus[0]?.key}/${menus[0]?.children?.[0]?.key}`)
58
+ }
59
+ else {
60
+ navigate('/login')
61
+ }
53
62
  }
54
63
  else {
55
64
  const pathnameList = newPathname.split('/')
@@ -4,6 +4,8 @@ import type { MenuProps } from 'antd';
4
4
  import {useNavigate, useLocation} from 'react-router-dom'
5
5
  import {ComponentMap} from '@/router/router'
6
6
  import { menusStore } from '@/store/menus'
7
+ import { localCache } from '@/utils'
8
+ import { LOGIN_TOKEN } from '@/global/constants'
7
9
 
8
10
  import styles from './index.module.scss'
9
11
 
@@ -44,12 +46,19 @@ export const Side: React.FC<SideProps> = ({}) => {
44
46
  const newPathname = pathname.slice(1)
45
47
 
46
48
  if (newPathname === '') {
47
- const openKey = menus[0]?.key
48
- const selectedKey = menus[0]?.children?.[0]?.key
49
+ const token = localCache.getCache(LOGIN_TOKEN)
49
50
 
50
- // setOpenKeys([openKey])
51
- setSelectedKeys([selectedKey])
52
- navigate(`/${menus[0]?.key}/${menus[0]?.children?.[0]?.key}`)
51
+ if (token) {
52
+ const openKey = menus[0]?.key
53
+ const selectedKey = menus[0]?.children?.[0]?.key
54
+
55
+ // setOpenKeys([openKey])
56
+ setSelectedKeys([selectedKey])
57
+ navigate(`/${menus[0]?.key}/${menus[0]?.children?.[0]?.key}`)
58
+ }
59
+ else {
60
+ navigate('/login')
61
+ }
53
62
  }
54
63
  else {
55
64
  const pathnameList = newPathname.split('/')