kn-cli 1.0.56 → 1.0.57

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 (214) hide show
  1. package/package.json +3 -1
  2. package/templates/template_oa/.DS_Store +0 -0
  3. package/templates/template_oa/build.sh +2 -0
  4. package/templates/template_oa/cli.config.js +24 -0
  5. package/templates/template_oa/dev.sh +89 -0
  6. package/templates/template_oa/frontend_build.sh +83 -0
  7. package/templates/template_oa/init/prepare-commit-msg +5 -0
  8. package/templates/template_oa/init.sh +33 -0
  9. package/templates/template_oa/jsconfig.json +10 -0
  10. package/templates/template_oa/package-lock.json +1925 -0
  11. package/templates/template_oa/package.json +24 -0
  12. package/templates/template_oa/public/.DS_Store +0 -0
  13. package/templates/template_oa/public/404.html +26 -0
  14. package/templates/template_oa/public/favicon.ico +0 -0
  15. package/templates/template_oa/public/favicon.png +0 -0
  16. package/templates/template_oa/public/index.html +43 -0
  17. package/templates/template_oa/public/pluginjs/.DS_Store +0 -0
  18. package/templates/template_oa/public/src/.DS_Store +0 -0
  19. package/templates/template_oa/public/src/_antd.less +237 -0
  20. package/templates/template_oa/public/src/_reset.less +131 -0
  21. package/templates/template_oa/public/src/_variable.less +84 -0
  22. package/templates/template_oa/public/src/assets/.DS_Store +0 -0
  23. package/templates/template_oa/public/src/assets/iconfont/.DS_Store +0 -0
  24. package/templates/template_oa/public/src/assets/iconfont/iconfont.eot +0 -0
  25. package/templates/template_oa/public/src/assets/iconfont/iconfont.less +57 -0
  26. package/templates/template_oa/public/src/assets/iconfont/iconfont.svg +36 -0
  27. package/templates/template_oa/public/src/assets/iconfont/iconfont.ttf +0 -0
  28. package/templates/template_oa/public/src/assets/iconfont/iconfont.woff +0 -0
  29. package/templates/template_oa/public/src/assets/iconfont/iconfont.woff2 +0 -0
  30. package/templates/template_oa/public/src/assets/images/.DS_Store +0 -0
  31. package/templates/template_oa/public/src/assets/images/avatar.png +0 -0
  32. package/templates/template_oa/public/src/assets/images/loading.svg +40 -0
  33. package/templates/template_oa/public/src/components/.DS_Store +0 -0
  34. package/templates/template_oa/public/src/components/Alert/index.jsx +0 -0
  35. package/templates/template_oa/public/src/components/Alert/index.less +0 -0
  36. package/templates/template_oa/public/src/components/Auth/index.jsx +44 -0
  37. package/templates/template_oa/public/src/components/Footer/index.jsx +17 -0
  38. package/templates/template_oa/public/src/components/Footer/index.less +28 -0
  39. package/templates/template_oa/public/src/components/IFrame/index.jsx +37 -0
  40. package/templates/template_oa/public/src/components/IFrame/index.less +4 -0
  41. package/templates/template_oa/public/src/components/IconFont/index.jsx +10 -0
  42. package/templates/template_oa/public/src/components/IconFont/index.less +5 -0
  43. package/templates/template_oa/public/src/components/Layout/.DS_Store +0 -0
  44. package/templates/template_oa/public/src/components/Layout/Basic/index.jsx +31 -0
  45. package/templates/template_oa/public/src/components/Layout/Basic/index.less +74 -0
  46. package/templates/template_oa/public/src/components/Layout/CenterBody/index.jsx +15 -0
  47. package/templates/template_oa/public/src/components/Layout/CenterBody/index.less +36 -0
  48. package/templates/template_oa/public/src/components/Layout/FormBlock/index.jsx +23 -0
  49. package/templates/template_oa/public/src/components/Layout/FormBlock/index.less +34 -0
  50. package/templates/template_oa/public/src/components/Layout/Provider/index.jsx +12 -0
  51. package/templates/template_oa/public/src/components/Layout/index.jsx +26 -0
  52. package/templates/template_oa/public/src/components/Layout/index.less +8 -0
  53. package/templates/template_oa/public/src/components/Link/index.jsx +24 -0
  54. package/templates/template_oa/public/src/components/Link/index.less +11 -0
  55. package/templates/template_oa/public/src/components/Loading/index.jsx +14 -0
  56. package/templates/template_oa/public/src/components/Loading/index.less +85 -0
  57. package/templates/template_oa/public/src/components/Nav/index.jsx +121 -0
  58. package/templates/template_oa/public/src/components/Nav/index.less +38 -0
  59. package/templates/template_oa/public/src/components/Page/.DS_Store +0 -0
  60. package/templates/template_oa/public/src/components/Page/PageLoading/index.jsx +30 -0
  61. package/templates/template_oa/public/src/components/Page/PageLoading/index.less +29 -0
  62. package/templates/template_oa/public/src/components/Popup/index.jsx +22 -0
  63. package/templates/template_oa/public/src/components/Popup/index.less +18 -0
  64. package/templates/template_oa/public/src/components/Toast/index.jsx +60 -0
  65. package/templates/template_oa/public/src/components/Toast/index.less +43 -0
  66. package/templates/template_oa/public/src/components/mask/index.jsx +47 -0
  67. package/templates/template_oa/public/src/components/mask/index.less +32 -0
  68. package/templates/template_oa/public/src/dictionary/index.js +39 -0
  69. package/templates/template_oa/public/src/hooks/.DS_Store +0 -0
  70. package/templates/template_oa/public/src/hooks/index.jsx +20 -0
  71. package/templates/template_oa/public/src/hooks/useDelay.jsx +29 -0
  72. package/templates/template_oa/public/src/hooks/useImageLoader.jsx +27 -0
  73. package/templates/template_oa/public/src/hooks/useLoading.jsx +42 -0
  74. package/templates/template_oa/public/src/hooks/useLogin.jsx +33 -0
  75. package/templates/template_oa/public/src/hooks/usePreload.jsx +66 -0
  76. package/templates/template_oa/public/src/hooks/useScrollTop.jsx +32 -0
  77. package/templates/template_oa/public/src/hooks/useSearch.jsx +137 -0
  78. package/templates/template_oa/public/src/hooks/useUpdate.jsx +11 -0
  79. package/templates/template_oa/public/src/index.jsx +50 -0
  80. package/templates/template_oa/public/src/mock/auth.js +91 -0
  81. package/templates/template_oa/public/src/mock/index.js +63 -0
  82. package/templates/template_oa/public/src/mock/user.js +70 -0
  83. package/templates/template_oa/public/src/mock/utils.js +33 -0
  84. package/templates/template_oa/public/src/pages/.DS_Store +0 -0
  85. package/templates/template_oa/public/src/pages/components/pageTitle/index.jsx +13 -0
  86. package/templates/template_oa/public/src/pages/components/pageTitle/index.less +20 -0
  87. package/templates/template_oa/public/src/pages/login/index.jsx +27 -0
  88. package/templates/template_oa/public/src/pages/login/index.less +44 -0
  89. package/templates/template_oa/public/src/pages/video/index.jsx +91 -0
  90. package/templates/template_oa/public/src/pages/video/index.less +12 -0
  91. package/templates/template_oa/public/src/provider/app.jsx +119 -0
  92. package/templates/template_oa/public/src/provider/menu.jsx +20 -0
  93. package/templates/template_oa/public/src/route.jsx +43 -0
  94. package/templates/template_oa/public/src/services/.DS_Store +0 -0
  95. package/templates/template_oa/public/src/services/auth.js +121 -0
  96. package/templates/template_oa/public/src/services/index.js +181 -0
  97. package/templates/template_oa/public/src/services/user.js +26 -0
  98. package/templates/template_oa/public/src/services/video.js +33 -0
  99. package/templates/template_oa/public/src/utils/.DS_Store +0 -0
  100. package/templates/template_oa/public/src/utils/index.js +66 -0
  101. package/templates/template_oa/public/static/.DS_Store +0 -0
  102. package/templates/template_oa/public/static/about.html +1 -0
  103. package/templates/template_oa/public/static/kssoLogin.html +22 -0
  104. package/templates/template_oa/readme.md +60 -0
  105. package/templates/template_oa/release/.DS_Store +0 -0
  106. package/templates/template_oa/report.sh +68 -0
  107. package/templates/template_oa/tools/.DS_Store +0 -0
  108. package/templates/template_oa/tools/iconfont/.DS_Store +0 -0
  109. package/templates/template_oa/tools/iconfont/dist/.DS_Store +0 -0
  110. package/templates/template_oa/tools/iconfont/gulpfile.js +70 -0
  111. package/templates/template_oa/tools/iconfont/package.json +20 -0
  112. package/templates/template_oa/tools/iconfont/run.sh +39 -0
  113. package/templates/template_oa/tools/iconfont/svg/.DS_Store +0 -0
  114. package/templates/template_oa/tools/iconfont/svg/arrowBack.svg +1 -0
  115. package/templates/template_oa/tools/iconfont/svg/check.svg +1 -0
  116. package/templates/template_oa/tools/iconfont/svg/close.svg +1 -0
  117. package/templates/template_oa/tools/iconfont/svg/down.svg +1 -0
  118. package/templates/template_oa/tools/iconfont/svg/image.svg +1 -0
  119. package/templates/template_oa/tools/iconfont/svg/play.svg +1 -0
  120. package/templates/template_oa/tools/iconfont/svg/refresh.svg +1 -0
  121. package/templates/template_oa/tools/iconfont/svg/warn.svg +1 -0
  122. package/templates/template_oa/tools/iconfont/templates/_icons.css +26 -0
  123. package/templates/template_oa/tools/iconfont/templates/_icons.less +29 -0
  124. package/templates/template_oa/tools/iconfont/templates/index.html +56 -0
  125. package/templates/template_oa/tools/tinypng/.DS_Store +0 -0
  126. package/templates/template_oa/tools/tinypng/img/.DS_Store +0 -0
  127. package/templates/template_oa/tools/tinypng/package.json +11 -0
  128. package/templates/template_oa/tools/tinypng/run.sh +15 -0
  129. package/templates/template_oa/versionPublish.sh +27 -0
  130. package/templates/template_oa/webpack.api.js +62 -0
  131. package/templates/template_offcial/.gitignore +6 -0
  132. package/templates/template_offcial/build.sh +2 -0
  133. package/templates/template_offcial/cli.config.js +25 -0
  134. package/templates/template_offcial/dev.sh +89 -0
  135. package/templates/template_offcial/frontend_build.sh +83 -0
  136. package/templates/template_offcial/init/prepare-commit-msg +5 -0
  137. package/templates/template_offcial/init.sh +33 -0
  138. package/templates/template_offcial/jsconfig.json +10 -0
  139. package/templates/template_offcial/package.json +23 -0
  140. package/templates/template_offcial/public/404.html +26 -0
  141. package/templates/template_offcial/public/favicon.ico +0 -0
  142. package/templates/template_offcial/public/favicon.png +0 -0
  143. package/templates/template_offcial/public/index.html +52 -0
  144. package/templates/template_offcial/public/src/_antd.less +4 -0
  145. package/templates/template_offcial/public/src/_reset.less +130 -0
  146. package/templates/template_offcial/public/src/_variable.less +78 -0
  147. package/templates/template_offcial/public/src/assets/iconfont/iconfont.eot +0 -0
  148. package/templates/template_offcial/public/src/assets/iconfont/iconfont.less +57 -0
  149. package/templates/template_offcial/public/src/assets/iconfont/iconfont.svg +36 -0
  150. package/templates/template_offcial/public/src/assets/iconfont/iconfont.ttf +0 -0
  151. package/templates/template_offcial/public/src/assets/iconfont/iconfont.woff +0 -0
  152. package/templates/template_offcial/public/src/assets/iconfont/iconfont.woff2 +0 -0
  153. package/templates/template_offcial/public/src/assets/images/avatar.png +0 -0
  154. package/templates/template_offcial/public/src/assets/images/loading.svg +40 -0
  155. package/templates/template_offcial/public/src/components/Alert/index.jsx +0 -0
  156. package/templates/template_offcial/public/src/components/Alert/index.less +0 -0
  157. package/templates/template_offcial/public/src/components/Footer/index.jsx +32 -0
  158. package/templates/template_offcial/public/src/components/Footer/index.less +8 -0
  159. package/templates/template_offcial/public/src/components/Header/index.jsx +68 -0
  160. package/templates/template_offcial/public/src/components/Header/index.less +76 -0
  161. package/templates/template_offcial/public/src/components/IconFont/index.jsx +10 -0
  162. package/templates/template_offcial/public/src/components/IconFont/index.less +5 -0
  163. package/templates/template_offcial/public/src/components/Layout/Provider/index.jsx +12 -0
  164. package/templates/template_offcial/public/src/components/Layout/index.jsx +20 -0
  165. package/templates/template_offcial/public/src/components/Layout/index.less +20 -0
  166. package/templates/template_offcial/public/src/components/Link/index.jsx +24 -0
  167. package/templates/template_offcial/public/src/components/Link/index.less +11 -0
  168. package/templates/template_offcial/public/src/components/Page/PageLoading/index.jsx +30 -0
  169. package/templates/template_offcial/public/src/components/Page/PageLoading/index.less +29 -0
  170. package/templates/template_offcial/public/src/components/Popup/index.jsx +22 -0
  171. package/templates/template_offcial/public/src/components/Popup/index.less +18 -0
  172. package/templates/template_offcial/public/src/components/Toast/index.jsx +60 -0
  173. package/templates/template_offcial/public/src/components/Toast/index.less +43 -0
  174. package/templates/template_offcial/public/src/hooks/index.jsx +12 -0
  175. package/templates/template_offcial/public/src/hooks/useImageLoader.jsx +27 -0
  176. package/templates/template_offcial/public/src/hooks/useInToView.jsx +55 -0
  177. package/templates/template_offcial/public/src/hooks/usePreload.jsx +66 -0
  178. package/templates/template_offcial/public/src/hooks/useScroll.jsx +66 -0
  179. package/templates/template_offcial/public/src/index.jsx +50 -0
  180. package/templates/template_offcial/public/src/mock/index.js +63 -0
  181. package/templates/template_offcial/public/src/mock/user.js +70 -0
  182. package/templates/template_offcial/public/src/mock/utils.js +33 -0
  183. package/templates/template_offcial/public/src/pages/index.jsx +23 -0
  184. package/templates/template_offcial/public/src/pages/index.less +0 -0
  185. package/templates/template_offcial/public/src/pages/mobile/index.jsx +11 -0
  186. package/templates/template_offcial/public/src/pages/mobile/index.less +0 -0
  187. package/templates/template_offcial/public/src/pages/pc/index.jsx +45 -0
  188. package/templates/template_offcial/public/src/pages/pc/index.less +42 -0
  189. package/templates/template_offcial/public/src/provider/app.jsx +26 -0
  190. package/templates/template_offcial/public/src/route.jsx +26 -0
  191. package/templates/template_offcial/public/src/services/index.js +182 -0
  192. package/templates/template_offcial/public/src/services/user.js +26 -0
  193. package/templates/template_offcial/public/src/utils/index.js +109 -0
  194. package/templates/template_offcial/public/static/about.html +1 -0
  195. package/templates/template_offcial/readme.md +59 -0
  196. package/templates/template_offcial/report.sh +68 -0
  197. package/templates/template_offcial/tools/iconfont/gulpfile.js +70 -0
  198. package/templates/template_offcial/tools/iconfont/package.json +20 -0
  199. package/templates/template_offcial/tools/iconfont/run.sh +39 -0
  200. package/templates/template_offcial/tools/iconfont/svg/arrowBack.svg +1 -0
  201. package/templates/template_offcial/tools/iconfont/svg/check.svg +1 -0
  202. package/templates/template_offcial/tools/iconfont/svg/close.svg +1 -0
  203. package/templates/template_offcial/tools/iconfont/svg/down.svg +1 -0
  204. package/templates/template_offcial/tools/iconfont/svg/image.svg +1 -0
  205. package/templates/template_offcial/tools/iconfont/svg/play.svg +1 -0
  206. package/templates/template_offcial/tools/iconfont/svg/refresh.svg +1 -0
  207. package/templates/template_offcial/tools/iconfont/svg/warn.svg +1 -0
  208. package/templates/template_offcial/tools/iconfont/templates/_icons.css +26 -0
  209. package/templates/template_offcial/tools/iconfont/templates/_icons.less +29 -0
  210. package/templates/template_offcial/tools/iconfont/templates/index.html +56 -0
  211. package/templates/template_offcial/tools/tinypng/package.json +11 -0
  212. package/templates/template_offcial/tools/tinypng/run.sh +15 -0
  213. package/templates/template_offcial/versionPublish.sh +27 -0
  214. package/templates/template_offcial/webpack.api.js +36 -0
