@yyp92-cli/template-react-pc 2.5.0 → 2.7.0

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
+ ## 2.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - react pc 模板更改
8
+
9
+ ## 2.6.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 模板增加.gitignore
14
+
3
15
  ## 2.5.0
4
16
 
5
17
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yyp92-cli/template-react-pc",
3
- "version": "2.5.0",
3
+ "version": "2.7.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -39,6 +39,9 @@ export const darkToken = {
39
39
  colorIcon: iconColor,
40
40
  colorBgSolidHover: activeColor2,
41
41
  colorTextQuaternary: iconColor,
42
+
43
+ colorWarning: errorColor,
44
+ colorSuccess: successColor,
42
45
 
43
46
  colorPrimary: activeColor,
44
47
  colorPrimaryActive: activeColor,
@@ -63,6 +66,8 @@ export const darkToken = {
63
66
  controlItemBgHover: bgGreyColor,
64
67
  controlItemBgActiveHover: activeColor3,
65
68
  controlItemBgActive: activeColor3,
69
+
70
+ colorTextHeading: textColor,
66
71
  },
67
72
  components: {
68
73
  Button: {
@@ -280,6 +285,14 @@ export const darkToken = {
280
285
  },
281
286
  Cascader: {
282
287
  optionPadding: '5px 12px',
283
- }
288
+ optionSelectedBg: activeColor3,
289
+ optionSelectedColor: activeColor,
290
+ },
291
+ Message: {
292
+ contentBg: bgColor
293
+ },
294
+ Upload: {
295
+ actionsColor: textColor
296
+ },
284
297
  }
285
298
  }
@@ -39,6 +39,9 @@ export const lightToken = {
39
39
  colorIcon: iconColor,
40
40
  colorBgSolidHover: activeColor2,
41
41
  colorTextQuaternary: iconColor,
42
+
43
+ colorWarning: errorColor,
44
+ colorSuccess: successColor,
42
45
 
43
46
  colorPrimary: activeColor,
44
47
  colorPrimaryActive: activeColor,
@@ -63,6 +66,8 @@ export const lightToken = {
63
66
  controlItemBgHover: bgGreyColor,
64
67
  controlItemBgActiveHover: activeColor3,
65
68
  controlItemBgActive: activeColor3,
69
+
70
+ colorTextHeading: textColor,
66
71
  },
67
72
  components: {
68
73
  Button: {
@@ -281,6 +286,14 @@ export const lightToken = {
281
286
  },
282
287
  Cascader: {
283
288
  optionPadding: '5px 12px',
284
- }
289
+ optionSelectedBg: activeColor3,
290
+ optionSelectedColor: activeColor,
291
+ },
292
+ Message: {
293
+ contentBg: bgColor
294
+ },
295
+ Upload: {
296
+ actionsColor: textColor
297
+ },
285
298
  }
286
299
  }
@@ -13,6 +13,7 @@ body {
13
13
  #root {
14
14
  width: 100%;
15
15
  height: 100%;
16
+ background: var(--bg-white-color);
16
17
  }
17
18
 
18
19
 
@@ -0,0 +1,21 @@
1
+ @import '../../theme/lightTheme.scss';
2
+ @import '../../theme/darkTheme.scss';
3
+
4
+ .noAuth {
5
+ display: flex;
6
+ justify-content: center;
7
+ align-items: center;
8
+ background: var(--bg-white-color);
9
+
10
+ :global {
11
+ .ant-result {
12
+ .ant-result-title {
13
+ color: var(--text-color) !important;
14
+ }
15
+
16
+ .ant-result-subtitle {
17
+ color: var(--text-color-secondary) !important;
18
+ }
19
+ }
20
+ }
21
+ }
@@ -1,15 +1,20 @@
1
- import React from 'react';
1
+ import React, {useEffect} from 'react';
2
2
  import { Button, Result } from 'antd';
3
+ import { antdTokenStore } from '@/store/theme';
4
+ import { getDarkTheme } from '@/utils';
5
+
6
+ import styles from './index.module.scss'
3
7
 
