kn-cli 1.0.106 → 1.0.108

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.
Files changed (70) hide show
  1. package/build/webpack.config.js +2 -1
  2. package/package.json +1 -1
  3. package/templates/template_admin/cli.config.js +1 -0
  4. package/templates/template_admin/package.json +1 -1
  5. package/templates/template_admin/public/src/_mixin.less +38 -0
  6. package/templates/template_admin/public/src/_reset.less +0 -7
  7. package/templates/template_admin/public/src/assets/images/permission/403.png +0 -0
  8. package/templates/template_admin/public/src/assets/images/permission/404.png +0 -0
  9. package/templates/template_admin/public/src/assets/images/permission/503.png +0 -0
  10. package/templates/template_admin/public/src/components/antd/index.jsx +145 -0
  11. package/templates/template_admin/public/src/components/antd/tooltip/detail/index.jsx +70 -0
  12. package/templates/template_admin/public/src/components/antd/tooltip/detail/index.less +12 -0
  13. package/templates/template_admin/public/src/components/antd/tooltip/index.jsx +69 -0
  14. package/templates/template_admin/public/src/components/antd/tooltip/index.less +28 -0
  15. package/templates/template_admin/public/src/components/auth/index.jsx +60 -3
  16. package/templates/template_admin/public/src/components/auth/navCheck.jsx +27 -0
  17. package/templates/template_admin/public/src/components/button/index.jsx +17 -0
  18. package/templates/template_admin/public/src/components/debug/index.jsx +1 -1
  19. package/templates/template_admin/public/src/components/error/index.jsx +39 -0
  20. package/templates/template_admin/public/src/components/image/index.jsx +1 -1
  21. package/templates/template_admin/public/src/components/image/preview.jsx +1 -1
  22. package/templates/template_admin/public/src/components/layout/provider/index.jsx +2 -2
  23. package/templates/template_admin/public/src/components/leftMenu/index.jsx +31 -6
  24. package/templates/template_admin/public/src/components/menuIcon/index.jsx +33 -0
  25. package/templates/template_admin/public/src/components/menuIcon/index.less +49 -0
  26. package/templates/template_admin/public/src/components/react/index.jsx +7 -0
  27. package/templates/template_admin/public/src/components/select/defaultServicesSelect/index.jsx +182 -0
  28. package/templates/template_admin/public/src/components/select/dictSelect/index.jsx +84 -0
  29. package/templates/template_admin/public/src/components/select/index.jsx +7 -0
  30. package/templates/template_admin/public/src/components/select/useSelectList.jsx +217 -0
  31. package/templates/template_admin/public/src/components/table/index.jsx +1 -1
  32. package/templates/template_admin/public/src/components/text/index.jsx +1 -1
  33. package/templates/template_admin/public/src/components/topMenu/index.jsx +6 -1
  34. package/templates/template_admin/public/src/components/topMenu/index.less +10 -1
  35. package/templates/template_admin/public/src/components/topMenu/topBar/index.jsx +6 -1
  36. package/templates/template_admin/public/src/components/topMenu/topBar/index.less +9 -0
  37. package/templates/template_admin/public/src/config.js +28 -0
  38. package/templates/template_admin/public/src/declarations.d.ts +1 -0
  39. package/templates/template_admin/public/src/dictionary/dictionary.js +289 -0
  40. package/templates/template_admin/public/src/dictionary/index.js +22 -126
  41. package/templates/template_admin/public/src/hooks/useRouteMenu.jsx +25 -3
  42. package/templates/template_admin/public/src/hooks/useThrottole.jsx +68 -0
  43. package/templates/template_admin/public/src/index.jsx +33 -15
  44. package/templates/template_admin/public/src/menuConfig.jsx +152 -0
  45. package/templates/template_admin/public/src/pages/auth/user/create/index.jsx +1 -9
  46. package/templates/template_admin/public/src/pages/auth/user/dialog/index.jsx +1 -1
  47. package/templates/template_admin/public/src/pages/auth/user/index.jsx +3 -60
  48. package/templates/template_admin/public/src/pages/components/select/user.jsx +18 -0
  49. package/templates/template_admin/public/src/pages/demo/page1.jsx +21 -0
  50. package/templates/template_admin/public/src/pages/demo/page2.jsx +21 -0
  51. package/templates/template_admin/public/src/pages/demo/page3.jsx +21 -0
  52. package/templates/template_admin/public/src/pages/error/403.jsx +15 -0
  53. package/templates/template_admin/public/src/pages/error/404.jsx +15 -0
  54. package/templates/template_admin/public/src/pages/error/503.jsx +15 -0
  55. package/templates/template_admin/public/src/pages/error/permission.jsx +40 -0
  56. package/templates/template_admin/public/src/pages/error/permission.less +16 -0
  57. package/templates/template_admin/public/src/pages/home.jsx +15 -4
  58. package/templates/template_admin/public/src/pages/login/index.jsx +3 -2
  59. package/templates/template_admin/public/src/pages/pageTemplate.jsx +28 -0
  60. package/templates/template_admin/public/src/provider/app.jsx +86 -55
  61. package/templates/template_admin/public/src/provider/menu.jsx +75 -108
  62. package/templates/template_admin/public/src/route.jsx +55 -35
  63. package/templates/template_admin/public/src/services/index.js +28 -4
  64. package/templates/template_admin/public/src/services/socket/index.jsx +1 -1
  65. package/templates/template_admin/public/src/utils/storage.js +30 -0
  66. package/templates/template_admin/webpack.api.js +24 -0
  67. package/templates/template_admin/public/src/pages/components/select/account/index.jsx +0 -114
  68. package/templates/template_admin/public/src/pages/components/select/device/index.jsx +0 -83
  69. package/templates/template_admin/public/src/pages/components/select/groupUser/index.jsx +0 -172
  70. package/templates/template_admin/public/src/pages/components/select/user/index.jsx +0 -119
