kn-cli 1.0.90 → 1.0.91

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 (149) hide show
  1. package/package.json +1 -1
  2. package/readme.md +4 -0
  3. package/src/create.js +22 -2
  4. package/src/utils/index.js +1 -1
  5. package/templates/template_admin/cli.config.js +1 -1
  6. package/templates/template_admin/jsconfig.json +5 -1
  7. package/templates/template_admin/package.json +1 -1
  8. package/templates/template_admin/public/index.html +2 -2
  9. package/templates/template_admin/public/src/components/{Auth → auth}/index.jsx +21 -3
  10. package/templates/template_admin/public/src/components/{IconFont → iconFont}/index.jsx +10 -0
  11. package/templates/template_admin/public/src/components/{Layout/Basic → layout/basic}/index.jsx +13 -3
  12. package/templates/template_admin/public/src/components/layout/centerBody/index.jsx +25 -0
  13. package/templates/template_admin/public/src/components/{Layout → layout}/index.jsx +15 -6
  14. package/templates/{template_offcial/public/src/components/Layout/Provider → template_admin/public/src/components/layout/provider}/index.jsx +8 -1
  15. package/templates/{template_app/public/src/components/Link → template_admin/public/src/components/link}/index.jsx +15 -0
  16. package/templates/template_admin/public/src/components/{Menu → menu}/index.jsx +15 -8
  17. package/templates/template_admin/public/src/components/{Page/PageLoading → page/pageLoading}/index.jsx +25 -4
  18. package/templates/template_admin/public/src/components/{Popup → popup}/index.jsx +13 -0
  19. package/templates/{template_app/public/src/components/Toast → template_admin/public/src/components/toast}/index.jsx +20 -1
  20. package/templates/template_admin/public/src/components/{TopMenu → topMenu}/index.jsx +13 -8
  21. package/templates/template_admin/public/src/dictionary/index.js +8 -3
  22. package/templates/template_admin/public/src/hooks/index.jsx +1 -0
  23. package/templates/template_admin/public/src/hooks/useDelay.jsx +5 -0
  24. package/templates/template_admin/public/src/hooks/useImageLoader.jsx +1 -2
  25. package/templates/template_admin/public/src/hooks/useLoading.jsx +5 -1
  26. package/templates/template_admin/public/src/hooks/usePreload.jsx +2 -1
  27. package/templates/template_admin/public/src/hooks/useScrollTop.jsx +12 -0
  28. package/templates/template_admin/public/src/hooks/useSearch.jsx +28 -2
  29. package/templates/template_admin/public/src/hooks/useUpdate.jsx +5 -0
  30. package/templates/template_admin/public/src/index.jsx +16 -2
  31. package/templates/template_admin/public/src/pages/material/index.jsx +2 -1
  32. package/templates/template_admin/public/src/pages/user/index.jsx +7 -2
  33. package/templates/template_admin/public/src/provider/app.jsx +39 -4
  34. package/templates/template_admin/public/src/provider/menu.jsx +4 -1
  35. package/templates/template_admin/public/src/route.jsx +8 -5
  36. package/templates/template_admin/public/src/services/index.js +38 -4
  37. package/templates/template_admin/public/src/services/user.js +3 -3
  38. package/templates/template_admin/public/src/type.js +48 -0
  39. package/templates/template_admin/public/src/utils/index.js +34 -18
  40. package/templates/template_app/cli.config.js +1 -1
  41. package/templates/template_app/jsconfig.json +5 -1
  42. package/templates/template_app/package.json +1 -1
  43. package/templates/template_app/public/src/components/{Auth → auth}/index.jsx +20 -2
  44. package/templates/template_app/public/src/components/{Header → header}/index.jsx +25 -1
  45. package/templates/template_app/public/src/components/{IconFont → iconFont}/index.jsx +10 -0
  46. package/templates/template_app/public/src/components/{Layout/App → layout/app}/index.jsx +12 -2
  47. package/templates/template_app/public/src/components/layout/index.jsx +6 -0
  48. package/templates/{template_admin/public/src/components/Layout/Provider → template_app/public/src/components/layout/provider}/index.jsx +3 -0
  49. package/templates/template_app/public/src/components/link/index.jsx +39 -0
  50. package/templates/template_app/public/src/components/{Marquee → marquee}/index.jsx +11 -2
  51. package/templates/template_app/public/src/components/{Page/PageLoading → page/pageLoading}/index.jsx +23 -3
  52. package/templates/template_app/public/src/components/{Popup → popup}/index.jsx +13 -0
  53. package/templates/{template_offcial/public/src/components/Toast → template_app/public/src/components/toast}/index.jsx +21 -1
  54. package/templates/template_app/public/src/dictionary/index.js +7 -3
  55. package/templates/template_app/public/src/hooks/index.jsx +1 -0
  56. package/templates/template_app/public/src/hooks/useDelay.jsx +5 -0
  57. package/templates/template_app/public/src/hooks/useImageLoader.jsx +1 -2
  58. package/templates/template_app/public/src/hooks/useLoading.jsx +5 -1
  59. package/templates/template_app/public/src/hooks/usePreload.jsx +2 -1
  60. package/templates/template_app/public/src/hooks/useScrollTop.jsx +12 -0
  61. package/templates/template_app/public/src/index.jsx +22 -5
  62. package/templates/template_app/public/src/pages/dictionary/index.jsx +9 -1
  63. package/templates/template_app/public/src/pages/index.jsx +16 -4
  64. package/templates/template_app/public/src/pages/list/index.jsx +7 -1
  65. package/templates/template_app/public/src/pages/login/index.jsx +10 -4
  66. package/templates/template_app/public/src/pages/user/index.jsx +7 -2
  67. package/templates/template_app/public/src/provider/app.jsx +5 -3
  68. package/templates/template_app/public/src/route.jsx +5 -2
  69. package/templates/template_app/public/src/services/index.js +10 -8
  70. package/templates/template_app/public/src/services/user.js +4 -4
  71. package/templates/template_app/public/src/type.js +27 -0
  72. package/templates/template_app/public/src/utils/index.js +6 -0
  73. package/templates/template_oa/cli.config.js +1 -1
  74. package/templates/template_oa/package.json +1 -1
  75. package/templates/template_oa_jwt/cli.config.js +1 -1
  76. package/templates/template_oa_jwt/package.json +1 -1
  77. package/templates/template_offcial/cli.config.js +1 -1
  78. package/templates/template_offcial/jsconfig.json +5 -1
  79. package/templates/template_offcial/package.json +1 -1
  80. package/templates/template_offcial/public/src/components/{Footer → footer}/index.jsx +15 -1
  81. package/templates/template_offcial/public/src/components/{Header → header}/index.jsx +14 -0
  82. package/templates/template_offcial/public/src/components/{IconFont → iconFont}/index.jsx +10 -0
  83. package/templates/template_offcial/public/src/components/{Layout → layout}/index.jsx +10 -3
  84. package/templates/{template_app/public/src/components/Layout/Provider → template_offcial/public/src/components/layout/provider}/index.jsx +7 -0
  85. package/templates/template_offcial/public/src/components/link/index.jsx +39 -0
  86. package/templates/template_offcial/public/src/components/{Page/PageLoading → page/pageLoading}/index.jsx +25 -4
  87. package/templates/template_offcial/public/src/components/{Popup → popup}/index.jsx +13 -0
  88. package/templates/{template_admin/public/src/components/Toast → template_offcial/public/src/components/toast}/index.jsx +20 -1
  89. package/templates/template_offcial/public/src/hooks/index.jsx +1 -0
  90. package/templates/template_offcial/public/src/hooks/useImageLoader.jsx +1 -0
  91. package/templates/template_offcial/public/src/hooks/useInToView.jsx +3 -0
  92. package/templates/template_offcial/public/src/hooks/usePreload.jsx +1 -0
  93. package/templates/template_offcial/public/src/hooks/useScroll.jsx +8 -0
  94. package/templates/template_offcial/public/src/index.jsx +15 -2
  95. package/templates/template_offcial/public/src/pages/index.jsx +8 -1
  96. package/templates/template_offcial/public/src/pages/pc/index.jsx +4 -2
  97. package/templates/template_offcial/public/src/provider/app.jsx +28 -2
  98. package/templates/template_offcial/public/src/route.jsx +4 -2
  99. package/templates/template_offcial/public/src/services/index.js +38 -2
  100. package/templates/template_offcial/public/src/services/user.js +3 -3
  101. package/templates/template_offcial/public/src/type.js +47 -0
  102. package/src/.DS_Store +0 -0
  103. package/templates/template_admin/.gitignore +0 -6
  104. package/templates/template_admin/public/src/components/Alert/index.jsx +0 -0
  105. package/templates/template_admin/public/src/components/Alert/index.less +0 -0
  106. package/templates/template_admin/public/src/components/Header/index.jsx +0 -57
  107. package/templates/template_admin/public/src/components/Layout/CenterBody/index.jsx +0 -15
  108. package/templates/template_admin/public/src/components/Link/index.jsx +0 -24
  109. package/templates/template_admin/public/src/components/Loading/index.jsx +0 -14
  110. package/templates/template_admin/public/src/components/Loading/index.less +0 -85
  111. package/templates/template_admin/public/src/components/mask/index.jsx +0 -47
  112. package/templates/template_admin/public/src/components/mask/index.less +0 -32
  113. package/templates/template_admin/public/src/hooks/useLogin.jsx +0 -33
  114. package/templates/template_app/.gitignore +0 -6
  115. package/templates/template_app/public/src/components/Header/index.less +0 -57
  116. package/templates/template_app/public/src/components/Layout/index.jsx +0 -4
  117. package/templates/template_app/public/src/hooks/useLogin.jsx +0 -33
  118. package/templates/template_oa/.gitignore +0 -6
  119. package/templates/template_oa_jwt/.gitignore +0 -6
  120. package/templates/template_offcial/.gitignore +0 -6
  121. package/templates/template_offcial/public/src/components/Alert/index.jsx +0 -0
  122. package/templates/template_offcial/public/src/components/Alert/index.less +0 -0
  123. package/templates/template_offcial/public/src/components/Link/index.jsx +0 -24
  124. /package/templates/template_admin/public/src/components/{IconFont → iconFont}/index.less +0 -0
  125. /package/templates/template_admin/public/src/components/{Layout/Basic → layout/basic}/index.less +0 -0
  126. /package/templates/template_admin/public/src/components/{Layout/CenterBody → layout/centerBody}/index.less +0 -0
  127. /package/templates/template_admin/public/src/components/{Layout → layout}/index.less +0 -0
  128. /package/templates/template_admin/public/src/components/{Link → link}/index.less +0 -0
  129. /package/templates/template_admin/public/src/components/{Menu → menu}/index.less +0 -0
  130. /package/templates/template_admin/public/src/components/{Page/PageLoading → page/pageLoading}/index.less +0 -0
  131. /package/templates/template_admin/public/src/components/{Popup → popup}/index.less +0 -0
  132. /package/templates/template_admin/public/src/components/{Toast → toast}/index.less +0 -0
  133. /package/templates/template_admin/public/src/components/{TopMenu → topMenu}/index.less +0 -0
  134. /package/templates/{template_admin/public/src/components/Header → template_app/public/src/components/header}/index.less +0 -0
  135. /package/templates/template_app/public/src/components/{IconFont → iconFont}/index.less +0 -0
  136. /package/templates/template_app/public/src/components/{Layout/App → layout/app}/index.less +0 -0
  137. /package/templates/template_app/public/src/components/{Link → link}/index.less +0 -0
  138. /package/templates/template_app/public/src/components/{Marquee → marquee}/index.less +0 -0
  139. /package/templates/template_app/public/src/components/{Page/PageLoading → page/pageLoading}/index.less +0 -0
  140. /package/templates/template_app/public/src/components/{Popup → popup}/index.less +0 -0
  141. /package/templates/template_app/public/src/components/{Toast → toast}/index.less +0 -0
  142. /package/templates/template_offcial/public/src/components/{Footer → footer}/index.less +0 -0
  143. /package/templates/template_offcial/public/src/components/{Header → header}/index.less +0 -0
  144. /package/templates/template_offcial/public/src/components/{IconFont → iconFont}/index.less +0 -0
  145. /package/templates/template_offcial/public/src/components/{Layout → layout}/index.less +0 -0
  146. /package/templates/template_offcial/public/src/components/{Link → link}/index.less +0 -0
  147. /package/templates/template_offcial/public/src/components/{Page/PageLoading → page/pageLoading}/index.less +0 -0
  148. /package/templates/template_offcial/public/src/components/{Popup → popup}/index.less +0 -0
  149. /package/templates/template_offcial/public/src/components/{Toast → toast}/index.less +0 -0