4
8
  export const Page403: React.FC = () => {
9
+ const {isDark} = antdTokenStore()
10
+
11
+ useEffect(() => {
12
+ getDarkTheme(isDark)
13
+ }, [isDark])
14
+
5
15
  return (
6
16
  <div
7
- style={{
8
- flex: '1',
9
- display: 'flex',
10
- justifyContent: 'center',
11
- alignItems: 'center'
12
- }}
17
+ className={styles.noAuth}
13
18
  >
14
19
  <Result
15
20
  status="403"
@@ -0,0 +1,21 @@
1
+ @import '../../theme/lightTheme.scss';
2
+ @import '../../theme/darkTheme.scss';
3
+
4
+ .noFound {
5
+ display: flex;
6
+ justify-content: center;
7
+ align-items: center;
8
+ background: var(--bg-white-color);
9
+
10
+ :global {
11
+ .ant-result {
12
+ .ant-result-title {
13
+ color: var(--text-color) !important;
14
+ }
15
+
16
+ .ant-result-subtitle {
17
+ color: var(--text-color-secondary) !important;
18
+ }
19
+ }
20
+ }
21
+ }
@@ -1,15 +1,21 @@
1
- import React from 'react';
1
+ import React, {useEffect} from 'react';
2
2
  import { Button, Result } from 'antd';
3
+ import { antdTokenStore } from '@/store/theme';
4
+ import { getDarkTheme } from '@/utils';
5
+
6
+ import styles from './index.module.scss'
7
+
3
8
 
4
9
  export const Page404: React.FC = () => {
10
+ const {isDark} = antdTokenStore()
11
+
12
+ useEffect(() => {
13
+ getDarkTheme(isDark)
14
+ }, [isDark])
15
+
5
16
  return (
6
17
  <div
7
- style={{
8
- flex: '1',
9
- display: 'flex',
10
- justifyContent: 'center',
11
- alignItems: 'center'
12
- }}
18
+ className={styles.noFound}
13
19
  >
14
20
  <Result
15
21
  status="404"
@@ -8,7 +8,7 @@ import { userInfoStore } from '@/store/login'
8
8
  import { tokenStore } from '@/store/token'
9
9
  import { menusStore } from '@/store/menus'
10
10
  import { permissionStore } from '@/store/permission'
11
- import { antdTokenStore } from '@/store/antdToken'
11
+ import { antdTokenStore } from '@/store/theme'
12
12
 
13
13
  import styles from './index.module.scss'
14
14
 
@@ -19,7 +19,7 @@ interface HeaderProps {
19
19
  export const Header: React.FC<HeaderProps> = ({ }) => {
20
20
  const navigate = useNavigate()
21
21
  const {clearUserInfo} = userInfoStore()
22
- const {setAntdToken} = antdTokenStore()
22
+ const {isDark, setIsDark} = antdTokenStore()
23
23
  const {clearToken} = tokenStore()
24
24
  const {clearMenus} = menusStore()
25
25
  const {clearPermissions} = permissionStore()
@@ -53,7 +53,7 @@ export const Header: React.FC<HeaderProps> = ({ }) => {
53
53
 
54
54
  const handleChangeTheme = (checked: boolean) => {
55
55
  getDarkTheme(checked)
56
- setAntdToken(checked)
56
+ setIsDark(checked)
57
57
  }
58
58
 
59
59
 
@@ -80,6 +80,7 @@ export const Header: React.FC<HeaderProps> = ({ }) => {
80
80
  checkedChildren="暗黑"
81
81
  unCheckedChildren="明亮"
82
82
  defaultChecked={false}
83
+ checked={isDark}
83
84
  onChange={handleChangeTheme}
84
85
  />
85
86
  </Tooltip>
@@ -3,8 +3,10 @@ import { ConfigProvider } from 'antd'
3
3
  import dayjs from 'dayjs';
4
4
  import 'dayjs/locale/zh-cn';
5
5
  import zhCN from 'antd/locale/zh_CN'
6
- import { antdTokenStore } from '@/store/antdToken'
6
+ import { antdTokenStore } from '@/store/theme'
7
7
  import { getDarkTheme } from '@/utils'
8
+ import { lightToken } from '@/antdTheme/lightTheme'
9
+ import { darkToken } from '@/antdTheme/darkTheme'
8
10
  import Content from './content'
9
11
 
10
12
  import styles from './index.module.scss'
@@ -14,13 +16,16 @@ interface LayoutProps {
14
16
  }
15
17
 
16
18
  const Layout: React.FC<LayoutProps> = ({ }) => {
17
- const {antdToken} = antdTokenStore()
19
+ const {isDark} = antdTokenStore()
18
20
 
19
21
  useEffect(() => {
20
- getDarkTheme(false)
21
22
  dayjs.locale('zh-cn')
22
23
  }, [])
23
24
 
25
+ useEffect(() => {
26
+ getDarkTheme(isDark)
27
+ }, [isDark])
28
+
24
29
 
25
30
  // ********** 操作 **********
26
31
 
@@ -30,7 +35,7 @@ const Layout: React.FC<LayoutProps> = ({ }) => {
30
35
  <div className={styles.layout}>
31
36
  <ConfigProvider
32
37
  // 主题
33
- theme={antdToken}
38
+ theme={isDark ? darkToken : lightToken}
34
39
  locale={zhCN}
35
40
 
36
41
  button={{
@@ -5,7 +5,7 @@ import type { MenuProps } from 'antd'
5
5
  import { FullscreenExitOutlined, FullscreenOutlined, UserOutlined } from '@ant-design/icons'
6
6
  import { getDarkTheme } from '@/utils'
7
7
  import { userInfoStore } from '@/store/login'
8
- import { antdTokenStore } from '@/store/antdToken'
8
+ import { antdTokenStore } from '@/store/theme'
9
9
  import { tokenStore } from '@/store/token'
10
10
  import { menusStore } from '@/store/menus'
11
11
  import { permissionStore } from '@/store/permission'
@@ -20,7 +20,7 @@ interface HeaderProps {
20
20
  export const Header: React.FC<HeaderProps> = ({}) => {
21
21
  const navigate = useNavigate()
22
22
  const {clearUserInfo} = userInfoStore()
23
- const {setAntdToken} = antdTokenStore()
23
+ const {isDark, setIsDark} = antdTokenStore()
24
24
  const {clearToken} = tokenStore()
25
25
  const {clearMenus} = menusStore()
26
26
  const {clearPermissions} = permissionStore()
@@ -54,7 +54,7 @@ export const Header: React.FC<HeaderProps> = ({}) => {
54
54
 
55
55
  const handleChangeTheme = (checked: boolean) => {
56
56
  getDarkTheme(checked)
57
- setAntdToken(checked)
57
+ setIsDark(checked)
58
58
  }
59
59
 
60
60
 
@@ -80,6 +80,7 @@ export const Header: React.FC<HeaderProps> = ({}) => {
80
80
  checkedChildren="暗黑"
81
81
  unCheckedChildren="明亮"
82
82
  defaultChecked={false}
83
+ checked={isDark}
83
84
  onChange={handleChangeTheme}
84
85
  />
85
86
  </Tooltip>
@@ -4,7 +4,9 @@ import dayjs from 'dayjs';
4
4
  import 'dayjs/locale/zh-cn';
5
5
  import zhCN from 'antd/locale/zh_CN';
6
6
  import { getDarkTheme } from '@/utils'
7
- import { antdTokenStore } from '@/store/antdToken'
7
+ import { antdTokenStore } from '@/store/theme'
8
+ import { lightToken } from '@/antdTheme/lightTheme'
9
+ import { darkToken } from '@/antdTheme/darkTheme'
8
10
  import Content from './content'
9
11
 
10
12
  import styles from './index.module.scss'
@@ -14,13 +16,16 @@ interface LayoutProps {
14
16
  }
15
17
 
16
18
  const Layout: React.FC<LayoutProps> = ({ }) => {
17
- const {antdToken} = antdTokenStore()
18
-
19
+ const {isDark} = antdTokenStore()
20
+
19
21
  useEffect(() => {
20
- getDarkTheme(false)
21
22
  dayjs.locale('zh-cn')
22
23
  }, [])
23
24
 
25
+ useEffect(() => {
26
+ getDarkTheme(isDark)
27
+ }, [isDark])
28
+
24
29
 
25
30
  // ********** 操作 **********
26
31
 
@@ -31,7 +36,7 @@ const Layout: React.FC<LayoutProps> = ({ }) => {
31
36
  <div className={styles.layout}>
32
37
  <ConfigProvider
33
38
  // 主题
34
- theme={antdToken}
39
+ theme={isDark ? darkToken : lightToken}
35
40
  locale={zhCN}
36
41
 
37
42
  button={{
@@ -2,4 +2,4 @@ export const LOGIN_TOKEN = 'login/token'
2
2
  export const USER_INFO = 'userInfo'
3
3
  export const MENUS = 'menus'
4
4
  export const PERMISSION = 'permission'
5
- export const ANTDTOKEN = 'antd/token'
5
+ export const THEME_TOKEN = 'theme'
@@ -0,0 +1,30 @@
1
+ /**
2
+ * * 用户信息
3
+ */
4
+ import { create } from 'zustand'
5
+ import { persist } from 'zustand/middleware'
6
+ import { THEME_TOKEN} from '@/global/constants'
7
+
8
+ type AntdTokenStoreState = {
9
+ isDark: boolean
10
+ }
11
+
12
+ type AntdTokenStoreActions = {
13
+ setIsDark: (
14
+ isDark: AntdTokenStoreState['isDark']
15
+ ) => void,
16
+ }
17
+
18
+ type AntdTokenStore = AntdTokenStoreState & AntdTokenStoreActions
19
+
20
+ export const antdTokenStore = create<AntdTokenStore>()(
21
+ persist(
22
+ (set) => ({
23
+ isDark: false,
24
+ setIsDark: (isDark) => set({isDark})
25
+ }),
26
+ {
27
+ name: THEME_TOKEN
28
+ }
29
+ )
30
+ )
@@ -1,35 +0,0 @@
1
- /**
2
- * * 用户信息
3
- */
4
- import { create } from 'zustand'
5
- import { persist } from 'zustand/middleware'
6
- import { ANTDTOKEN} from '@/global/constants'
7
- import { lightToken } from '@/antdTheme/lightTheme'
8
- import { darkToken } from '@/antdTheme/darkTheme'
9
-
10
- type AntdTokenStoreState = {
11
- antdToken: any
12
- }
13
-
14
- type AntdTokenStoreActions = {
15
- setAntdToken: (
16
- antdToken: AntdTokenStoreState['antdToken']
17
- ) => void,
18
- }
19
-
20
- type AntdTokenStore = AntdTokenStoreState & AntdTokenStoreActions
21
-
22
- export const antdTokenStore = create<AntdTokenStore>()(
23
- persist(
24
- (set) => ({
25
- antdToken: {},
26
- setAntdToken: (isDark) => {
27
- const antdToken = isDark ? darkToken : lightToken
28
- return set({antdToken})
29
- },
30
- }),
31
- {
32
- name: ANTDTOKEN
33
- }
34
- )
35
- )