@yyp92-cli/template-react-pc 2.1.0 → 2.2.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/package.json +4 -1
- package/CHANGELOG.md +0 -55
- package/template/.env.development +0 -5
- package/template/.env.production +0 -4
- package/template/.env.test +0 -4
- package/template/.eslintrc.cjs +0 -18
- package/template/README.md +0 -15
- package/template/index.html +0 -13
- package/template/package.json +0 -42
- package/template/pnpm-lock.yaml +0 -3570
- package/template/public/vite.svg +0 -1
- package/template/src/antdTheme/darkTheme.ts +0 -285
- package/template/src/antdTheme/lightTheme.ts +0 -286
- package/template/src/app.scss +0 -29
- package/template/src/app.tsx +0 -14
- package/template/src/assets/iconfont/demo.css +0 -539
- package/template/src/assets/iconfont/demo_index.html +0 -211
- package/template/src/assets/iconfont/iconfont.css +0 -19
- package/template/src/assets/iconfont/iconfont.js +0 -1
- package/template/src/assets/iconfont/iconfont.json +0 -16
- package/template/src/assets/iconfont/iconfont.ttf +0 -0
- package/template/src/assets/iconfont/iconfont.woff +0 -0
- package/template/src/assets/iconfont/iconfont.woff2 +0 -0
- package/template/src/assets/react.svg +0 -1
- package/template/src/components/403/index.tsx +0 -22
- package/template/src/components/404/index.tsx +0 -24
- package/template/src/components/index.ts +0 -3
- package/template/src/components/layout/content/index.module.scss +0 -22
- package/template/src/components/layout/content/index.tsx +0 -109
- package/template/src/components/layout/footer/index.module.scss +0 -12
- package/template/src/components/layout/footer/index.tsx +0 -15
- package/template/src/components/layout/header/index.module.scss +0 -21
- package/template/src/components/layout/header/index.tsx +0 -115
- package/template/src/components/layout/index.module.scss +0 -8
- package/template/src/components/layout/index.tsx +0 -47
- package/template/src/components/layout/side/index.module.scss +0 -31
- package/template/src/components/layout/side/index.tsx +0 -109
- package/template/src/components/layout-horizontal/content/index.module.scss +0 -22
- package/template/src/components/layout-horizontal/content/index.tsx +0 -105
- package/template/src/components/layout-horizontal/footer/index.module.scss +0 -12
- package/template/src/components/layout-horizontal/footer/index.tsx +0 -15
- package/template/src/components/layout-horizontal/header/index.module.scss +0 -23
- package/template/src/components/layout-horizontal/header/index.tsx +0 -115
- package/template/src/components/layout-horizontal/index.module.scss +0 -8
- package/template/src/components/layout-horizontal/index.tsx +0 -48
- package/template/src/components/layout-horizontal/side/index.module.scss +0 -32
- package/template/src/components/layout-horizontal/side/index.tsx +0 -104
- package/template/src/components/login/index.module.scss +0 -23
- package/template/src/components/login/index.tsx +0 -133
- package/template/src/global/constants.ts +0 -5
- package/template/src/pages/home/index.module.scss +0 -0
- package/template/src/pages/home/index.tsx +0 -90
- package/template/src/router/router.tsx +0 -190
- package/template/src/service/api.ts +0 -9
- package/template/src/service/config.ts +0 -9
- package/template/src/service/index.ts +0 -1
- package/template/src/service/request/index.ts +0 -267
- package/template/src/service/request/type.ts +0 -5
- package/template/src/service/service.ts +0 -27
- package/template/src/store/antdToken.ts +0 -35
- package/template/src/store/login.ts +0 -38
- package/template/src/store/menus.ts +0 -30
- package/template/src/store/permission.ts +0 -30
- package/template/src/store/token.ts +0 -30
- package/template/src/theme/darkTheme.scss +0 -47
- package/template/src/theme/lightTheme.scss +0 -49
- package/template/src/utils/base64ToBlob.ts +0 -41
- package/template/src/utils/cache.ts +0 -44
- package/template/src/utils/changeTheme.ts +0 -14
- package/template/src/utils/download.ts +0 -45
- package/template/src/utils/filterMenu.ts +0 -34
- package/template/src/utils/index.ts +0 -5
- package/template/src/vite-env.d.ts +0 -5
- package/template/tsconfig.json +0 -45
- package/template/tsconfig.node.json +0 -10
- package/template/vite.config.ts +0 -49
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
.login {
|
|
2
|
-
width: 100%;
|
|
3
|
-
height: 100%;
|
|
4
|
-
display: flex;
|
|
5
|
-
flex-direction: column;
|
|
6
|
-
justify-content: center;
|
|
7
|
-
align-items: center;
|
|
8
|
-
|
|
9
|
-
.loginInner {
|
|
10
|
-
width: 500px;
|
|
11
|
-
padding: 16px;
|
|
12
|
-
border-radius: 10px;
|
|
13
|
-
box-shadow: 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 9px 28px 8px rgba(0, 0, 0, 0.05);
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
.title {
|
|
17
|
-
font-size: 18px;
|
|
18
|
-
font-weight: 600;
|
|
19
|
-
text-align: center;
|
|
20
|
-
margin-bottom: 20px;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import {useNavigate, useSearchParams} from 'react-router-dom'
|
|
3
|
-
import { Button, Checkbox, Form, Input } from 'antd'
|
|
4
|
-
import { permissionStore } from '@/store/permission'
|
|
5
|
-
import { menusStore } from '@/store/menus'
|
|
6
|
-
import {userInfoStore} from '@/store/login'
|
|
7
|
-
import {tokenStore} from '@/store/token'
|
|
8
|
-
import { filterMenu } from '@/utils'
|
|
9
|
-
import { routerConfig } from '@/router/router'
|
|
10
|
-
|
|
11
|
-
import styles from './index.module.scss'
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
interface LoginProps {
|
|
15
|
-
[key: string]: any
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
type FieldType = {
|
|
19
|
-
username?: string;
|
|
20
|
-
password?: string;
|
|
21
|
-
remember?: string;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// todo 测试数据
|
|
25
|
-
const defaultList = [
|
|
26
|
-
'group1',
|
|
27
|
-
'group11',
|
|
28
|
-
'group12',
|
|
29
|
-
'group13',
|
|
30
|
-
'group2',
|
|
31
|
-
'group21',
|
|
32
|
-
'group22',
|
|
33
|
-
'group23',
|
|
34
|
-
'group24',
|
|
35
|
-
'group3',
|
|
36
|
-
'group11/detail',
|
|
37
|
-
'group11/screen-detail'
|
|
38
|
-
]
|
|
39
|
-
|
|
40
|
-
const Login: React.FC<LoginProps> = ({}) => {
|
|
41
|
-
// 获取 navigate 方法
|
|
42
|
-
const navigate = useNavigate()
|
|
43
|
-
const [searchParams] = useSearchParams()
|
|
44
|
-
const {
|
|
45
|
-
setPermissions
|
|
46
|
-
} = permissionStore()
|
|
47
|
-
const {setMenus} = menusStore()
|
|
48
|
-
const {setUserInfo} = userInfoStore()
|
|
49
|
-
const {setToken} = tokenStore()
|
|
50
|
-
|
|
51
|
-
// ********操作 ********
|
|
52
|
-
const onFinish = async (values: any) => {
|
|
53
|
-
console.log('Success:', values)
|
|
54
|
-
|
|
55
|
-
if (values.username === 'admin' && values.password === '123456') {
|
|
56
|
-
setPermissions(defaultList)
|
|
57
|
-
setToken('111')
|
|
58
|
-
setUserInfo({
|
|
59
|
-
userName: 'admin',
|
|
60
|
-
userId: '001'
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
// todo模拟接口
|
|
65
|
-
setTimeout(() => {
|
|
66
|
-
const list = filterMenu(routerConfig[0].children, defaultList)
|
|
67
|
-
setMenus(list)
|
|
68
|
-
}, 0)
|
|
69
|
-
|
|
70
|
-
setTimeout(() => {
|
|
71
|
-
const redirect = searchParams.get('redirect')
|
|
72
|
-
navigate(redirect || '/')
|
|
73
|
-
}, 500)
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const onFinishFailed = (errorInfo: any) => {
|
|
78
|
-
console.log('Failed:', errorInfo)
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// ******** 渲染 ********
|
|
82
|
-
return (
|
|
83
|
-
<div className={styles.login}>
|
|
84
|
-
<div className={styles.loginInner}>
|
|
85
|
-
<div className={styles.title}>登录</div>
|
|
86
|
-
|
|
87
|
-
<Form
|
|
88
|
-
// className={styles.loginInner}
|
|
89
|
-
name="basic"
|
|
90
|
-
labelCol={{ span: 6 }}
|
|
91
|
-
wrapperCol={{ span: 18 }}
|
|
92
|
-
style={{ maxWidth: 600 }}
|
|
93
|
-
initialValues={{ remember: true }}
|
|
94
|
-
onFinish={onFinish}
|
|
95
|
-
onFinishFailed={onFinishFailed}
|
|
96
|
-
autoComplete="off"
|
|
97
|
-
>
|
|
98
|
-
<Form.Item<FieldType>
|
|
99
|
-
label="Username"
|
|
100
|
-
name="username"
|
|
101
|
-
rules={[{ required: true, message: 'Please input your username!' }]}
|
|
102
|
-
>
|
|
103
|
-
<Input />
|
|
104
|
-
</Form.Item>
|
|
105
|
-
|
|
106
|
-
<Form.Item<FieldType>
|
|
107
|
-
label="Password"
|
|
108
|
-
name="password"
|
|
109
|
-
rules={[{ required: true, message: 'Please input your password!' }]}
|
|
110
|
-
>
|
|
111
|
-
<Input.Password />
|
|
112
|
-
</Form.Item>
|
|
113
|
-
|
|
114
|
-
<Form.Item<FieldType>
|
|
115
|
-
name="remember"
|
|
116
|
-
valuePropName="checked"
|
|
117
|
-
wrapperCol={{ offset: 8, span: 16 }}
|
|
118
|
-
>
|
|
119
|
-
<Checkbox>Remember me</Checkbox>
|
|
120
|
-
</Form.Item>
|
|
121
|
-
|
|
122
|
-
<Form.Item wrapperCol={{ offset: 8, span: 16 }}>
|
|
123
|
-
<Button type="primary" htmlType="submit">
|
|
124
|
-
Submit
|
|
125
|
-
</Button>
|
|
126
|
-
</Form.Item>
|
|
127
|
-
</Form>
|
|
128
|
-
</div>
|
|
129
|
-
</div>
|
|
130
|
-
)
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
export default Login
|
|
File without changes
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react'
|
|
2
|
-
import { useNavigate } from 'react-router-dom'
|
|
3
|
-
import { Button, Modal, DatePicker } from 'antd'
|
|
4
|
-
import { userInfoStore } from '@/store/login'
|
|
5
|
-
import {getDemo, postDemo} from '@/service'
|
|
6
|
-
|
|
7
|
-
import styles from './index.module.scss'
|
|
8
|
-
|
|
9
|
-
interface HomeProps {
|
|
10
|
-
[key: string]: any
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const Home: React.FC<HomeProps> = () => {
|
|
14
|
-
const navigate = useNavigate()
|
|
15
|
-
const {
|
|
16
|
-
userInfo,
|
|
17
|
-
setUserInfo
|
|
18
|
-
} = userInfoStore()
|
|
19
|
-
|
|
20
|
-
const [open, setOpen] = useState(false);
|
|
21
|
-
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
postDemo()
|
|
24
|
-
}, [])
|
|
25
|
-
|
|
26
|
-
// ********* 操作 *********
|
|
27
|
-
const showModal = () => {
|
|
28
|
-
setOpen(true);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const hideModal = () => {
|
|
32
|
-
setOpen(false);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
// ********* 渲染 *********
|
|
38
|
-
return (
|
|
39
|
-
<div>
|
|
40
|
-
<Button onClick={() => navigate('/403')}>403</Button>
|
|
41
|
-
<Button onClick={() => navigate('/login')}>login</Button>
|
|
42
|
-
|
|
43
|
-
<div style={{ marginTop: 20 }}>
|
|
44
|
-
<div>姓名:{userInfo?.userName}</div>
|
|
45
|
-
|
|
46
|
-
<Button
|
|
47
|
-
type="primary"
|
|
48
|
-
onClick={() => {
|
|
49
|
-
setUserInfo({
|
|
50
|
-
userName: '小红',
|
|
51
|
-
userId: '222'
|
|
52
|
-
})
|
|
53
|
-
}}
|
|
54
|
-
>设置姓名</Button>
|
|
55
|
-
|
|
56
|
-
<Button
|
|
57
|
-
type="primary"
|
|
58
|
-
disabled
|
|
59
|
-
>设置姓名</Button>
|
|
60
|
-
</div>
|
|
61
|
-
|
|
62
|
-
<DatePicker />
|
|
63
|
-
|
|
64
|
-
<div style={{ marginTop: 20 }}>
|
|
65
|
-
<Button type="primary" onClick={showModal}>
|
|
66
|
-
Modal
|
|
67
|
-
</Button>
|
|
68
|
-
<Modal
|
|
69
|
-
title="Modal"
|
|
70
|
-
open={open}
|
|
71
|
-
onOk={hideModal}
|
|
72
|
-
onCancel={hideModal}
|
|
73
|
-
okText="确认"
|
|
74
|
-
cancelText="取消"
|
|
75
|
-
>
|
|
76
|
-
<p>Bla bla ...</p>
|
|
77
|
-
<p>Bla bla ...</p>
|
|
78
|
-
<p>Bla bla ...</p>
|
|
79
|
-
</Modal>
|
|
80
|
-
</div>
|
|
81
|
-
|
|
82
|
-
<div style={{ marginTop: 20 }}>
|
|
83
|
-
<Button onClick={() => navigate('/group1/group11/detail')}>详情</Button>
|
|
84
|
-
<Button onClick={() => navigate('/group1/group11/screen-detail')}>详情-全屏</Button>
|
|
85
|
-
</div>
|
|
86
|
-
</div>
|
|
87
|
-
)
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export default Home
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import {createBrowserRouter} from 'react-router-dom'
|
|
3
|
-
import { AppstoreOutlined, MailOutlined, NodeCollapseOutlined, SettingOutlined } from '@ant-design/icons';
|
|
4
|
-
import Layout from '@/components/layout'
|
|
5
|
-
// import Layout from '@/components/layout-horizontal'
|
|
6
|
-
import Home from '@/pages/home'
|
|
7
|
-
import { Page403 } from '@/components/403'
|
|
8
|
-
import { Page404 } from '@/components/404'
|
|
9
|
-
import Login from '@/components/login'
|
|
10
|
-
|
|
11
|
-
export interface RouterConfigItemProps {
|
|
12
|
-
path: string,
|
|
13
|
-
label?: React.ReactNode,
|
|
14
|
-
icon?: React.ReactNode,
|
|
15
|
-
element?: React.ReactNode | null,
|
|
16
|
-
// 是否在菜单里显示
|
|
17
|
-
hideInMenu?: boolean,
|
|
18
|
-
index?: boolean,
|
|
19
|
-
|
|
20
|
-
// 是否全屏显示
|
|
21
|
-
showFullScreen?: boolean,
|
|
22
|
-
children?: RouterConfigItemProps[],
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// * 解决把 menu 存储在 zustand 中,在 antd Menu组件中使用报错
|
|
26
|
-
export const ComponentMap: any = {
|
|
27
|
-
"icon-1": AppstoreOutlined,
|
|
28
|
-
"icon-2": SettingOutlined
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
export const routerConfig: any[] = [
|
|
33
|
-
{
|
|
34
|
-
path: '/',
|
|
35
|
-
element: <Layout />,
|
|
36
|
-
children: [
|
|
37
|
-
{
|
|
38
|
-
label: '分组1',
|
|
39
|
-
path: 'group1',
|
|
40
|
-
key: 'group1',
|
|
41
|
-
icon: 'icon-1',
|
|
42
|
-
hideInMenu: false,
|
|
43
|
-
children: [
|
|
44
|
-
{
|
|
45
|
-
label: '分组11',
|
|
46
|
-
path: 'group11',
|
|
47
|
-
key: 'group11',
|
|
48
|
-
icon: null,
|
|
49
|
-
hideInMenu: false,
|
|
50
|
-
showFullScreen: false,
|
|
51
|
-
element: <Home />
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
label: '分组12',
|
|
55
|
-
path: 'group12',
|
|
56
|
-
key: 'group12',
|
|
57
|
-
icon: null,
|
|
58
|
-
hideInMenu: false,
|
|
59
|
-
showFullScreen: false,
|
|
60
|
-
element: <>group12</>
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
label: '分组13',
|
|
64
|
-
path: 'group13',
|
|
65
|
-
key: 'group13',
|
|
66
|
-
icon: null,
|
|
67
|
-
hideInMenu: false,
|
|
68
|
-
showFullScreen: false,
|
|
69
|
-
element: <>group13</>
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
label: '分组11-详情',
|
|
73
|
-
path: 'group11/detail',
|
|
74
|
-
key: 'group11/detail',
|
|
75
|
-
icon: null,
|
|
76
|
-
hideInMenu: true,
|
|
77
|
-
showFullScreen: false,
|
|
78
|
-
element: <>分组11-详情</>
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
label: '分组11-详情-全屏',
|
|
82
|
-
path: 'group11/screen-detail',
|
|
83
|
-
key: 'group11/screen-detail',
|
|
84
|
-
icon: null,
|
|
85
|
-
hideInMenu: true,
|
|
86
|
-
showFullScreen: true,
|
|
87
|
-
element: <>分组11-详情-全屏</>
|
|
88
|
-
},
|
|
89
|
-
]
|
|
90
|
-
},
|
|
91
|
-
|
|
92
|
-
{
|
|
93
|
-
label: '分组2',
|
|
94
|
-
path: 'group2',
|
|
95
|
-
key: 'group2',
|
|
96
|
-
icon: 'icon-2',
|
|
97
|
-
hideInMenu: false,
|
|
98
|
-
children: [
|
|
99
|
-
{
|
|
100
|
-
label: '分组21',
|
|
101
|
-
path: 'group21',
|
|
102
|
-
key: 'group21',
|
|
103
|
-
index: true,
|
|
104
|
-
icon: null,
|
|
105
|
-
hideInMenu: false,
|
|
106
|
-
showFullScreen: false,
|
|
107
|
-
element: <>group21</>,
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
label: '分组22',
|
|
111
|
-
path: 'group22',
|
|
112
|
-
key: 'group22',
|
|
113
|
-
icon: null,
|
|
114
|
-
hideInMenu: false,
|
|
115
|
-
showFullScreen: false,
|
|
116
|
-
element: <>group22</>,
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
label: '分组23',
|
|
120
|
-
path: 'group23',
|
|
121
|
-
key: 'group23',
|
|
122
|
-
icon: null,
|
|
123
|
-
hideInMenu: false,
|
|
124
|
-
showFullScreen: false,
|
|
125
|
-
element: <>group23</>,
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
label: '分组24',
|
|
129
|
-
path: 'group24',
|
|
130
|
-
key: 'group24',
|
|
131
|
-
icon: null,
|
|
132
|
-
hideInMenu: true,
|
|
133
|
-
showFullScreen: true,
|
|
134
|
-
element: <>group24</>,
|
|
135
|
-
},
|
|
136
|
-
]
|
|
137
|
-
},
|
|
138
|
-
|
|
139
|
-
{
|
|
140
|
-
label: '分组3',
|
|
141
|
-
path: 'group3',
|
|
142
|
-
key: 'group3',
|
|
143
|
-
icon: 'icon-2',
|
|
144
|
-
hideInMenu: false,
|
|
145
|
-
showFullScreen: true,
|
|
146
|
-
element: <>group3</>
|
|
147
|
-
}
|
|
148
|
-
]
|
|
149
|
-
},
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
// login
|
|
155
|
-
{
|
|
156
|
-
path: '/login',
|
|
157
|
-
label: 'login',
|
|
158
|
-
element: <Login />,
|
|
159
|
-
icon: null,
|
|
160
|
-
hideInMenu: true,
|
|
161
|
-
showFullScreen: true,
|
|
162
|
-
children: [],
|
|
163
|
-
},
|
|
164
|
-
|
|
165
|
-
// 403
|
|
166
|
-
{
|
|
167
|
-
path: '/403',
|
|
168
|
-
label: '403',
|
|
169
|
-
element: <Page403 />,
|
|
170
|
-
icon: null,
|
|
171
|
-
hideInMenu: true,
|
|
172
|
-
showFullScreen: true,
|
|
173
|
-
children: [],
|
|
174
|
-
},
|
|
175
|
-
|
|
176
|
-
// 404
|
|
177
|
-
{
|
|
178
|
-
path: '*',
|
|
179
|
-
label: '404',
|
|
180
|
-
element: <Page404 />,
|
|
181
|
-
icon: null,
|
|
182
|
-
hideInMenu: true,
|
|
183
|
-
showFullScreen: true,
|
|
184
|
-
children: [],
|
|
185
|
-
},
|
|
186
|
-
]
|
|
187
|
-
|
|
188
|
-
const router = createBrowserRouter(routerConfig as any)
|
|
189
|
-
|
|
190
|
-
export default router
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './service'
|