@@ -0,0 +1,40 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="margin: auto; background: none; display: block; shape-rendering: auto;" width="200px" height="200px" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid">
3
+ <g transform="rotate(0 50 50)">
4
+ <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#94908d">
5
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.8888888888888888s" repeatCount="indefinite"></animate>
6
+ </rect>
7
+ </g><g transform="rotate(40 50 50)">
8
+ <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#94908d">
9
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.7777777777777778s" repeatCount="indefinite"></animate>
10
+ </rect>
11
+ </g><g transform="rotate(80 50 50)">
12
+ <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#94908d">
13
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.6666666666666666s" repeatCount="indefinite"></animate>
14
+ </rect>
15
+ </g><g transform="rotate(120 50 50)">
16
+ <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#94908d">
17
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.5555555555555556s" repeatCount="indefinite"></animate>
18
+ </rect>
19
+ </g><g transform="rotate(160 50 50)">
20
+ <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#94908d">
21
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.4444444444444444s" repeatCount="indefinite"></animate>
22
+ </rect>
23
+ </g><g transform="rotate(200 50 50)">
24
+ <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#94908d">
25
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.3333333333333333s" repeatCount="indefinite"></animate>
26
+ </rect>
27
+ </g><g transform="rotate(240 50 50)">
28
+ <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#94908d">
29
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.2222222222222222s" repeatCount="indefinite"></animate>
30
+ </rect>
31
+ </g><g transform="rotate(280 50 50)">
32
+ <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#94908d">
33
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.1111111111111111s" repeatCount="indefinite"></animate>
34
+ </rect>
35
+ </g><g transform="rotate(320 50 50)">
36
+ <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#94908d">
37
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="0s" repeatCount="indefinite"></animate>
38
+ </rect>
39
+ </g>
40
+ <!-- [ldio] generated by https://loading.io/ --></svg>
@@ -0,0 +1,32 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import styles from './index.less';
3
+ import { isMobile } from '@/utils';
4
+
5
+
6
+ const Footer = (props) => {
7
+ const {name='footer',defaultHeight='100%'}=props;
8
+ const [url, setUrl] = useState('');
9
+ const [height,setHeight] = useState(defaultHeight)
10
+ useEffect(() => {
11
+ window.addEventListener('message',(e)=>{
12
+ if(e?.data?.msg==='resize'){
13
+ if(e.data.id==='footer'){
14
+ setHeight(e.data.height+2+'px');
15
+ }
16
+ }
17
+ })
18
+
19
+ if(isMobile()){
20
+ setUrl(`${MICRO_FRONT}/offcial-footer/mobileFooter.html`);
21
+ return;
22
+ }
23
+ setUrl(`${MICRO_FRONT}/offcial-footer/pcFooter.html`)
24
+ }, [])
25
+ return (
26
+ <div className={styles.footer} style={{width:'100%',height:height}}>
27
+ {url&&<iframe name={name} src={url} ></iframe>}
28
+ </div>
29
+ )
30
+ }
31
+
32
+ export default Footer;
@@ -0,0 +1,8 @@
1
+ .footer {
2
+ width: 100%;
3
+ overflow: hidden;
4
+ iframe {
5
+ width: 100%;
6
+ height: 100%;
7
+ }
8
+ }
@@ -0,0 +1,68 @@
1
+ import React, { useEffect, useRef, useState } from 'react';
2
+ import useScroll from '@/hooks/useScroll';
3
+ import styles from './index.less';
4
+
5
+ const Header = () => {
6
+ const scroll = useScroll();
7
+ const menu = [
8
+ { label: '模块1', type: 'block1' },
9
+ { label: '模块2', type: 'block2' },
10
+ { label: '模块3', type: 'block3' },
11
+ { label: '模块4', type: 'block4' },
12
+ ]
13
+ const [activeMenu,setActiveMenu]= useState('block1');
14
+ const refSetActiveMenu = useRef();
15
+ const refScroll = useRef();
16
+
17
+ refScroll.current=scroll;
18
+ refSetActiveMenu.current=setActiveMenu;
19
+
20
+ const onClick = (type) => {
21
+ let target=document.querySelector(`#${type}`);
22
+ target.scrollIntoView({behavior:'smooth',block:'center'});
23
+ }
24
+ useEffect(()=>{
25
+ let menusDom=[];
26
+ menu.forEach((item,idx)=>{
27
+ let dom= document.querySelector(`#${item.type}`);
28
+ menusDom.push(dom);
29
+ });
30
+
31
+ scroll.addEventListener('scroll',(top)=>{
32
+ if(top==0){
33
+ refSetActiveMenu.current(menu[0].type);
34
+ return;
35
+ }
36
+ for(let i=menusDom.length-1;i>0;i--){
37
+ if( menusDom[i] ){
38
+ let currentTop= menusDom[i].offsetTop;
39
+ if(top+refScroll.current.height*0.6 >= currentTop){
40
+ refSetActiveMenu.current(menu[i].type);
41
+ return;
42
+ }
43
+ }
44
+ }
45
+ refSetActiveMenu.current(menu[0].type);
46
+
47
+ })
48
+
49
+ },[])
50
+ return (
51
+ <section className={`${styles.container} ${scroll.isScroll? styles.white : ''}`}>
52
+ <section className={styles.warp}>
53
+ <section className={styles.logo}>
54
+ Logo
55
+ </section>
56
+ <section className={styles.menu}>
57
+ {
58
+ menu.map(i => {
59
+ return <div data-active={activeMenu==i.type} onClick={() => onClick(i.type)} key={i.label}>{i.label}</div>
60
+ })
61
+ }
62
+ </section>
63
+ </section>
64
+ </section>
65
+ )
66
+ }
67
+
68
+ export default Header;
@@ -0,0 +1,76 @@
1
+ @import '~@/_variable.less';
2
+
3
+ .container {
4
+ width: 100%;
5
+ height: var(--height-header);
6
+ display: flex;
7
+ position: fixed;
8
+ top: 0;
9
+ z-index: var(--z-top-menu);
10
+ justify-content: center;
11
+ align-items: center;
12
+ background-color: #fff;
13
+ border-bottom: 1px solid #eee;
14
+ .warp{
15
+ display: flex;
16
+ justify-content: space-between;
17
+ max-width: var(--body-max-width);
18
+ width:100%;
19
+ height: var(--height-header);
20
+
21
+ }
22
+
23
+ .logo{
24
+ display: flex;
25
+ align-items: center;
26
+ width:174px;
27
+ height:22px;
28
+ cursor: pointer;
29
+ margin-top: 27px;
30
+ border:1px solid #ccc;
31
+ }
32
+
33
+ .menu {
34
+ font-size: 20px;
35
+ color: #ab8d71;
36
+ display: flex;
37
+ align-items: center;
38
+ justify-content: flex-end;
39
+ flex:1;
40
+ min-width: 500px;
41
+
42
+ >div {
43
+ cursor: pointer;
44
+ transition: color 0.3s;
45
+ &[data-active='true']{
46
+ color:red;
47
+ }
48
+ &:hover {
49
+ font-weight: bold;
50
+ }
51
+ &:not(:last-child) {
52
+ margin-right: 48px;
53
+ }
54
+ }
55
+ }
56
+
57
+ &.white {
58
+ backdrop-filter: blur(4px);
59
+ background-color: rgba(255,255,255,.5);
60
+ box-shadow: 0 0 10px rgba(200, 200, 200, 0.5);
61
+ .menu {
62
+ color: #565656;
63
+ }
64
+ border-color: #ecb9b9;
65
+ }
66
+ }
67
+ @supports (position: sticky) {
68
+ .container{
69
+ position: sticky;
70
+ }
71
+ }
72
+
73
+ .container,
74
+ .menu {
75
+ transition: all 0.3s;
76
+ }
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import styles from'./index.less';
3
+
4
+ const IconFont=(props)=>{
5
+ const {icon,className,...others} = props;
6
+ return (
7
+ <span {...others} className={`iconfont icon-${icon} ${styles.iconBox} ${className||''}`} ></span>
8
+ )
9
+ }
10
+ export default IconFont;
@@ -0,0 +1,5 @@
1
+
2
+
3
+ .iconBox{
4
+ font-size:inherit;
5
+ }
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import {Outlet} from 'react-router-dom';
3
+ import ProviderApp from '@/provider/app';
4
+
5
+ const LayoutProvider=(props)=>{
6
+ return (
7
+ <ProviderApp.Provider>
8
+ <Outlet />
9
+ </ProviderApp.Provider>
10
+ )
11
+ }
12
+ export default LayoutProvider;
@@ -0,0 +1,20 @@
1
+ import React, { useEffect } from 'react';
2
+ import ProviderApp from '@/provider/app';
3
+ import {Outlet} from 'react-router-dom';
4
+
5
+ import styles from './index.less';
6
+
7
+ // 站点最基础的layout,用于控制一些全局环境变量
8
+ const Layout = (props) => {
9
+ return (
10
+ <ProviderApp.Provider>
11
+ <section id="appLayout" className={styles.layout} >
12
+ <Outlet />
13
+ </section>
14
+ </ProviderApp.Provider>
15
+ );
16
+ };
17
+
18
+
19
+
20
+ export { Layout };
@@ -0,0 +1,20 @@
1
+ @import '~@/_variable.less';
2
+
3
+ .layout {
4
+ width: 100%;
5
+ height:100%;
6
+ left:0;
7
+ top:0;
8
+ position: absolute;
9
+ margin: 0 auto;
10
+ z-index:0;
11
+ background:white;
12
+ display: flex;
13
+ flex-direction: column;
14
+ align-items: center;
15
+ overflow:auto;
16
+ }
17
+
18
+
19
+
20
+
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import { openLink,jumpUrl } from '@/utils';
3
+ import styles from './index.less';
4
+
5
+ const Link=(props)=>{
6
+ const {children,className='',onClick,href='',target=''} = props;
7
+
8
+ const onLink=()=>{
9
+ if(href){
10
+ if(target=='_blank'){
11
+ openLink(href);
12
+ // window.open(href);
13
+ }else{
14
+ jumpUrl(href);
15
+ }
16
+ return;
17
+ }
18
+ if(onClick)onClick();
19
+ }
20
+ return (
21
+ <span onClick={onLink} className={`${styles.linkWrap} ${className}`}>{children}</span>
22
+ )
23
+ }
24
+ export default React.memo(Link);
@@ -0,0 +1,11 @@
1
+ @import '~@/_variable.less';
2
+
3
+
4
+ .linkWrap{
5
+ color: var(--color-primary);
6
+ font-size: 14px;
7
+ &:hover{
8
+ color: var(--color-primary-hover);
9
+ cursor: pointer;
10
+ }
11
+ }
@@ -0,0 +1,30 @@
1
+ import React,{useEffect, useState} from 'react';
2
+ import ReactDOM from 'react-dom';
3
+ import CSS from './index.less';
4
+ import Popup from '@/components/Popup';
5
+ import imgLoading from '@/assets/images/loading.svg';
6
+
7
+ const PageLoading = (props) => {
8
+ const {visible=true} = props;
9
+ if(!visible){
10
+ return '';
11
+ }
12
+ return (
13
+ <div className={CSS.wrap } >
14
+ <div className={CSS.box} data-show={visible}>
15
+ <img src={imgLoading} />
16
+ </div>
17
+ </div>
18
+ );
19
+ };
20
+
21
+ export const ShowPageLoading=(props={canTouch:false})=>{
22
+ let popup = Popup(()=>{},{cantouch:props.canTouch});
23
+ ReactDOM.render(
24
+ <PageLoading visible={true} />,
25
+ popup.dom
26
+ );
27
+ return popup.destory;
28
+ }
29
+
30
+ export default React.memo(PageLoading);
@@ -0,0 +1,29 @@
1
+ .wrap {
2
+ position: fixed;
3
+ width: 100%;
4
+ height: 100%;
5
+ left: 0;
6
+ top: 0;
7
+ z-index: 99;
8
+ display: flex;
9
+ justify-content: center;
10
+ align-items: center;
11
+ }
12
+
13
+ .box {
14
+
15
+ width: 80px;
16
+ height: 80px;
17
+ background: rgba(0,0,0,.3);
18
+ border-radius: 12px;
19
+ display: flex;
20
+ justify-content: center;
21
+ align-items: center;
22
+ img{
23
+ display: block;
24
+ width:80%;
25
+ }
26
+ &[data-show=false]{
27
+ opacity: 0;
28
+ }
29
+ }
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import ReactDOM from 'react-dom';
3
+ import styles from './index.less';
4
+ styles;
5
+
6
+ const Popup = (reslove,options) => {
7
+ let rootDom = document.createElement('div');
8
+ rootDom.className='popup-box';
9
+ if(options&&options.cantouch)rootDom.setAttribute('data-can-touch','1');
10
+ if(options&&options.transparent)rootDom.setAttribute('data-transparent','1');
11
+
12
+ let destory = (result) => {
13
+ ReactDOM.unmountComponentAtNode(rootDom);
14
+ rootDom.parentNode.removeChild(rootDom);
15
+ if (reslove) reslove(result);
16
+ };
17
+ document.body.appendChild(rootDom);
18
+ return { dom: rootDom, destory };
19
+ };
20
+
21
+
22
+ export default Popup;
@@ -0,0 +1,18 @@
1
+
2
+
3
+ :global{
4
+ .popup-box{
5
+ position: absolute;
6
+ left:0;
7
+ top:0;
8
+ width:100%;
9
+ height:100%;
10
+ z-index: 99;
11
+ &[data-transparent]{
12
+ height:auto;
13
+ }
14
+ &[data-can-touch]{
15
+ pointer-events: none;
16
+ }
17
+ }
18
+ }
@@ -0,0 +1,60 @@
1
+ import React,{useEffect} from 'react';
2
+ import ReactDOM from 'react-dom';
3
+ import styles from './index.less';
4
+ import Popup from '@/components/Popup/index.jsx';
5
+
6
+ const toastList=[];
7
+ const runNext=()=>{
8
+ let props = toastList[0];
9
+ if(props){
10
+ const {message,delay,resolve,position}=props;
11
+ let popup = Popup(resolve,{cantouch:true});
12
+ ReactDOM.render(
13
+ <Toast destory={popup.destory} message={message} delay={delay} position={position}/>,
14
+ popup.dom
15
+ );
16
+ }
17
+ }
18
+
19
+ const Toast=props=>{
20
+ const {
21
+ message,
22
+ delay=1000*2,
23
+ destory,
24
+ position='top'
25
+ }=props;
26
+ useEffect(()=>{
27
+ setTimeout(()=>{
28
+ destory();
29
+ toastList.shift();
30
+ runNext();
31
+ },delay);
32
+ },[])
33
+ const ANITYPE={
34
+ 'center':'animate__slideInDown',
35
+ 'top':'animate__slideInDown',
36
+ 'bottom':'animate__slideInUp'
37
+ }
38
+ return (
39
+ <section className={styles.wrap} data-position={position}>
40
+ <div className={styles.content+ ` ${ANITYPE[position]} animate__animated animate__fast`} dangerouslySetInnerHTML={{ __html:message }}>
41
+ </div>
42
+ </section>
43
+ )
44
+ }
45
+
46
+
47
+ const ShowToast=props=>{
48
+ if(typeof props === 'string'){
49
+ props = {message:props}
50
+ }
51
+ return new Promise((resolve) => {
52
+ props.resolve = resolve;
53
+ toastList.push(props);
54
+ if(toastList.length===1){
55
+ runNext();
56
+ }
57
+ });
58
+ }
59
+
60
+ export default ShowToast;
@@ -0,0 +1,43 @@
1
+ @import '~@/_variable.less';
2
+
3
+ .wrap{
4
+ position: fixed;
5
+ left:0;
6
+ top:0;
7
+ width:100%;
8
+ height:100%;
9
+ pointer-events: none;
10
+ display: flex;
11
+ justify-content: center;
12
+ align-items: center;
13
+ flex-direction: column;
14
+ z-index:var(--z-toast);
15
+ &[data-position=top]{
16
+ justify-content: flex-start;
17
+ padding-top:80px;
18
+ }
19
+ &[data-position=bottom]{
20
+ justify-content: flex-end;
21
+ padding-bottom:80px;
22
+ }
23
+ .content{
24
+ min-height:30px;
25
+ min-width:60px;
26
+
27
+ background: rgba(0,0,0,.8);
28
+ opacity:.8;
29
+ border-radius: var(--radius-default);
30
+ padding:var(--padding-default);
31
+
32
+ display: flex;
33
+ flex-direction: column;
34
+ justify-content: center;
35
+ align-items: center;
36
+
37
+ font-size: 14px;
38
+ color: #FFFFFF;
39
+ text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.24);
40
+
41
+
42
+ }
43
+ }
@@ -0,0 +1,12 @@
1
+
2
+
3
+ import useImageLoader from './useImageLoader';
4
+ import usePreload from './usePreload';
5
+ import {usePagination,usePaginationWithForm} from 'kn-hooks';
6
+
7
+ export {
8
+ usePaginationWithForm,
9
+ usePagination,
10
+ useImageLoader,
11
+ usePreload,
12
+ }
@@ -0,0 +1,27 @@
1
+ import React, { useEffect,useState,useMemo } from 'react';
2
+
3
+
4
+
5
+ const useImageLoader=(img_src)=>{
6
+ const [src,setSrc] = useState('');
7
+ useEffect(() => {
8
+ if(img_src===src)return;
9
+ if(!img_src)return;
10
+ let img = new Image();
11
+ img.onload = () => {
12
+ setSrc(img_src);
13
+ };
14
+ img.onerror = () => {
15
+ setSrc('');
16
+ console.log(`图片加载失败:${img_src}`)
17
+ };
18
+ img.src = img_src;
19
+ }, [img_src]);
20
+
21
+ const actions=useMemo(()=>{
22
+ return src;
23
+ },[src]);
24
+ return actions;
25
+ }
26
+
27
+ export default useImageLoader;
@@ -0,0 +1,55 @@
1
+ import React, { useEffect,useState,useMemo,useRef,useCallback } from 'react';
2
+
3
+
4
+ const useInToView=(props)=>{
5
+ const [visible,setVisible]= useState(false);
6
+ const [visibled,setVisibled]= useState(false);
7
+ const refDom= useRef();
8
+ const refObserver=useRef();
9
+
10
+ const destory=()=>{
11
+ if(refObserver.current){
12
+ refObserver.current=disconnect();
13
+ refObserver.current=null;
14
+ }
15
+ }
16
+
17
+ useEffect(()=>{
18
+ return ()=>{
19
+ destory();
20
+ }
21
+ },[refObserver]);
22
+
23
+ const watch=(dom)=>{
24
+ let observe;
25
+ destory();
26
+ setDom(dom);
27
+ if(!refDom.current)return;
28
+ observe = new IntersectionObserver((entries) => {
29
+ if (entries[0].intersectionRatio <= 0) {
30
+ setVisible(false);
31
+ return;
32
+ }
33
+ setVisible(true);
34
+ setVisibled(true);
35
+ });
36
+ observe.observe(refDom.current);
37
+ refObserver.current=observe;
38
+ }
39
+ const setDom=(dom)=>{
40
+ if(typeof dom == 'string'){
41
+ refDom.current = document.querySelector(dom);
42
+ if(!refDom.current)return;
43
+ }else{
44
+ refDom.current= dom;
45
+ }
46
+ }
47
+
48
+ return {
49
+ visible,
50
+ visibled,
51
+ watch
52
+ }
53
+ }
54
+
55
+ export default useInToView;