kn-cli 1.0.130 → 1.0.133

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 (210) hide show
  1. package/build/vite.config.js +1 -1
  2. package/build/webpack.config.js +2 -1
  3. package/package.json +2 -1
  4. package/src/create.js +2 -0
  5. package/templates/template_admin_antd5/.vscode/settings.json +28 -0
  6. package/templates/template_admin_antd5/build.sh +8 -0
  7. package/templates/template_admin_antd5/cli.config.js +35 -0
  8. package/templates/template_admin_antd5/dev.sh +33 -0
  9. package/templates/template_admin_antd5/frontend_build.sh +48 -0
  10. package/templates/template_admin_antd5/init/prepare-commit-msg +5 -0
  11. package/templates/template_admin_antd5/init.sh +24 -0
  12. package/templates/template_admin_antd5/jsconfig.json +17 -0
  13. package/templates/template_admin_antd5/package.json +27 -0
  14. package/templates/template_admin_antd5/public/404.html +26 -0
  15. package/templates/template_admin_antd5/public/favicon.png +0 -0
  16. package/templates/template_admin_antd5/public/index.html +48 -0
  17. package/templates/template_admin_antd5/public/src/_antd.less +37 -0
  18. package/templates/template_admin_antd5/public/src/_mixin.module.less +79 -0
  19. package/templates/template_admin_antd5/public/src/_reset.module.less +134 -0
  20. package/templates/template_admin_antd5/public/src/_variable.module.less +85 -0
  21. package/templates/template_admin_antd5/public/src/assets/iconfont/iconfont.eot +0 -0
  22. package/templates/template_admin_antd5/public/src/assets/iconfont/iconfont.module.less +109 -0
  23. package/templates/template_admin_antd5/public/src/assets/iconfont/iconfont.svg +75 -0
  24. package/templates/template_admin_antd5/public/src/assets/iconfont/iconfont.ttf +0 -0
  25. package/templates/template_admin_antd5/public/src/assets/iconfont/iconfont.woff +0 -0
  26. package/templates/template_admin_antd5/public/src/assets/iconfont/iconfont.woff2 +0 -0
  27. package/templates/template_admin_antd5/public/src/assets/images/arrow.png +0 -0
  28. package/templates/template_admin_antd5/public/src/assets/images/avatar.png +0 -0
  29. package/templates/template_admin_antd5/public/src/assets/images/icon-notice.png +0 -0
  30. package/templates/template_admin_antd5/public/src/assets/images/icon-user.png +0 -0
  31. package/templates/template_admin_antd5/public/src/assets/images/loadFail.png +0 -0
  32. package/templates/template_admin_antd5/public/src/assets/images/loading.svg +40 -0
  33. package/templates/template_admin_antd5/public/src/assets/images/login/bg.png +0 -0
  34. package/templates/template_admin_antd5/public/src/assets/images/login/logo.png +0 -0
  35. package/templates/template_admin_antd5/public/src/assets/images/login/slogan.png +0 -0
  36. package/templates/template_admin_antd5/public/src/assets/images/nav/icon-dep-active.png +0 -0
  37. package/templates/template_admin_antd5/public/src/assets/images/nav/icon-dep.png +0 -0
  38. package/templates/template_admin_antd5/public/src/assets/images/nav/icon-log-active.png +0 -0
  39. package/templates/template_admin_antd5/public/src/assets/images/nav/icon-log.png +0 -0
  40. package/templates/template_admin_antd5/public/src/assets/images/nav/icon-loginlog-active.png +0 -0
  41. package/templates/template_admin_antd5/public/src/assets/images/nav/icon-loginlog.png +0 -0
  42. package/templates/template_admin_antd5/public/src/assets/images/nav/icon-role-active.png +0 -0
  43. package/templates/template_admin_antd5/public/src/assets/images/nav/icon-role.png +0 -0
  44. package/templates/template_admin_antd5/public/src/assets/images/nav/icon-user-active.png +0 -0
  45. package/templates/template_admin_antd5/public/src/assets/images/nav/icon-user.png +0 -0
  46. package/templates/template_admin_antd5/public/src/assets/images/nav/nav-toggle.png +0 -0
  47. package/templates/template_admin_antd5/public/src/assets/images/nav/slogan.png +0 -0
  48. package/templates/template_admin_antd5/public/src/assets/images/noData.png +0 -0
  49. package/templates/template_admin_antd5/public/src/assets/images/noSelect.png +0 -0
  50. package/templates/template_admin_antd5/public/src/assets/images/permission/403.png +0 -0
  51. package/templates/template_admin_antd5/public/src/assets/images/permission/404.png +0 -0
  52. package/templates/template_admin_antd5/public/src/assets/images/permission/503.png +0 -0
  53. package/templates/template_admin_antd5/public/src/assets/images/play.png +0 -0
  54. package/templates/template_admin_antd5/public/src/components/_table/column.jsx +47 -0
  55. package/templates/template_admin_antd5/public/src/components/_table/column.module.less +12 -0
  56. package/templates/template_admin_antd5/public/src/components/_table/index.jsx +71 -0
  57. package/templates/template_admin_antd5/public/src/components/_table/index.module.less +15 -0
  58. package/templates/template_admin_antd5/public/src/components/antd/antProvider.jsx +21 -0
  59. package/templates/template_admin_antd5/public/src/components/antd/index.jsx +146 -0
  60. package/templates/template_admin_antd5/public/src/components/antd/select/index.jsx +296 -0
  61. package/templates/template_admin_antd5/public/src/components/antd/select/index.module.less +21 -0
  62. package/templates/template_admin_antd5/public/src/components/antd/theme.js +173 -0
  63. package/templates/template_admin_antd5/public/src/components/antd/tooltip/detail/index.jsx +70 -0
  64. package/templates/template_admin_antd5/public/src/components/antd/tooltip/detail/index.module.less +12 -0
  65. package/templates/template_admin_antd5/public/src/components/antd/tooltip/index.jsx +69 -0
  66. package/templates/template_admin_antd5/public/src/components/antd/tooltip/index.module.less +28 -0
  67. package/templates/template_admin_antd5/public/src/components/auth/index.jsx +123 -0
  68. package/templates/template_admin_antd5/public/src/components/auth/index.module.less +7 -0
  69. package/templates/template_admin_antd5/public/src/components/auth/navCheck.jsx +27 -0
  70. package/templates/template_admin_antd5/public/src/components/badge/index.jsx +47 -0
  71. package/templates/template_admin_antd5/public/src/components/badge/index.module.less +44 -0
  72. package/templates/template_admin_antd5/public/src/components/button/index.jsx +17 -0
  73. package/templates/template_admin_antd5/public/src/components/debug/index.jsx +28 -0
  74. package/templates/template_admin_antd5/public/src/components/debug/index.module.less +10 -0
  75. package/templates/template_admin_antd5/public/src/components/empty/index.jsx +28 -0
  76. package/templates/template_admin_antd5/public/src/components/empty/index.module.less +20 -0
  77. package/templates/template_admin_antd5/public/src/components/error/index.jsx +39 -0
  78. package/templates/template_admin_antd5/public/src/components/icon/index.jsx +128 -0
  79. package/templates/template_admin_antd5/public/src/components/icon/playVideo/index.jsx +21 -0
  80. package/templates/template_admin_antd5/public/src/components/icon/playVideo/index.module.less +16 -0
  81. package/templates/template_admin_antd5/public/src/components/iconFont/index.jsx +20 -0
  82. package/templates/template_admin_antd5/public/src/components/iconFont/index.module.less +5 -0
  83. package/templates/template_admin_antd5/public/src/components/image/index.jsx +73 -0
  84. package/templates/template_admin_antd5/public/src/components/image/index.module.less +117 -0
  85. package/templates/template_admin_antd5/public/src/components/image/preview.jsx +85 -0
  86. package/templates/template_admin_antd5/public/src/components/layout/basic/index.jsx +49 -0
  87. package/templates/template_admin_antd5/public/src/components/layout/basic/index.module.less +76 -0
  88. package/templates/template_admin_antd5/public/src/components/layout/index.jsx +39 -0
  89. package/templates/template_admin_antd5/public/src/components/layout/index.module.less +63 -0
  90. package/templates/template_admin_antd5/public/src/components/layout/provider/index.jsx +32 -0
  91. package/templates/template_admin_antd5/public/src/components/leftMenu/index.jsx +106 -0
  92. package/templates/template_admin_antd5/public/src/components/leftMenu/index.module.less +42 -0
  93. package/templates/template_admin_antd5/public/src/components/link/index.jsx +39 -0
  94. package/templates/template_admin_antd5/public/src/components/link/index.module.less +11 -0
  95. package/templates/template_admin_antd5/public/src/components/menuIcon/index.jsx +33 -0
  96. package/templates/template_admin_antd5/public/src/components/menuIcon/index.module.less +49 -0
  97. package/templates/template_admin_antd5/public/src/components/page/pageLoading/index.jsx +51 -0
  98. package/templates/template_admin_antd5/public/src/components/page/pageLoading/index.module.less +29 -0
  99. package/templates/template_admin_antd5/public/src/components/popup/index.jsx +60 -0
  100. package/templates/template_admin_antd5/public/src/components/popup/index.module.less +18 -0
  101. package/templates/template_admin_antd5/public/src/components/react/index.jsx +13 -0
  102. package/templates/template_admin_antd5/public/src/components/resizeBox/index.jsx +144 -0
  103. package/templates/template_admin_antd5/public/src/components/resizeBox/index.module.css +90 -0
  104. package/templates/template_admin_antd5/public/src/components/select/defaultServicesSelect/index.jsx +182 -0
  105. package/templates/template_admin_antd5/public/src/components/select/dictSelect/index.jsx +84 -0
  106. package/templates/template_admin_antd5/public/src/components/select/index.jsx +7 -0
  107. package/templates/template_admin_antd5/public/src/components/select/useSelectList.jsx +217 -0
  108. package/templates/template_admin_antd5/public/src/components/table/aliTable/index.jsx +250 -0
  109. package/templates/template_admin_antd5/public/src/components/table/aliTable/index.module.less +105 -0
  110. package/templates/template_admin_antd5/public/src/components/table/column.jsx +128 -0
  111. package/templates/template_admin_antd5/public/src/components/table/column.module.less +50 -0
  112. package/templates/template_admin_antd5/public/src/components/table/imageTable/index.jsx +302 -0
  113. package/templates/template_admin_antd5/public/src/components/table/imageTable/index.module.less +196 -0
  114. package/templates/template_admin_antd5/public/src/components/table/imageTable/radio.jsx +15 -0
  115. package/templates/template_admin_antd5/public/src/components/table/imageTable/radio.module.less +18 -0
  116. package/templates/template_admin_antd5/public/src/components/table/index.jsx +475 -0
  117. package/templates/template_admin_antd5/public/src/components/table/index.module.less +133 -0
  118. package/templates/template_admin_antd5/public/src/components/text/index.jsx +98 -0
  119. package/templates/template_admin_antd5/public/src/components/text/index.module.less +13 -0
  120. package/templates/template_admin_antd5/public/src/components/toast/index.jsx +79 -0
  121. package/templates/template_admin_antd5/public/src/components/toast/index.module.less +43 -0
  122. package/templates/template_admin_antd5/public/src/components/topMenu/index.jsx +102 -0
  123. package/templates/template_admin_antd5/public/src/components/topMenu/index.module.less +89 -0
  124. package/templates/template_admin_antd5/public/src/components/topMenu/topBar/index.jsx +81 -0
  125. package/templates/template_admin_antd5/public/src/components/topMenu/topBar/index.module.less +97 -0
  126. package/templates/template_admin_antd5/public/src/components/video/index.jsx +96 -0
  127. package/templates/template_admin_antd5/public/src/components/video/index.module.less +132 -0
  128. package/templates/template_admin_antd5/public/src/components/video/preview.jsx +38 -0
  129. package/templates/template_admin_antd5/public/src/config.js +31 -0
  130. package/templates/template_admin_antd5/public/src/declarations.d.ts +1 -0
  131. package/templates/template_admin_antd5/public/src/dictionary/dictionary.js +289 -0
  132. package/templates/template_admin_antd5/public/src/dictionary/index.jsx +64 -0
  133. package/templates/template_admin_antd5/public/src/enum.js +41 -0
  134. package/templates/template_admin_antd5/public/src/hooks/index.jsx +29 -0
  135. package/templates/template_admin_antd5/public/src/hooks/useDebounceFn.jsx +33 -0
  136. package/templates/template_admin_antd5/public/src/hooks/useDelay.jsx +34 -0
  137. package/templates/template_admin_antd5/public/src/hooks/useEsc.jsx +98 -0
  138. package/templates/template_admin_antd5/public/src/hooks/useImageLoader.jsx +26 -0
  139. package/templates/template_admin_antd5/public/src/hooks/useInToView.jsx +58 -0
  140. package/templates/template_admin_antd5/public/src/hooks/useLoading.jsx +46 -0
  141. package/templates/template_admin_antd5/public/src/hooks/usePreload.jsx +67 -0
  142. package/templates/template_admin_antd5/public/src/hooks/useRouteMenu.jsx +263 -0
  143. package/templates/template_admin_antd5/public/src/hooks/useScrollTop.jsx +44 -0
  144. package/templates/template_admin_antd5/public/src/hooks/useSearch.jsx +163 -0
  145. package/templates/template_admin_antd5/public/src/hooks/useTableRowSelect.jsx +310 -0
  146. package/templates/template_admin_antd5/public/src/hooks/useThrottole.jsx +68 -0
  147. package/templates/template_admin_antd5/public/src/hooks/useTimer.jsx +42 -0
  148. package/templates/template_admin_antd5/public/src/hooks/useUpdate.jsx +16 -0
  149. package/templates/template_admin_antd5/public/src/hooks/useWatchServices.jsx +124 -0
  150. package/templates/template_admin_antd5/public/src/index.jsx +89 -0
  151. package/templates/template_admin_antd5/public/src/menuConfig/auth.jsx +92 -0
  152. package/templates/template_admin_antd5/public/src/menuConfig/dashboard.jsx +25 -0
  153. package/templates/template_admin_antd5/public/src/menuConfig/dna.jsx +76 -0
  154. package/templates/template_admin_antd5/public/src/menuConfig/index.jsx +17 -0
  155. package/templates/template_admin_antd5/public/src/mock/auth.js +33 -0
  156. package/templates/template_admin_antd5/public/src/mock/demo.js +122 -0
  157. package/templates/template_admin_antd5/public/src/mock/index.js +65 -0
  158. package/templates/template_admin_antd5/public/src/mock/utils.js +33 -0
  159. package/templates/template_admin_antd5/public/src/pages/antdComponents/index.jsx +142 -0
  160. package/templates/template_admin_antd5/public/src/pages/auth/user/create/index.jsx +47 -0
  161. package/templates/template_admin_antd5/public/src/pages/auth/user/create/index.module.less +6 -0
  162. package/templates/template_admin_antd5/public/src/pages/auth/user/dialog/index.jsx +96 -0
  163. package/templates/template_admin_antd5/public/src/pages/auth/user/index.jsx +214 -0
  164. package/templates/template_admin_antd5/public/src/pages/components/layout/index.jsx +75 -0
  165. package/templates/template_admin_antd5/public/src/pages/components/layout/index.module.less +78 -0
  166. package/templates/template_admin_antd5/public/src/pages/components/layout/titleBar/index.jsx +28 -0
  167. package/templates/template_admin_antd5/public/src/pages/components/layout/titleBar/index.module.less +44 -0
  168. package/templates/template_admin_antd5/public/src/pages/components/select/user.jsx +18 -0
  169. package/templates/template_admin_antd5/public/src/pages/demo/page1.jsx +21 -0
  170. package/templates/template_admin_antd5/public/src/pages/demo/page2.jsx +21 -0
  171. package/templates/template_admin_antd5/public/src/pages/demo/page3.jsx +21 -0
  172. package/templates/template_admin_antd5/public/src/pages/error/403.jsx +15 -0
  173. package/templates/template_admin_antd5/public/src/pages/error/404.jsx +15 -0
  174. package/templates/template_admin_antd5/public/src/pages/error/503.jsx +15 -0
  175. package/templates/template_admin_antd5/public/src/pages/error/permission.jsx +40 -0
  176. package/templates/template_admin_antd5/public/src/pages/error/permission.module.less +16 -0
  177. package/templates/template_admin_antd5/public/src/pages/home.jsx +90 -0
  178. package/templates/template_admin_antd5/public/src/pages/home.module.less +6 -0
  179. package/templates/template_admin_antd5/public/src/pages/login/index.jsx +113 -0
  180. package/templates/template_admin_antd5/public/src/pages/login/index.module.less +153 -0
  181. package/templates/template_admin_antd5/public/src/pages/pageTemplate.jsx +28 -0
  182. package/templates/template_admin_antd5/public/src/provider/app.jsx +201 -0
  183. package/templates/template_admin_antd5/public/src/provider/loading.jsx +47 -0
  184. package/templates/template_admin_antd5/public/src/provider/menu.jsx +161 -0
  185. package/templates/template_admin_antd5/public/src/provider/menu.module.less +35 -0
  186. package/templates/template_admin_antd5/public/src/route.jsx +127 -0
  187. package/templates/template_admin_antd5/public/src/services/demo.js +85 -0
  188. package/templates/template_admin_antd5/public/src/services/excel.js +43 -0
  189. package/templates/template_admin_antd5/public/src/services/http/index.js +155 -0
  190. package/templates/template_admin_antd5/public/src/services/index.js +126 -0
  191. package/templates/template_admin_antd5/public/src/services/interceptor/index.js +67 -0
  192. package/templates/template_admin_antd5/public/src/services/login.js +37 -0
  193. package/templates/template_admin_antd5/public/src/services/socket/index.jsx +99 -0
  194. package/templates/template_admin_antd5/public/src/services/token/index.js +41 -0
  195. package/templates/template_admin_antd5/public/src/type.js +67 -0
  196. package/templates/template_admin_antd5/public/src/utils/event.js +58 -0
  197. package/templates/template_admin_antd5/public/src/utils/format.js +135 -0
  198. package/templates/template_admin_antd5/public/src/utils/index.js +727 -0
  199. package/templates/template_admin_antd5/public/src/utils/menu.js +33 -0
  200. package/templates/template_admin_antd5/public/src/utils/rule.js +277 -0
  201. package/templates/template_admin_antd5/public/src/utils/storage.js +30 -0
  202. package/templates/template_admin_antd5/public/static/about.html +1 -0
  203. package/templates/template_admin_antd5/public/static/kssoLogin.html +22 -0
  204. package/templates/template_admin_antd5/readme.md +84 -0
  205. package/templates/template_admin_antd5/renamejstojsx.js +45 -0
  206. package/templates/template_admin_antd5/renameless.js +53 -0
  207. package/templates/template_admin_antd5/report.sh +25 -0
  208. package/templates/template_admin_antd5/shellUtil.sh +110 -0
  209. package/templates/template_admin_antd5/versionPublish.sh +16 -0
  210. package/templates/template_admin_antd5/webpack.api.js +105 -0