@@ -372,7 +372,8 @@ const plugins= [
372
372
  MOCK: process.env.mock == 1 ? '1' : false, //JSON.stringify(process.env.mock)
373
373
  ...API_HOST,
374
374
  PM_TYPE: JSON.stringify(process.env.pm_type),
375
- APP_VERSION:JSON.stringify(appVersion)
375
+ APP_VERSION:JSON.stringify(appVersion),
376
+ SITE_NAME:JSON.stringify(CLI_CONFIG.name),
376
377
  }),
377
378
  ];
378
379
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kn-cli",
3
- "version": "1.0.106",
3
+ "version": "1.0.108",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,6 +1,7 @@
1
1
 
2
2
  module.exports = {
3
3
  name:'projectName',
4
+ version:'1.0.0',
4
5
  registryType:'npm',//npm镜像源,taobao|npm
5
6
  less:{
6
7
  javascriptEnabled:true,//是否开启less js
@@ -11,7 +11,7 @@
11
11
  "antd": "~4.24.8",
12
12
  "axios": "~1.1.3",
13
13
  "jszip": "~3.10.1",
14
- "kn-hooks": "~0.0.33",
14
+ "kn-hooks": "~0.0.35",
15
15
  "moment": "~2.29.4",
16
16
  "react": "~17.0.2",
17
17
  "react-dom": "~17.0.2",
@@ -34,6 +34,44 @@
34
34
  }
35
35
 
36
36
 
37
+ .scrollBarLarge{
38
+
39
+ &::-webkit-scrollbar{
40
+ width:6px;//竖向滚动条宽度
41
+ height: 6px;//横向滚动条高度
42
+ display:block;//强制一直显示
43
+ }
44
+ //整个滚动条的轨道
45
+ &::-webkit-scrollbar-track
46
+ {
47
+ background-color: transparent;//整个滚动条背景颜色
48
+ }
49
+ //滚动条当前可拖动的bar的样式
50
+ &::-webkit-scrollbar-thumb{
51
+ background-color: rgba(0,0,0,0.15);
52
+ border-radius: 5px 5px 5px 5px;
53
+
54
+ }
55
+ }
56
+
57
+
58
+ .scrollBarDark{
59
+ &::-webkit-scrollbar{
60
+ width:3px;//竖向滚动条宽度
61
+ height: 3px;//横向滚动条高度
62
+ display:block;//强制一直显示
63
+ }
64
+ //整个滚动条的轨道
65
+ &::-webkit-scrollbar-track
66
+ {
67
+ background-color: #acacac22;//整个滚动条背景颜色
68
+ }
69
+ //滚动条当前可拖动的bar的样式
70
+ &::-webkit-scrollbar-thumb{
71
+ background-color: #f2f2f2;
72
+ }
73
+ }
74
+
37
75
  .hideScrollBar{
38
76
  &::-webkit-scrollbar {
39
77
  display: none;
@@ -3,13 +3,6 @@
3
3
  @import './_variable.less';
4
4
 
5
5
  :global {
6
- .dg.ac{
7
- input{height: 100%;color:white;}
8
- select{
9
- color:black;
10
- width: 100%;
11
- }
12
- }
13
6
  html{
14
7
  // ios webview 进入后高度不正确的问题
15
8
  background-color: white;
@@ -0,0 +1,145 @@
1
+ import React from "react";
2
+ // @ts-ignore
3
+ import zhCN from 'antd/lib/locale/zh_CN';
4
+
5
+ import {
6
+ Form as AntdForm,
7
+ Input as AntdInput,
8
+ Button as AntdButton,
9
+ DatePicker as _DatePicker,
10
+ Alert,
11
+ Anchor,
12
+ Badge,
13
+ Card,
14
+ Checkbox,
15
+ Col,
16
+ ConfigProvider,
17
+ Drawer,
18
+ Dropdown,
19
+ Empty,
20
+ Image,
21
+ InputNumber,
22
+ Layout,
23
+ List,
24
+ Menu,
25
+ message,
26
+ Modal,
27
+ notification,
28
+ Pagination,
29
+ Popconfirm,
30
+ Popover,
31
+ Progress,
32
+ Radio,
33
+ Row,
34
+ Select,
35
+ Space,
36
+ Spin,
37
+ Steps,
38
+ Switch,
39
+ Table,
40
+ Tabs,
41
+ Tag,
42
+ TimePicker,
43
+ Tooltip as AntdTooltip,
44
+ TreeSelect,
45
+ Upload,
46
+ AutoComplete,
47
+ // @ts-ignore
48
+ } from "antd";
49
+
50
+
51
+ import Tooltip from './tooltip';
52
+ import AsyncButton from '../button';
53
+
54
+
55
+ export { AsyncButton as Button };
56
+ export {Alert}
57
+ export {Anchor}
58
+ export {Badge}
59
+ export {Card}
60
+ export {Checkbox}
61
+ export {Col}
62
+ export {ConfigProvider}
63
+
64
+ /**@type {*} */
65
+ const DatePicker = _DatePicker;
66
+ export {DatePicker}
67
+ export {Drawer}
68
+ export {Dropdown}
69
+ export {Empty}
70
+ export {Image}
71
+ export {InputNumber}
72
+ export {Layout}
73
+ export {List}
74
+ export {Menu}
75
+ export {message}
76
+ export {Modal}
77
+ export {notification}
78
+ export {Pagination}
79
+ export {Popconfirm}
80
+ export {Popover}
81
+ export {Progress}
82
+ export {Radio}
83
+ export {Row}
84
+ export {Select}
85
+ export {Space}
86
+ export {Spin}
87
+ export {Steps}
88
+ export {Switch}
89
+ export {Table}
90
+ export {Tabs}
91
+ export {Tag}
92
+ export {TimePicker}
93
+ export {Tooltip}
94
+ export {TreeSelect}
95
+ export {Upload}
96
+ export {AutoComplete}
97
+
98
+
99
+ export {AntdTooltip}
100
+ export {AntdButton}
101
+
102
+ export {zhCN}
103
+
104
+
105
+
106
+ const FormItem=(props,ref)=>{
107
+ const {validateFirst=true,children,...others} = props;
108
+ return <AntdForm.Item ref={ref||undefined} validateFirst={validateFirst} {...others}>{children}</AntdForm.Item>
109
+ }
110
+
111
+ /**
112
+ * @type {*}
113
+ */
114
+ const Form={...AntdForm}
115
+ // @ts-ignore
116
+ Form.Item = FormItem;
117
+
118
+ export {Form};
119
+
120
+
121
+
122
+ const Input=(props)=>{
123
+ const {children,type,...others} = props;
124
+
125
+ if(type=='hidden'){
126
+ return <AntdInput type={type} {...others}>{children}</AntdInput>
127
+ }
128
+ return <AntdInput allowClear {...others}>{children}</AntdInput>
129
+ }
130
+
131
+ Input.Group=AntdInput.Group;
132
+ Input.Search=AntdInput.Search;
133
+ Input.TextArea=AntdInput.TextArea;
134
+ Input.Password=AntdInput.Password;
135
+
136
+ export {Input};
137
+
138
+ const HiddenFormItem=(props)=>{
139
+ const {children,...others} = props;
140
+ return (
141
+ <AntdForm.Item {...others} noStyle><input type='hidden'/></AntdForm.Item>
142
+ )
143
+ }
144
+
145
+ export {HiddenFormItem}
@@ -0,0 +1,70 @@
1
+ import React from "react";
2
+ import { ReactRender } from "@/components/react";
3
+
4
+ import { Modal } from "@/components/antd";
5
+ // @ts-ignore
6
+ import Popup from "@/components/popup";
7
+ import { LayoutLanguage } from "@/components/layout/provider";
8
+ import styles from './index.less';
9
+ import { useEffect } from "react";
10
+
11
+ /**
12
+ * 控制室 - 操作记录 - 事件内容详情
13
+ * @returns {JSX.Element}
14
+ */
15
+
16
+ const Detail = (props) => {
17
+ const { destory,title,content } = props;
18
+ const onCancel = () => {
19
+ destory && destory(false);
20
+ };
21
+
22
+ const onOk = () => {
23
+ destory && destory(true);
24
+ };
25
+
26
+ let isJsx = React.isValidElement(content)
27
+
28
+ const onEsc=(e)=>{
29
+ if (e.key.toLocaleLowerCase() === 'escape' || e.key.toLocaleLowerCase() === 'esc') {
30
+ onCancel();
31
+ }
32
+ }
33
+
34
+ useEffect(()=>{
35
+ window.addEventListener('keyup',onEsc)
36
+ return ()=>{
37
+ window.removeEventListener('keyup',onEsc)
38
+ }
39
+ },[])
40
+
41
+ return (
42
+ <Modal
43
+ maskClosable={true}
44
+ title={title||'详情'}
45
+ width={720}
46
+ open={true}
47
+ footer={false}
48
+ onCancel={onCancel}
49
+ onOk={onOk}
50
+ >
51
+ {
52
+ isJsx?<div className={styles.content}>{isJsx?content:''}</div>:<div className={styles.content} dangerouslySetInnerHTML={{__html:content}}></div>
53
+ }
54
+
55
+ </Modal>
56
+ );
57
+ };
58
+
59
+ const ShowDetail = (props = {}) => {
60
+ return new Promise((resolve) => {
61
+ let popup = Popup(resolve);
62
+ ReactRender(
63
+ <LayoutLanguage>
64
+ <Detail destory={popup.destory} {...props} />
65
+ </LayoutLanguage>,
66
+ popup.dom
67
+ );
68
+ });
69
+ };
70
+ export default ShowDetail;
@@ -0,0 +1,12 @@
1
+ @import '~@/_mixin.less';
2
+
3
+ .content{
4
+ width: 100%;
5
+ max-height:492px;
6
+ min-height: 212px;
7
+ overflow: auto;
8
+ border:1px solid #f0f0f0;
9
+ border-radius: 4px;
10
+ padding:12px;
11
+ .scrollBarLarge;
12
+ }
@@ -0,0 +1,69 @@
1
+
2
+ import React from "react";
3
+ import styles from './index.less';
4
+ import { AntdTooltip } from "@/components/antd";
5
+ import { useState } from "react";
6
+ import { useEffect } from "react";
7
+
8
+ import ShowDetail from './detail'
9
+
10
+
11
+ function countRenderableText(node) {
12
+ if (typeof node === 'string') {
13
+ return node.length;
14
+ }
15
+
16
+ if (Array.isArray(node)) {
17
+ // 如果 node 是一个数组,递归统计所有子节点的文字数量
18
+ return node.reduce((acc, child) => acc + countRenderableText(child), 0);
19
+ }
20
+
21
+ if (React.isValidElement(node) && node.props.children) {
22
+ // 如果 node 是一个有效的 React 元素且有 children,则递归统计子节点
23
+ return countRenderableText(node.props.children);
24
+ }
25
+
26
+ return 0; // 非文本内容返回 0
27
+ }
28
+
29
+
30
+ const More=props=>{
31
+ const {children} = props;
32
+
33
+ const [len,setLen] = useState(0);
34
+ const onViewMore=(content)=>{
35
+ ShowDetail({content});
36
+ }
37
+
38
+ useEffect(()=>{
39
+ if(!children){
40
+ setLen(0);
41
+ return;
42
+ }
43
+ if( ['string','number'].includes(typeof children) ){
44
+ setLen(`${children}`.length);
45
+ }else{
46
+ let len = countRenderableText(children);
47
+ setLen(len);
48
+ }
49
+ },[children])
50
+
51
+
52
+ return (
53
+ <div className={styles.moreWrap}>
54
+ <div className={styles.text}>
55
+ {children}
56
+ </div>
57
+ <div className={styles.btnMoreWrap}>
58
+ {len>=100?<span className={styles.btnMore} onClick={onViewMore.bind(this,children)}>查看详情</span>:<></>}
59
+ </div>
60
+ </div>
61
+ )
62
+ }
63
+ const TooltipMore=props=>{
64
+ const {title,children,...others}=props;
65
+
66
+ return <AntdTooltip {...others} title={<More>{title}</More>} >{children}</AntdTooltip>
67
+ }
68
+ export default TooltipMore;
69
+
@@ -0,0 +1,28 @@
1
+ @import '~@/_mixin.less';
2
+
3
+ .moreWrap{
4
+ display: flex;
5
+ flex-direction: column;
6
+ max-height: 300px;
7
+ overflow: hidden;
8
+ .text{
9
+ max-height: 240px;
10
+ overflow: auto;
11
+ .scrollBarDark;
12
+ }
13
+ .btnMoreWrap{
14
+ display: flex;
15
+ align-items: center;
16
+
17
+ .btnMore{
18
+ color:#479CFF;
19
+ font-size: 14px;
20
+ font-weight: bold;
21
+ cursor: pointer;
22
+ &:hover{
23
+ color:#70A9FF;
24
+ }
25
+ }
26
+ }
27
+
28
+ }
@@ -8,23 +8,80 @@ import ProviderApp from '@/provider/app';
8
8
  import {useLoading} from '@/hooks/index';
9
9
  // @ts-ignore
10
10
  import styles from './index.less';
11
+ import { AUTH_DEBUG_OPEN } from '@/config';
12
+ import Page403 from '@/pages/error/403';
11
13
 
12
14
 
15
+ const AuthShowDebug=props=>{
16
+ return <div className={styles.authDebug} data-auth={props.auth}>
17
+ {props.children}
18
+ </div>
19
+ }
20
+
13
21
  /**
14
22
  * 检查用户是否带有某个权限
15
23
  * @param {object} props
16
- * @param {string} [props.name] - 权限的名称
24
+ * @param {string|string[]} [props.name] - 权限的名称
17
25
  * @param {JSX.Element} [props.children] - 子组件
26
+ * @param {JSX.Element} [props.noAuthComponent=<></>] - 没权限时展示的内容
27
+ * @param {boolean} [props.noDebugShow=false] - 禁止调试模式下的强制显示
28
+ * @param {import('@/provider/app').AppContaniner} [props.appProvider] - appProivder
18
29
  *
19
30
  * @returns {JSX.Element}
20
31
  */
21
32
  export const AuthShow=(props)=>{
33
+ const {name,noAuthComponent=<></>,appProvider,noDebugShow} = props;
34
+ const app = appProvider||ProviderApp.useContainer();
35
+
36
+ let hasAuth = app.hasAuth(name);
37
+ if(AUTH_DEBUG_OPEN&&!noDebugShow){
38
+ return <AuthShowDebug auth={hasAuth}>{props.children}</AuthShowDebug>;
39
+ }
40
+ return hasAuth?props.children:noAuthComponent
41
+ }
42
+
43
+
44
+ /**
45
+ * 检查用户是否带有某个权限
46
+ * @param {object} props
47
+ * @param {string|string[]} [props.name] - 权限的名称
48
+ * @param {JSX.Element} [props.children] - 子组件
49
+ * @param {JSX.Element} [props.noAuthComponent=<></>] - 没权限时展示的内容
50
+ * @param {import('@/provider/app').AppContaniner} [props.appProvider] - appProivder
51
+ *
52
+ * @returns {JSX.Element}
53
+ */
54
+ export const AuthPage=(props)=>{
55
+ const {name,noAuthComponent=<Page403 />,appProvider} = props;
56
+ const app = appProvider||ProviderApp.useContainer();
57
+
58
+ let hasAuth = app.hasAuth(name);
59
+ // if(AUTH_DEBUG_OPEN){
60
+ // return <AuthShowDebug auth={hasAuth}>{props.children}</AuthShowDebug>;
61
+ // }
62
+
63
+ if(!hasAuth){
64
+ return noAuthComponent;
65
+ }
66
+ return props.children;
67
+ }
68
+
69
+
70
+ export const AuthRoute=(props)=>{
22
71
  const {name} = props;
23
72
  const app = ProviderApp.useContainer();
24
- if(app?.auths?.includes(name)){
73
+ if(Array.isArray(name)){
74
+ for(let i=0;i<name.length;i++){
75
+ let authName = name[i];
76
+ if(app?.auths?.includes(authName)){
77
+ return props.children;
78
+ }
79
+ }
80
+ }
81
+ else if(app?.auths?.includes(name)){
25
82
  return props.children;
26
83
  }
27
- return <></>
84
+ return <>暂无权限</>
28
85
  }
29
86
 
30
87
  /**
@@ -0,0 +1,27 @@
1
+ // @ts-ignore
2
+ import React from 'react';
3
+ // @ts-ignore
4
+ import { Navigate } from 'react-router-dom';
5
+ import ProviderMenu from '@/provider/menu';
6
+ import ProviderApp from '@/provider/app';
7
+
8
+
9
+ const NavCheck=(props)=>{
10
+ const {to} = props;
11
+ const providerMenu = ProviderMenu.useContainer();
12
+ const providerApp = ProviderApp.useContainer();
13
+ if(to=='/auth/user'){
14
+ debugger;
15
+ }
16
+ let menu = providerMenu.getMenuNavigateTo(to,providerApp.auths);
17
+ if(menu == 404){
18
+ return <Navigate to='/401'/>
19
+ }else if( menu == 403){
20
+ return <Navigate to='/403'/>
21
+ }
22
+ else if(menu){
23
+ return <Navigate to={menu.url||to} />
24
+ }
25
+
26
+ }
27
+ export default NavCheck;
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ import {AntdButton} from "@/components/antd";
3
+ import useThrottole from '@/hooks/useThrottole';
4
+
5
+ /**
6
+ * 增加了节流的AntdButton
7
+ */
8
+ const AsyncButton=props=>{
9
+ const {children,onClick:_onClick,throttle=100,disabled,...others} = props;
10
+ const _useThrottole = useThrottole({throttle})
11
+ const onClick=_useThrottole.makeThrottole( _onClick )
12
+
13
+ return <AntdButton onClick={onClick} disabled={_useThrottole.throttleing||disabled} {...others}>{children}</AntdButton>
14
+ }
15
+ AsyncButton.Group = AntdButton.Group;
16
+
17
+ export default AsyncButton;
@@ -3,7 +3,7 @@ import React from 'react';
3
3
  // @ts-ignore
4
4
  import ReactJson from 'react-json-view'
5
5
  // @ts-ignore
6
- import {Tooltip} from 'antd';
6
+ import {Tooltip} from '@/components/antd';
7
7
  // @ts-ignore
8
8
  import styles from './index.less';
9
9
 
@@ -0,0 +1,39 @@
1
+ import React, { useState } from 'react';
2
+ import { useEffect } from 'react';
3
+ import ReactDOM from 'react-dom';
4
+
5
+ const ErrorBoundary = props => {
6
+ const {children}= props;
7
+ const [hasError, setHasError] = useState(false);
8
+
9
+ const onReload=()=>{
10
+ window.location.reload();
11
+ }
12
+ const handleError = (error, errorInfo) => {
13
+ if (error.name.toLowerCase() =='ChunkLoadError'.toLowerCase() ) {
14
+ setHasError(true);
15
+ onReload()
16
+ // ReactDOM.render(<h1>站点已更新,即将重新加载...</h1>, document.getElementById('main-view'));
17
+ // setTimeout(()=>{
18
+ // onReload()
19
+ // },2000)
20
+ }
21
+ };
22
+
23
+ useEffect(() => {
24
+ const errorListener = (event) => {
25
+ handleError(event.error, event.errorInfo);
26
+ };
27
+ window.addEventListener('error', errorListener);
28
+ return () => {
29
+ window.removeEventListener('error', errorListener);
30
+ };
31
+ }, []);
32
+
33
+ if (hasError) {
34
+ return <></>;
35
+ }
36
+ return children;
37
+ };
38
+
39
+ export default ErrorBoundary;
@@ -1,6 +1,6 @@
1
1
  import React, { useState } from 'react';
2
2
  // @ts-ignore
3
- import { Image } from 'antd';
3
+ import { Image } from '@/components/antd';
4
4
  import ShowPreview from './preview';
5
5
  // @ts-ignore
6
6
  import styles from './index.less';
@@ -1,6 +1,6 @@
1
1
  import React, { useState } from 'react';
2
2
  import ReactDom from 'react-dom';
3
- import { Image,Button,Space } from 'antd';
3
+ import { Image,Button,Space } from '@/components/antd';
4
4
  import { CloseOutlined } from '@ant-design/icons';
5
5
  import Popup from '@/components/popup';
6
6
  // @ts-ignore
@@ -1,9 +1,9 @@
1
1
  // @ts-ignore
2
2
  import React from 'react';
3
3
  // @ts-ignore
4
- import { ConfigProvider } from 'antd';
4
+ import { ConfigProvider } from '@/components/antd';
5
5
  // @ts-ignore
6
- import zhCN from 'antd/lib/locale/zh_CN';
6
+ import {zhCN} from '@/components/antd';
7
7
 
8
8
  import ProviderApp from '@/provider/app';
9
9