@@ -1,6 +1,6 @@
1
1
 
2
2
  module.exports = {
3
- name:'template-oa',
3
+ name:'projectName',
4
4
  registryType:'npm',//npm镜像源,taobao|npm
5
5
  less:{
6
6
  javascriptEnabled:true,//是否开启less js
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "template_oa",
2
+ "name": "projectName",
3
3
  "version": "1.0.0",
4
4
  "main": "lib/index",
5
5
  "scripts": {
@@ -1,6 +1,6 @@
1
1
 
2
2
  module.exports = {
3
- name:'template-oa-jwt',
3
+ name:'projectName',
4
4
  registryType:'npm',//npm镜像源,taobao|npm
5
5
  less:{
6
6
  javascriptEnabled:true,//是否开启less js
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "template-oa-jwt",
2
+ "name": "projectName",
3
3
  "version": "1.0.0",
4
4
  "main": "lib/index",
5
5
  "scripts": {
@@ -1,6 +1,6 @@
1
1
 
2
2
  module.exports = {
3
- name:'template-offical',
3
+ name:'projectName',
4
4
  version:'1.0',
5
5
  registryType:'npm',//npm镜像源,taobao|npm
6
6
  less:{
@@ -3,8 +3,12 @@
3
3
  "baseUrl": ".",
4
4
  "emitDecoratorMetadata": true,
5
5
  "experimentalDecorators": true,
6
+ "lib": ["dom", "ES2021"],
7
+ "allowJs":true,
8
+ "checkJs": true,
9
+ "jsx": "react",
6
10
  "paths": {
7
11
  "@/*": ["./public/src/*"]
8
- }
12
+ },
9
13
  }
10
14
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "template-offical",
2
+ "name": "projectName",
3
3
  "version": "1.0.0",
4
4
  "main": "lib/index",
5
5
  "scripts": {
@@ -1,8 +1,20 @@
1
+ // @ts-ignore
1
2
  import React, { useEffect, useState } from 'react';
2
- import styles from './index.less';
3
+
3
4
  import { isMobile } from '@/utils';
4
5
 
6
+ // @ts-ignore
7
+ import styles from './index.less';
8
+
5
9
 
10
+ /**
11
+ * 页脚
12
+ * @param {object} props
13
+ * @param {string} [props.name='footer'] - 页脚名称
14
+ * @param {string} [props.defaultHeight='100%'] - 默认footer高度
15
+ *
16
+ * @returns {JSX.Element}
17
+ */
6
18
  const Footer = (props) => {
7
19
  const {name='footer',defaultHeight='100%'}=props;
8
20
  const [url, setUrl] = useState('');
@@ -17,9 +29,11 @@ const Footer = (props) => {
17
29
  })
18
30
 
19
31
  if(isMobile()){
32
+ // @ts-ignore
20
33
  setUrl(`${MICRO_FRONT}/offcial-footer/mobileFooter.html`);
21
34
  return;
22
35
  }
36
+ // @ts-ignore
23
37
  setUrl(`${MICRO_FRONT}/offcial-footer/pcFooter.html`)
24
38
  }, [])
25
39
  return (
@@ -1,7 +1,15 @@
1
+ // @ts-ignore
1
2
  import React, { useEffect, useRef, useState } from 'react';
3
+
2
4
  import useScroll from '@/hooks/useScroll';
5
+
6
+ // @ts-ignore
3
7
  import styles from './index.less';
4
8
 
9
+ /**
10
+ * 头部导航栏
11
+ * @returns {JSX.Element}
12
+ */
5
13
  const Header = () => {
6
14
  const scroll = useScroll();
7
15
  const menu = [
@@ -14,7 +22,9 @@ const Header = () => {
14
22
  const refSetActiveMenu = useRef();
15
23
  const refScroll = useRef();
16
24
 
25
+ // @ts-ignore
17
26
  refScroll.current=scroll;
27
+ // @ts-ignore
18
28
  refSetActiveMenu.current=setActiveMenu;
19
29
 
20
30
  const onClick = (type) => {
@@ -30,18 +40,22 @@ const Header = () => {
30
40
 
31
41
  scroll.addEventListener('scroll',(top)=>{
32
42
  if(top==0){
43
+ // @ts-ignore
33
44
  refSetActiveMenu.current(menu[0].type);
34
45
  return;
35
46
  }
36
47
  for(let i=menusDom.length-1;i>0;i--){
37
48
  if( menusDom[i] ){
38
49
  let currentTop= menusDom[i].offsetTop;
50
+ // @ts-ignore
39
51
  if(top+refScroll.current.height*0.6 >= currentTop){
52
+ // @ts-ignore
40
53
  refSetActiveMenu.current(menu[i].type);
41
54
  return;
42
55
  }
43
56
  }
44
57
  }
58
+ // @ts-ignore
45
59
  refSetActiveMenu.current(menu[0].type);
46
60
 
47
61
  })
@@ -1,6 +1,16 @@
1
+ // @ts-ignore
1
2
  import React from "react";
3
+ // @ts-ignore
2
4
  import styles from'./index.less';
3
5
 
6
+ /**
7
+ * iconFont图标
8
+ * @param {object} props
9
+ * @param {string} [props.icon] - 图标名称
10
+ * @param {string} [props.className] - 扩展类名
11
+ *
12
+ * @returns {JSX.Element}
13
+ */
4
14
  const IconFont=(props)=>{
5
15
  const {icon,className,...others} = props;
6
16
  return (
@@ -1,10 +1,17 @@
1
- import React, { useEffect } from 'react';
2
- import ProviderApp from '@/provider/app';
1
+ // @ts-ignore
2
+ import React from 'react';
3
+ // @ts-ignore
3
4
  import {Outlet} from 'react-router-dom';
4
5
 
6
+ import ProviderApp from '@/provider/app';
7
+
8
+ // @ts-ignore
5
9
  import styles from './index.less';
6
10
 
7
- // 站点最基础的layout,用于控制一些全局环境变量
11
+ /**
12
+ * 注入AppProvider
13
+ * @returns {JSX.Element}
14
+ */
8
15
  const Layout = (props) => {
9
16
  return (
10
17
  <ProviderApp.Provider>
@@ -1,7 +1,14 @@
1
+ // @ts-ignore
1
2
  import React from 'react';
3
+ // @ts-ignore
2
4
  import {Outlet} from 'react-router-dom';
5
+
3
6
  import ProviderApp from '@/provider/app';
4
7
 
8
+ /**
9
+ * 注入AppProvider
10
+ * @returns {JSX.Element}
11
+ */
5
12
  const LayoutProvider=(props)=>{
6
13
  return (
7
14
  <ProviderApp.Provider>
@@ -0,0 +1,39 @@
1
+ // @ts-ignore
2
+ import React from 'react';
3
+
4
+ import { openLink } from '@/utils';
5
+
6
+ // @ts-ignore
7
+ import styles from './index.less';
8
+
9
+ /**
10
+ * 超链接组件
11
+ * @param {object} [props]
12
+ * @param {JSX.Element|string} [props.children] - 子组件
13
+ * @param {string} [props.className] - 扩展类样式名称
14
+ * @param {Function} [props.onClick] - 点击链接的回调
15
+ * @param {string} [props.href] - 跳转链接
16
+ * @param {string} [props.target] - 当target='_blank'时代表新窗口打开
17
+ *
18
+ * @returns {JSX.Element}
19
+ */
20
+ const Link=(props)=>{
21
+ const {children,className='',onClick,href='',target=''} = props;
22
+
23
+ const onLink=()=>{
24
+ if(href){
25
+ if(target=='_blank'){
26
+ openLink(href);
27
+ // window.open(href);
28
+ }else{
29
+ location.href=href;
30
+ }
31
+ return;
32
+ }
33
+ if(onClick)onClick();
34
+ }
35
+ return (
36
+ <span onClick={onLink} className={`${styles.linkWrap} ${className}`}>{children}</span>
37
+ )
38
+ }
39
+ export default React.memo(Link);
@@ -1,13 +1,27 @@
1
- import React,{useEffect, useState} from 'react';
1
+ // @ts-ignore
2
+ import React from 'react';
3
+ // @ts-ignore
2
4
  import ReactDOM from 'react-dom';
3
- import CSS from './index.less';
4
- import Popup from '@/components/Popup';
5
+
6
+ import Popup from '@/components/popup';
7
+
8
+ // @ts-ignore
5
9
  import imgLoading from '@/assets/images/loading.svg';
6
10
 
11
+ // @ts-ignore
12
+ import CSS from './index.less';
13
+
14
+ /**
15
+ * 页面Loading状态
16
+ * @param {object} [props]
17
+ * @param {boolean} [props.visible=true] - 是否显示状态
18
+ *
19
+ * @returns {JSX.Element}
20
+ */
7
21
  const PageLoading = (props) => {
8
22
  const {visible=true} = props;
9
23
  if(!visible){
10
- return '';
24
+ return <></>;
11
25
  }
12
26
  return (
13
27
  <div className={CSS.wrap } >
@@ -18,6 +32,13 @@ const PageLoading = (props) => {
18
32
  );
19
33
  };
20
34
 
35
+ /**
36
+ * 全屏置顶显示一个页面loading组件
37
+ * @param {object} [props]
38
+ * @param {boolean} [props.canTouch=false] - 是否允许用户点击屏幕穿透到下面的组件
39
+ *
40
+ * @returns {(string)=>void}
41
+ */
21
42
  export const ShowPageLoading=(props={canTouch:false})=>{
22
43
  let popup = Popup(()=>{},{cantouch:props.canTouch});
23
44
  ReactDOM.render(
@@ -1,8 +1,21 @@
1
+ // @ts-ignore
1
2
  import React from 'react';
3
+ // @ts-ignore
2
4
  import ReactDOM from 'react-dom';
5
+
6
+ // @ts-ignore
3
7
  import styles from './index.less';
4
8
  styles;
5
9
 
10
+ /**
11
+ * 一个全屏置顶的遮罩层
12
+ * @param {(result)=>void} reslove - 遮罩层的关闭回调
13
+ * @param {Object} [options] - 参数
14
+ * @param {boolean} [options.cantouch=false] - 是否允许被点击穿透
15
+ * @param {boolean} [options.transparent=false] - 是否遮罩层完全透明
16
+ *
17
+ * @returns { {dom:HTMLElement,destory:()=>void} }
18
+ */
6
19
  const Popup = (reslove,options) => {
7
20
  let rootDom = document.createElement('div');
8
21
  rootDom.className='popup-box';
@@ -1,7 +1,13 @@
1
+ // @ts-ignore
1
2
  import React,{useEffect} from 'react';
3
+ // @ts-ignore
2
4
  import ReactDOM from 'react-dom';
5
+
6
+ // @ts-ignore
7
+ import Popup from '@/components/popup';
8
+
9
+ // @ts-ignore
3
10
  import styles from './index.less';
4
- import Popup from '@/components/Popup/index.jsx';
5
11
 
6
12
  const toastList=[];
7
13
  const runNext=()=>{
@@ -43,12 +49,25 @@ const Toast=props=>{
43
49
  )
44
50
  }
45
51
 
52
+ /**
53
+ * @typedef {object} ToastOptions
54
+ * @property {string} message - 吐司文案内容
55
+ * @property {number} [delay=2000] - 持续时间,毫秒
56
+ * @property {string} [position] - 显示位置,center|top|bottom
57
+ * @property {Function} [resolve] - 显示完毕的回调
58
+ */
46
59
 
60
+ /**
61
+ * 显示一个吐司信息
62
+ * @param {ToastOptions|string} [props] - 文案内容或一个配置参数
63
+ * @returns { Promise }
64
+ */
47
65
  const ShowToast=props=>{
48
66
  if(typeof props === 'string'){
49
67
  props = {message:props}
50
68
  }
51
69
  return new Promise((resolve) => {
70
+ // @ts-ignore
52
71
  props.resolve = resolve;
53
72
  toastList.push(props);
54
73
  if(toastList.length===1){
@@ -2,6 +2,7 @@
2
2
 
3
3
  import useImageLoader from './useImageLoader';
4
4
  import usePreload from './usePreload';
5
+ // @ts-ignore
5
6
  import {usePagination,usePaginationWithForm} from 'kn-hooks';
6
7
 
7
8
  export {
@@ -1,3 +1,4 @@
1
+ // @ts-ignore
1
2
  import React, { useEffect,useState,useMemo } from 'react';
2
3
 
3
4
 
@@ -1,3 +1,4 @@
1
+ // @ts-ignore
1
2
  import React, { useEffect,useState,useMemo,useRef,useCallback } from 'react';
2
3
 
3
4
 
@@ -9,6 +10,7 @@ const useInToView=(props)=>{
9
10
 
10
11
  const destory=()=>{
11
12
  if(refObserver.current){
13
+ // @ts-ignore
12
14
  refObserver.current=disconnect();
13
15
  refObserver.current=null;
14
16
  }
@@ -34,6 +36,7 @@ const useInToView=(props)=>{
34
36
  setVisibled(true);
35
37
  });
36
38
  observe.observe(refDom.current);
39
+ // @ts-ignore
37
40
  refObserver.current=observe;
38
41
  }
39
42
  const setDom=(dom)=>{
@@ -1,3 +1,4 @@
1
+ // @ts-ignore
1
2
  import React, { useEffect,useState,useMemo,useRef,useCallback } from 'react';
2
3
 
3
4
  const usePreload=(files)=>{
@@ -1,3 +1,4 @@
1
+ // @ts-ignore
1
2
  import React, { useEffect, useState, useRef } from 'react';
2
3
 
3
4
 
@@ -12,7 +13,9 @@ const useScroll=(targetDom='#appLayout')=>{
12
13
  const refScrollDom = useRef();
13
14
  const refSetIsScroll = useRef();
14
15
  const refIsScroll = useRef();
16
+ // @ts-ignore
15
17
  refIsScroll.current= isScroll;
18
+ // @ts-ignore
16
19
  refSetIsScroll.current= setIsScroll;
17
20
 
18
21
  useEffect(()=>{
@@ -22,15 +25,18 @@ const useScroll=(targetDom='#appLayout')=>{
22
25
  refScrollDom.current = targetDom;
23
26
  }
24
27
  let dom = refScrollDom.current;
28
+ // @ts-ignore
25
29
  setHeight(dom.clientHeight)
26
30
 
27
31
  const fn=(e)=>{
28
32
  if(e.target.scrollTop>0){
29
33
  if(!refIsScroll.current){
34
+ // @ts-ignore
30
35
  refSetIsScroll.current(true);
31
36
  }
32
37
  }else{
33
38
  if(refIsScroll.current){
39
+ // @ts-ignore
34
40
  refSetIsScroll.current(false);
35
41
  }
36
42
  }
@@ -38,8 +44,10 @@ const useScroll=(targetDom='#appLayout')=>{
38
44
  fn(e.target.scrollTop);
39
45
  })
40
46
  }
47
+ // @ts-ignore
41
48
  dom.addEventListener('scroll',fn);
42
49
  return ()=>{
50
+ // @ts-ignore
43
51
  dom.removeEventListener('scroll',fn);
44
52
  }
45
53
  },[]);
@@ -1,5 +1,8 @@
1
+ // @ts-ignore
1
2
  import React from 'react';
3
+ // @ts-ignore
2
4
  import ReactDOM from 'react-dom';
5
+ // @ts-ignore
3
6
  import {HashRouter} from 'react-router-dom';
4
7
  // import {createRoot} from 'react-dom/client';
5
8
  // import { createHashRouter,RouterProvider } from 'react-router-dom';
@@ -7,33 +10,43 @@ import './_antd.less';
7
10
  import './_reset.less';
8
11
  import {RouteList} from './route';
9
12
 
10
-
13
+ // @ts-ignore
11
14
  if(MOCK){
12
15
  let mock = require('@/mock');
13
16
  mock;
14
17
  }
15
-
18
+ // @ts-ignore
16
19
  window.appLog=(txt)=>{
17
20
  console.log(txt);
18
21
  }
19
22
 
20
23
  /* eslint-disable */
24
+ // @ts-ignore
21
25
  if(BUILD_ENV!='prod'){
26
+ // @ts-ignore
22
27
  let VConsole = require('vconsole');
28
+ // @ts-ignore
23
29
  const vConsole = new VConsole();
24
30
  setTimeout(() => {
25
31
  vConsole.setSwitchPosition(70, 10);
26
32
  }, 2000);
27
33
  }
28
34
 
35
+ // @ts-ignore
29
36
  if(BUILD_ENV){
37
+ // @ts-ignore
30
38
  window.appLog(`代码环境类型:${BUILD_ENV}`);
31
39
  }
40
+ // @ts-ignore
32
41
  if (VERSION_HASH) {
42
+ // @ts-ignore
33
43
  window.appLog(`VERSION_HASH:${VERSION_HASH}`);
34
44
  }
45
+ // @ts-ignore
35
46
  window.appLog(`log init`);
47
+ // @ts-ignore
36
48
  window.appLog(`${location.href}`);
49
+ // @ts-ignore
37
50
  window.appLog(`ua:${navigator.userAgent}`);
38
51
  /* eslint-enable */
39
52
 
@@ -1,10 +1,17 @@
1
+ // @ts-ignore
1
2
  import React, { useState, useEffect } from 'react';
2
- import { isMobile } from '@/utils';
3
+ // @ts-ignore
3
4
  import { useNavigate } from 'react-router-dom';
4
5
 
6
+ import { isMobile } from '@/utils';
7
+
5
8
 
6
9
 
7
10
 
11
+ /**
12
+ *
13
+ * @returns {JSX.Element}
14
+ */
8
15
  const Home = () => {
9
16
  console.log('🌹🌹🌹 Home 🌹🌹🌹')
10
17
  const navigate = useNavigate();
@@ -1,8 +1,10 @@
1
1
 
2
2
  import React, { useState, useEffect } from 'react';
3
- import Header from '@/components/Header';
3
+ import Header from '@/components/header';
4
+
5
+ // @ts-ignore
4
6
  import styles from './index.less';
5
- import Footer from '@/components/Footer';
7
+ import Footer from '@/components/footer';
6
8
  import useInToView from '@/hooks/useInToView';
7
9
 
8
10
  const PcHome=()=>{
@@ -1,7 +1,28 @@
1
- import { useState,useMemo, useEffect } from 'react';
2
- import { useSearchParams,useNavigate } from 'react-router-dom';
1
+ // @ts-ignore
2
+ import { useState,useMemo } from 'react';
3
+ // @ts-ignore
4
+ import { useNavigate } from 'react-router-dom';
5
+ // @ts-ignore
3
6
  import { createContainer } from "unstated-next"
4
7
 
8
+
9
+
10
+ /**
11
+ * @typedef AppContaniner
12
+ * @property {boolean} loading - 当前是否是加载状态
13
+ * @property {(open:boolean)=>void} setLoading - 设置加载状态
14
+ * @property {object} nav - 导航栏配置
15
+ * @property {(option:object)=>void} setNav - 设置导航栏配置
16
+ *
17
+ */
18
+
19
+ /**
20
+ * @typedef {object} AppProvider
21
+ * @property {function():AppContaniner} useContainer
22
+ * @property {React.ComponentType<any>} Provider
23
+ */
24
+
25
+
5
26
  const useApp=() =>{
6
27
  const navigate= useNavigate();
7
28
  const [loading,setLoading] = useState(true);
@@ -21,6 +42,11 @@ const useApp=() =>{
21
42
  return action
22
43
  }
23
44
 
45
+
46
+
47
+ /**
48
+ * @type {AppProvider}
49
+ */
24
50
  const App = createContainer(useApp);
25
51
 
26
52
  export default App;
@@ -1,8 +1,10 @@
1
+ // @ts-ignore
1
2
  import React,{Suspense} from 'react';
3
+ // @ts-ignore
2
4
  import { Routes, Route } from 'react-router-dom';
3
5
 
4
- import {Layout} from '@/components/Layout';
5
- import PageLoading from '@/components/Page/PageLoading';
6
+ import {Layout} from '@/components/layout';
7
+ import PageLoading from '@/components/page/pageLoading';
6
8
 
7
9
  import Home from '@/pages/index.jsx';
8
10
 
@@ -1,9 +1,16 @@
1
+ // @ts-ignore
1
2
  import Axios from 'axios';
3
+ // @ts-ignore
2
4
  import qs from 'qs';
5
+ // @ts-ignore
3
6
  import { message } from 'antd';
7
+
8
+
4
9
  const axios = Axios.create();
10
+ // @ts-ignore
5
11
  console.log(`========API_ROOT:${API_HOST}========`);
6
12
 
13
+ // @ts-ignore
7
14
  export const API_ROOT = API_HOST;
8
15
 
9
16
  const tokenMode='header';//header,cookie
@@ -29,6 +36,7 @@ export const setJwt = (value) => {
29
36
  jwt = value;
30
37
  };
31
38
 
39
+ // @ts-ignore
32
40
  window.setJwt=setJwt;
33
41
  export const setLogout=(fn)=>{
34
42
  logout=fn;
@@ -96,6 +104,13 @@ axios.interceptors.response.use(
96
104
 
97
105
 
98
106
  let buffer = {};
107
+ /**
108
+ * GET请求
109
+ * @param {string} url - 接口地址
110
+ * @param {Object} [param] - 接口参数
111
+ * @param {Object} [options] - 扩展参数
112
+ * @returns Promise<ServicesResponse>
113
+ */
99
114
  export async function GET_DEFAULT(url, param, options) {
100
115
  if (param) param = qs.stringify(param, { arrayFormat: 'indices' });
101
116
  let now = Date.now();
@@ -128,6 +143,12 @@ export async function GET_DEFAULT(url, param, options) {
128
143
  return response && response.data ? response.data : null;
129
144
  }
130
145
 
146
+ /**
147
+ * GET请求
148
+ * @param {string} url - 接口地址
149
+ * @param {Object} [param] - 接口参数
150
+ * @returns Promise<ServicesResponse>
151
+ */
131
152
  export async function GET_DEFAULT_CROSS(url, param) {
132
153
  if (param) param = qs.stringify(param, { arrayFormat: 'indices' });
133
154
 
@@ -141,7 +162,15 @@ export async function GET_DEFAULT_CROSS(url, param) {
141
162
  return response && response.data ? response.data : null;
142
163
  }
143
164
 
144
- export async function POST_DEFAULT(url, params, method, options) {
165
+ /**
166
+ * POST请求
167
+ * @param {string} url - 接口地址
168
+ * @param {Object} [params] - 接口参数
169
+ * @param {Object} [options] - 特殊参数
170
+ *
171
+ * @returns Promise<ServicesResponse>
172
+ */
173
+ export async function POST_DEFAULT(url, params, options) {
145
174
  let data = params;
146
175
  // if (params) params = qs.stringify(params, { arrayFormat: 'indices' });
147
176
  // if (typeof params === 'string') {
@@ -151,7 +180,7 @@ export async function POST_DEFAULT(url, params, method, options) {
151
180
  // }
152
181
 
153
182
  let response = await axios({
154
- method: method || 'POST',
183
+ method: 'POST',
155
184
  url: url,
156
185
  data,
157
186
  ...options,
@@ -160,6 +189,13 @@ export async function POST_DEFAULT(url, params, method, options) {
160
189
  return response && response.data ? response.data : null;
161
190
  }
162
191
 
192
+ /**
193
+ * POST请求
194
+ * @param {string} url - 接口地址
195
+ * @param {Object} [params] - 接口参数
196
+ *
197
+ * @returns Promise<ServicesResponse>
198
+ */
163
199
  export async function POST_DEFAULT_CROSS(url, params) {
164
200
  let data = {};
165
201
  // if (params) params = qs.stringify(params, { arrayFormat: 'indices' });