@@ -0,0 +1,79 @@
1
+ // @ts-ignore
2
+ import React,{useEffect} from 'react';
3
+ // @ts-ignore
4
+ import ReactDOM from 'react-dom';
5
+
6
+ // @ts-ignore
7
+ import Popup from '@/components/popup';
8
+
9
+ // @ts-ignore
10
+ import styles from './index.module.less';
11
+
12
+ const toastList=[];
13
+ const runNext=()=>{
14
+ let props = toastList[0];
15
+ if(props){
16
+ const {message,delay,resolve,position}=props;
17
+ let popup = Popup(resolve,{cantouch:true});
18
+ ReactDOM.render(
19
+ <Toast destory={popup.destory} message={message} delay={delay} position={position}/>,
20
+ popup.dom
21
+ );
22
+ }
23
+ }
24
+
25
+ const Toast=props=>{
26
+ const {
27
+ message,
28
+ delay=1000*2,
29
+ destory,
30
+ position='top'
31
+ }=props;
32
+ useEffect(()=>{
33
+ setTimeout(()=>{
34
+ destory();
35
+ toastList.shift();
36
+ runNext();
37
+ },delay);
38
+ },[])
39
+ const ANITYPE={
40
+ 'center':'animate__slideInDown',
41
+ 'top':'animate__slideInDown',
42
+ 'bottom':'animate__slideInUp'
43
+ }
44
+ return (
45
+ <section className={styles.wrap} data-position={position}>
46
+ <div className={styles.content+ ` ${ANITYPE[position]} animate__animated animate__fast`} dangerouslySetInnerHTML={{ __html:message }}>
47
+ </div>
48
+ </section>
49
+ )
50
+ }
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
+ */
59
+
60
+ /**
61
+ * 显示一个吐司信息
62
+ * @param {ToastOptions|string} [props] - 文案内容或一个配置参数
63
+ * @returns { Promise }
64
+ */
65
+ const ShowToast=props=>{
66
+ if(typeof props === 'string'){
67
+ props = {message:props}
68
+ }
69
+ return new Promise((resolve) => {
70
+ // @ts-ignore
71
+ props.resolve = resolve;
72
+ toastList.push(props);
73
+ if(toastList.length===1){
74
+ runNext();
75
+ }
76
+ });
77
+ }
78
+
79
+ export default ShowToast;
@@ -0,0 +1,43 @@
1
+ @import '~@/_variable.module.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,102 @@
1
+ // @ts-ignore
2
+ import React, { useState,useEffect } from 'react';
3
+ // @ts-ignore
4
+ import { useNavigate } from 'react-router-dom';
5
+
6
+ import ProviderMenu from '@/provider/menu';
7
+ // @ts-ignore
8
+ import imgSlogan from '@/assets/images/nav/slogan.png';
9
+
10
+ import TopBar from './topBar';
11
+ import {DEBUG_ENV} from '@/config';
12
+
13
+ // @ts-ignore
14
+ import styles from './index.module.less';
15
+
16
+ const TopSlogan=()=>{
17
+ const navigate = useNavigate();
18
+ const onHome= ()=>{
19
+ navigate('/')
20
+ }
21
+ return (
22
+ <div className={styles.TopMenuSlogan} onClick={onHome}>
23
+ <img src={imgSlogan} />
24
+ {
25
+ // @ts-ignore
26
+ DEBUG_ENV!='prod'?<span className={styles.version}>V{APP_VERSION}{DEBUG_ENV}</span>:<></>
27
+ }
28
+ </div>
29
+ )
30
+ }
31
+
32
+
33
+ const TopMenu=(props)=>{
34
+ const providerMenu = ProviderMenu.useContainer();
35
+
36
+ const [menus,setMenus]=useState([]);
37
+ const navigate = useNavigate();
38
+
39
+ const menuOpen= true;//app.nav.leftNavOpen;
40
+
41
+
42
+ // // 推出登录
43
+ // const onAvatarClick = (e)=>{
44
+ // if (e?.key === 'logout') {
45
+ // app.logout();
46
+ // }
47
+ // }
48
+
49
+ const onClickMenuItem=(menu,e)=>{
50
+ navigate(menu.url);
51
+ }
52
+ const reload= async ()=>{
53
+ providerMenu.reload();
54
+ }
55
+ useEffect(()=>{
56
+ setMenus(providerMenu.topMenu)
57
+ },[providerMenu.topMenu]);
58
+
59
+ useEffect(()=>{
60
+ reload();
61
+ },[])
62
+
63
+
64
+ // const getIcon=(iconName,active)=>{
65
+ // import(`@/assets/images/nav/${iconName}.png`).then(item=>{
66
+ // return item;
67
+ // })
68
+ // }
69
+ return (
70
+
71
+
72
+ <div className={styles.topMenu} data-open={menuOpen}>
73
+ <hgroup className={styles.leftGroup}>
74
+ <TopSlogan />
75
+ {
76
+ menus&&menus.length>1&&
77
+ menus.map((menu,idx)=>{
78
+ const {key,name:label,icon,msgCount}= menu;
79
+ const active = providerMenu.selectMenus.keys.includes(key);
80
+ return (
81
+ <div
82
+ key={key}
83
+ className={styles.menuItem}
84
+ data-checked={active}
85
+ onClick={onClickMenuItem.bind(this,menu)}
86
+ >
87
+ <span><a href={'/#'+menu.url}>{label}</a></span>
88
+ {/* 未读标记 */}
89
+ <div className={styles.messageWrap}>
90
+ {msgCount>0?<i className={styles.iconUnread}/>:''}
91
+ </div>
92
+ </div>
93
+ )
94
+ })
95
+ }
96
+ </hgroup>
97
+ <TopBar />
98
+ </div>
99
+ )
100
+ }
101
+
102
+ export default TopMenu;
@@ -0,0 +1,89 @@
1
+ @import '~@/_variable.module.less';
2
+ @import '~@/_mixin.module.less';
3
+
4
+ @menuWidth:70px;
5
+ @openMenuWidth:128px;
6
+
7
+ .TopMenuSlogan{
8
+ width: 152px;
9
+ height: 100%;
10
+ display: flex;
11
+ align-items: center;
12
+ cursor: pointer;
13
+ img{
14
+ width: 73px;
15
+ }
16
+ .version{
17
+ font-size: 12px;
18
+ font-weight:700;
19
+ color:white;
20
+ background-color: rgba(255,255,255,.16);
21
+ padding:2px 4px;
22
+ border-radius: 2px;
23
+ margin-left: 4px;
24
+ }
25
+ }
26
+
27
+ .topMenu{
28
+ padding:0 24px;
29
+ display: flex;
30
+ justify-content: space-between;
31
+ align-self: center;
32
+ height: 100%;
33
+ width: 100%;
34
+
35
+ .leftGroup{
36
+ display: flex;
37
+ height: 100%;
38
+ align-items: center;
39
+ }
40
+
41
+ .menuItem{
42
+ position: relative;
43
+ width: 74px;
44
+ height: 100%;
45
+
46
+ display: flex;
47
+ align-items: center;
48
+ justify-content:center;
49
+
50
+ cursor: pointer;
51
+
52
+ *{.no-select;}
53
+ font-size: 14px;
54
+ color:#fff;
55
+ background-color: transparent;
56
+ a,span{
57
+ font-weight: inherit;
58
+ font-size: inherit;
59
+ color:inherit;
60
+ }
61
+ &[data-checked='true']{
62
+ background: rgba(78,148,207,0.7);
63
+ font-weight: bold;
64
+ }
65
+ &:hover{
66
+ background-color: rgba(255,255,255,.1);
67
+ }
68
+
69
+ }
70
+
71
+ .messageWrap{
72
+ position: absolute;
73
+ right:4px;
74
+ top:6px;
75
+ }
76
+
77
+ }
78
+
79
+
80
+ .iconUnread{
81
+ display: block;
82
+ width: 6px;
83
+ height: 6px;
84
+ border-radius: 6px;
85
+ background-color: red;
86
+ // position: absolute;
87
+ // right: 0;
88
+ // top: 0;
89
+ }
@@ -0,0 +1,81 @@
1
+ // @ts-ignore
2
+ import React, { useRef, useState } from 'react';
3
+ // @ts-ignore
4
+ import { Dropdown,message } from '@/components/antd'
5
+ // @ts-ignore
6
+ import { LogoutOutlined } from '@ant-design/icons';
7
+ // @ts-ignore
8
+ import { useNavigate } from 'react-router-dom';
9
+ // @ts-ignore
10
+ import imgUser from '@/assets/images/icon-user.png';
11
+ import ProviderApp from '@/provider/app';
12
+
13
+ // @ts-ignore
14
+ import styles from './index.module.less';
15
+
16
+
17
+ const TopBar=()=>{
18
+ const app = ProviderApp.useContainer();
19
+ const navigate = useNavigate();
20
+
21
+ const [unreadNotify,setUnreadNotify]=useState(0);
22
+ /**
23
+ * @type {React.MutableRefObject<object>}
24
+ */
25
+ const refSelf =useRef();
26
+
27
+ refSelf.current={
28
+ unreadNotify,setUnreadNotify
29
+ }
30
+
31
+ // const onToggle=()=>{
32
+ // const {leftNavOpen}= app.nav;
33
+ // app.setNav({...app.nav,leftNavOpen:!leftNavOpen})
34
+ // }
35
+ const onAvatarClick=(type)=>{
36
+ switch(type){
37
+ case 'user':{
38
+ const {name,userId,realName} = app.user;
39
+ const {auths} = app;
40
+ let txt = <div>{`[${userId}]${name}(${realName})`}<br/>{`${auths}`}</div>
41
+ message.info( txt );
42
+ }break;
43
+ case 'logout':{
44
+ app.logout();
45
+ }break;
46
+ case 'message':{
47
+ // navigate('/message/my');
48
+ }break;
49
+ }
50
+ }
51
+
52
+ return (
53
+ <section className={styles.topUserInfo}>
54
+ <Dropdown menu={{items:[
55
+ {
56
+ key:'user',
57
+ label:<span className={styles.userMenuItem}>Hi,{app?.user?.realName||'用户'}</span>
58
+ },
59
+ {
60
+ key:'version',
61
+ // @ts-ignore
62
+ label:<span className={styles.userMenuItem}><hgroup className={styles.version} ><span>版本</span><span>V{APP_VERSION}</span></hgroup></span>
63
+ },
64
+ {
65
+ key:'logout',
66
+ label:<span onClick={onAvatarClick.bind(this,'logout')} className={styles.userMenuItem}><LogoutOutlined />退出登录</span>
67
+ }
68
+ ]}}>
69
+ <img className={styles.avatar} src={imgUser}/>
70
+ </Dropdown>
71
+
72
+ {/* <span className={styles.notifyWrap}>
73
+ <img src={imgNotice} className={styles.notice} onClick={onAvatarClick.bind(this,'message')} />
74
+ {unreadNotify>0?<i className={styles.noticeUnread}/>:''}
75
+ </span> */}
76
+
77
+ </section>
78
+ )
79
+ }
80
+
81
+ export default TopBar;
@@ -0,0 +1,97 @@
1
+ @import '~@/_mixin.module.less';
2
+
3
+ .toggle{
4
+ width: 24px;
5
+ height: 24px;
6
+ cursor: pointer;
7
+ transition: transform .2s;
8
+ &[data-tooggle='true']{
9
+ transform: scaleX(-1);
10
+ }
11
+ }
12
+
13
+ .topUserInfo{
14
+ display: flex;
15
+ align-items: center;
16
+ justify-content: flex-end;
17
+ height: 100%;
18
+ width:100%;
19
+ z-index:var(--z-top-menu);
20
+ padding:0 10px;
21
+
22
+ column-gap: 16px;
23
+
24
+
25
+
26
+ .noticeUnread{
27
+ width: 6px;
28
+ height: 6px;
29
+ border-radius: 6px;
30
+ background-color: red;
31
+ position: absolute;
32
+ right:0;
33
+ top:0;
34
+ }
35
+ .notice,
36
+ .avatar{
37
+ cursor: pointer;
38
+ width: 24px;
39
+ height: 24px;
40
+ }
41
+
42
+ .menu:global(.ant-menu){
43
+ line-height: var(--topMenu-height);
44
+ background-color: inherit;
45
+ border-bottom: none;
46
+ flex:1;
47
+ // min-width: 100px;
48
+
49
+ :global{
50
+ .ant-menu-item,
51
+ .ant-menu-item a{
52
+ color:rgba(104,114,126,1);
53
+ font-weight: var(--weight-Medium);
54
+ }
55
+ .ant-menu-item:hover a,
56
+ .ant-menu-item:hover,
57
+ .ant-menu-item-selected a{
58
+ color: rgba(255,255,255,.8);
59
+ }
60
+ .ant-menu-item-selected{
61
+ color: white;
62
+ }
63
+ .ant-menu-item:hover:after,
64
+ .ant-menu-item-selected:after{
65
+ border-bottom: 2px solid #fff;
66
+ }
67
+ .ant-menu-item{
68
+ padding: 0 24px;
69
+ }
70
+ }
71
+ }
72
+ }
73
+
74
+ .avatarMenu{
75
+ min-width: 100px;
76
+ :global(.anticon) {
77
+ margin-right: 8px;
78
+ }
79
+
80
+ :global(.ant-dropdown-menu-item) {
81
+ min-width: 100px;
82
+ }
83
+ }
84
+
85
+ .userMenuItem{
86
+ display: flex;
87
+ column-gap: 6px;
88
+ .version{
89
+ display: flex;
90
+ align-items: center;
91
+ width: 100%;
92
+ justify-content: space-between;
93
+ span:nth-child(2){
94
+ color:#8F959E;
95
+ }
96
+ }
97
+ }
@@ -0,0 +1,96 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import ShowPreview from './preview';
3
+ // @ts-ignore
4
+ import moment from 'moment';
5
+ // @ts-ignore
6
+ import styles from './index.module.less';
7
+ // @ts-ignore
8
+ import imgFail from '@/assets/images/loadFail.png';
9
+
10
+ /**
11
+ * 视频素材预览组件
12
+ * @param {object} [props]
13
+ * @param {'view'|'checkbox'} [props.mode='view'] - 组件类型,view为展示预览,点击后放大预览,checkbox为选择模式
14
+ * @param {boolean} [props.checked=false] - 如果将该组件设定为选择组件,则这里代表是否选中状态
15
+ * @param {(checked:boolean)=>void} [props.onClick] - 点击回调
16
+ *
17
+ *
18
+ * @param {string|object} props.src - 素材下载地址
19
+ * @param {string|object} [props.preview] - 封面图地址
20
+ *
21
+ * @param {string} [props.className] - 样式
22
+ *
23
+ */
24
+ const Video = props=>{
25
+ const { src,className,mode='view',checked=false,onClick:_onClick,preview,...others } = props;
26
+ const [time,setTime] = useState('');
27
+ const onPreview = ()=>{
28
+ if(mode=='checkbox'){
29
+ if(_onClick){
30
+ _onClick(!checked)
31
+ }
32
+ return;
33
+ }
34
+ ShowPreview({
35
+ src,
36
+ });
37
+ }
38
+ const onLoadedMetaData=(e)=>{
39
+ const {target:{duration}} = e;
40
+ if(duration<=0||!duration){
41
+ setTime('');
42
+ return;
43
+ }
44
+ const _time = moment.duration(duration*1000);
45
+ const hours=_time.hours();
46
+ const minutes=_time.minutes();
47
+ const seconds=_time.seconds();
48
+ let req='';
49
+ if(hours>0){
50
+ req+= `${hours}`.padStart(2,'0') + ':';
51
+ }
52
+ req+= `${minutes}`.padStart(2,'0') + ':';
53
+ req+= `${seconds}`.padStart(2,'0');
54
+
55
+ setTime(`${req}`)
56
+ }
57
+
58
+ const load=()=>{
59
+ let video = document.createElement('video');
60
+ video.src= src;
61
+ video.addEventListener('loadedmetadata',onLoadedMetaData);
62
+
63
+ }
64
+ useEffect(()=>{
65
+ load();
66
+ },[])
67
+
68
+ return (
69
+ <div className={`${styles.wrap} ${className}`} onClick={onPreview} data-checked={checked}>
70
+ <img src={preview||imgFail} className={styles.video}/>
71
+
72
+ {/* <video
73
+ onLoadedMetadata={onLoadedMetaData}
74
+ src={src}
75
+ className={`${styles.video}`}
76
+ {...others}
77
+ >
78
+ <a href={src} download>
79
+ 下载
80
+ </a>
81
+ </video> */}
82
+
83
+ {
84
+ time&&
85
+ <div className={styles.info}>
86
+ <div className={styles.iconPlay}></div>
87
+ <span className={styles.time}>{time}</span>
88
+ </div>
89
+ }
90
+
91
+
92
+ </div>
93
+ );
94
+ }
95
+
96
+ export default Video;
@@ -0,0 +1,132 @@
1
+
2
+
3
+ @keyframes loading {
4
+ 0% { transform: rotateZ(0); }
5
+ 100% { transform: rotateZ(360deg); }
6
+ }
7
+
8
+
9
+ .wrap{
10
+ width: 200px;
11
+ height: 200px;
12
+ position: relative;
13
+ display: flex;
14
+ justify-content: center;
15
+ align-items: center;
16
+ cursor: pointer;
17
+
18
+ &[data-checked='true']{
19
+ &:before{
20
+ content:' ';
21
+ position: absolute;
22
+ width: 100%;
23
+ height: 100%;
24
+ background-color: rgba(0,0,0,.5);
25
+ left:0;
26
+ top:0;
27
+ z-index: 1;
28
+ }
29
+ &:after{
30
+ background-image: url('~@/assets/images/chat/checked.png');
31
+ background-size: contain;
32
+ width: 48px;
33
+ height: 48px;
34
+ position: absolute;
35
+ content: ' ';
36
+ z-index: 1;
37
+
38
+ }
39
+ }
40
+
41
+ .loading{
42
+ width: 64px;
43
+ animation: loading 2s infinite normal;
44
+ }
45
+
46
+ .video{
47
+ width: 100%;
48
+ height: 100%;
49
+ }
50
+
51
+ .info{
52
+ display: flex;
53
+ align-items: center;
54
+ background: rgba(31,35,41,0.8);
55
+ position: absolute;
56
+ right:0;
57
+ bottom:0;
58
+ padding:2px 2px 2px 8px;
59
+ border-top-left-radius: 4px;
60
+ border-bottom-left-radius: 4px;
61
+ .iconPlay{
62
+ width: 0;
63
+ height: 0;
64
+ border-left:5px solid white;
65
+ border-right:5px solid transparent;
66
+ border-top:5px solid transparent;
67
+ border-bottom:5px solid transparent;
68
+ }
69
+ .time{
70
+ font-weight: 500;
71
+ font-size: 12px;
72
+ color: #FFFFFF;
73
+ line-height: 16px;
74
+ letter-spacing:-1px;
75
+ }
76
+ }
77
+
78
+
79
+ }
80
+
81
+
82
+
83
+
84
+ .main{
85
+ position: fixed;
86
+ top: 0;
87
+ left: 0;
88
+ z-index: 1000;
89
+ width: 100%;
90
+ height: 100%;
91
+ padding: 30px;
92
+ background-color: rgba(0, 0, 0, 0.7);
93
+ display: flex;
94
+ flex-direction: column;
95
+ justify-content: center;
96
+ align-items: center;
97
+ overflow: auto;
98
+ .current{
99
+ margin-top: 30px;
100
+ flex:none;
101
+ width:70vh;
102
+ height: 70vh;
103
+ display: flex;
104
+ align-items: center;
105
+ justify-content: center;
106
+ position: relative;
107
+ .video{
108
+ width:100%;
109
+ height: 100%;
110
+ }
111
+ }
112
+ .close{
113
+ position: absolute;
114
+ top: -30px;
115
+ right: -30px;
116
+ svg{
117
+ font-size: 24px;
118
+ color:rgba(255, 255, 255, 0.85)
119
+ }
120
+ }
121
+ }
122
+ .preview {
123
+ width: 100%;
124
+ height: 100%;
125
+ display: flex;
126
+ flex-direction: column;
127
+ justify-content: center;
128
+ align-items: center;
129
+ overflow-y: auto;
130
+ position: relative;
131
+
132
+ }