@fmdevui/fm-dev 1.0.4 → 1.0.6

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 (232) hide show
  1. package/README.md +1 -0
  2. package/es/_virtual/de-DE.mjs +1 -1
  3. package/es/_virtual/en-US.mjs +1 -1
  4. package/es/_virtual/es-ES.mjs +1 -1
  5. package/es/_virtual/fr-FR.mjs +1 -1
  6. package/es/_virtual/it-IT.mjs +1 -1
  7. package/es/_virtual/ja-JP.mjs +1 -1
  8. package/es/_virtual/ko-KR.mjs +1 -1
  9. package/es/_virtual/nb-NO.mjs +1 -1
  10. package/es/_virtual/pt-BR.mjs +1 -1
  11. package/es/_virtual/ru-RU.mjs +1 -1
  12. package/es/_virtual/th-TH.mjs +1 -1
  13. package/es/_virtual/vi-VN.mjs +1 -1
  14. package/es/_virtual/zh-CN.mjs +1 -1
  15. package/es/_virtual/zh-HK.mjs +1 -1
  16. package/es/_virtual/zh-TW.mjs +1 -1
  17. package/es/core/api/base/index.d.ts +19 -0
  18. package/es/core/api/index.d.ts +4 -0
  19. package/es/core/api/login/index.d.ts +7 -0
  20. package/es/core/api/sys/index.d.ts +39 -0
  21. package/es/core/api/utils/request.d.ts +36 -0
  22. package/es/core/auth/index.d.ts +40 -0
  23. package/es/core/directive/authDirective.d.ts +8 -0
  24. package/es/core/directive/customDirective.d.ts +21 -0
  25. package/es/core/directive/index.d.ts +9 -0
  26. package/es/core/index.d.ts +5 -2
  27. package/es/core/stores/index.d.ts +6 -0
  28. package/es/core/stores/inpinia.d.ts +3 -0
  29. package/es/core/stores/keepAliveNames.d.ts +17 -0
  30. package/es/core/stores/requestOldRoutes.d.ts +9 -0
  31. package/es/core/stores/routesList.d.ts +14 -0
  32. package/es/core/stores/tagsViewRoutes.d.ts +11 -0
  33. package/es/core/stores/themeConfig.d.ts +5 -0
  34. package/es/core/stores/userInfo.d.ts +21 -0
  35. package/es/core/utils/array/index.d.ts +23 -0
  36. package/es/core/utils/base64/index.d.ts +30 -0
  37. package/es/core/utils/comm/commonFunction.d.ts +17 -0
  38. package/es/core/utils/comm/data-signature.d.ts +17 -0
  39. package/es/core/utils/comm/download.d.ts +46 -0
  40. package/es/core/utils/comm/formatTime.d.ts +37 -0
  41. package/es/core/utils/comm/idleTimeout.d.ts +45 -0
  42. package/es/core/utils/comm/index.d.ts +7 -0
  43. package/es/core/utils/comm/setIconfont.d.ts +12 -0
  44. package/es/core/utils/comm/signalR.d.ts +3 -0
  45. package/es/core/utils/comm/sysInfo.d.ts +2 -0
  46. package/es/core/utils/comm/theme.d.ts +13 -0
  47. package/es/core/utils/comm/toolsValidate.d.ts +148 -0
  48. package/es/core/utils/comm/uploadfileurl.d.ts +2 -0
  49. package/es/core/utils/const/index.d.ts +11 -0
  50. package/es/core/utils/emit/index.d.ts +4 -0
  51. package/es/core/utils/index.d.ts +7 -0
  52. package/es/core/utils/other/index.d.ts +69 -0
  53. package/es/core/utils/storage/index.d.ts +27 -0
  54. package/es/core/utils/watermark/index.d.ts +10 -0
  55. package/es/index.d.ts +1 -2
  56. package/es/index.mjs +23 -0
  57. package/es/node_modules/.pnpm/{vxe-table@4.13.39_vue@3.5.16_typescript@5.8.3_ → vxe-table@4.13.41_vue@3.5.16_typescript@5.8.3_}/node_modules/vxe-table/lib/locale/lang/de-DE.mjs +6 -0
  58. package/es/node_modules/.pnpm/{vxe-table@4.13.39_vue@3.5.16_typescript@5.8.3_ → vxe-table@4.13.41_vue@3.5.16_typescript@5.8.3_}/node_modules/vxe-table/lib/locale/lang/en-US.mjs +6 -0
  59. package/es/node_modules/.pnpm/{vxe-table@4.13.39_vue@3.5.16_typescript@5.8.3_ → vxe-table@4.13.41_vue@3.5.16_typescript@5.8.3_}/node_modules/vxe-table/lib/locale/lang/es-ES.mjs +6 -0
  60. package/es/node_modules/.pnpm/{vxe-table@4.13.39_vue@3.5.16_typescript@5.8.3_ → vxe-table@4.13.41_vue@3.5.16_typescript@5.8.3_}/node_modules/vxe-table/lib/locale/lang/fr-FR.mjs +6 -0
  61. package/es/node_modules/.pnpm/{vxe-table@4.13.39_vue@3.5.16_typescript@5.8.3_ → vxe-table@4.13.41_vue@3.5.16_typescript@5.8.3_}/node_modules/vxe-table/lib/locale/lang/it-IT.mjs +6 -0
  62. package/es/node_modules/.pnpm/{vxe-table@4.13.39_vue@3.5.16_typescript@5.8.3_ → vxe-table@4.13.41_vue@3.5.16_typescript@5.8.3_}/node_modules/vxe-table/lib/locale/lang/ja-JP.mjs +6 -0
  63. package/es/node_modules/.pnpm/{vxe-table@4.13.39_vue@3.5.16_typescript@5.8.3_ → vxe-table@4.13.41_vue@3.5.16_typescript@5.8.3_}/node_modules/vxe-table/lib/locale/lang/ko-KR.mjs +6 -0
  64. package/es/node_modules/.pnpm/{vxe-table@4.13.39_vue@3.5.16_typescript@5.8.3_ → vxe-table@4.13.41_vue@3.5.16_typescript@5.8.3_}/node_modules/vxe-table/lib/locale/lang/nb-NO.mjs +6 -0
  65. package/es/node_modules/.pnpm/{vxe-table@4.13.39_vue@3.5.16_typescript@5.8.3_ → vxe-table@4.13.41_vue@3.5.16_typescript@5.8.3_}/node_modules/vxe-table/lib/locale/lang/pt-BR.mjs +6 -0
  66. package/es/node_modules/.pnpm/{vxe-table@4.13.39_vue@3.5.16_typescript@5.8.3_ → vxe-table@4.13.41_vue@3.5.16_typescript@5.8.3_}/node_modules/vxe-table/lib/locale/lang/ru-RU.mjs +6 -0
  67. package/es/node_modules/.pnpm/{vxe-table@4.13.39_vue@3.5.16_typescript@5.8.3_ → vxe-table@4.13.41_vue@3.5.16_typescript@5.8.3_}/node_modules/vxe-table/lib/locale/lang/th-TH.mjs +6 -0
  68. package/es/node_modules/.pnpm/{vxe-table@4.13.39_vue@3.5.16_typescript@5.8.3_ → vxe-table@4.13.41_vue@3.5.16_typescript@5.8.3_}/node_modules/vxe-table/lib/locale/lang/vi-VN.mjs +6 -0
  69. package/es/node_modules/.pnpm/{vxe-table@4.13.39_vue@3.5.16_typescript@5.8.3_ → vxe-table@4.13.41_vue@3.5.16_typescript@5.8.3_}/node_modules/vxe-table/lib/locale/lang/zh-CHT.mjs +6 -0
  70. package/es/node_modules/.pnpm/{vxe-table@4.13.39_vue@3.5.16_typescript@5.8.3_ → vxe-table@4.13.41_vue@3.5.16_typescript@5.8.3_}/node_modules/vxe-table/lib/locale/lang/zh-CN.mjs +6 -0
  71. package/es/packages/core/api/base/index.mjs +179 -0
  72. package/es/packages/core/api/index.mjs +4 -0
  73. package/es/packages/core/api/login/index.mjs +35 -0
  74. package/es/packages/core/api/sys/index.mjs +201 -0
  75. package/es/packages/core/api/types/global.d.mjs +1 -0
  76. package/es/packages/core/api/utils/request.mjs +173 -0
  77. package/es/packages/core/auth/index.mjs +34 -0
  78. package/es/packages/core/directive/authDirective.mjs +38 -0
  79. package/es/packages/core/directive/customDirective.mjs +147 -0
  80. package/es/packages/core/directive/index.mjs +10 -0
  81. package/es/packages/core/index.mjs +26 -0
  82. package/es/packages/core/stores/index.mjs +6 -0
  83. package/es/packages/core/stores/inpinia.mjs +5 -0
  84. package/es/packages/core/stores/keepAliveNames.mjs +29 -0
  85. package/es/packages/core/stores/requestOldRoutes.mjs +14 -0
  86. package/es/packages/core/stores/routesList.mjs +26 -0
  87. package/es/packages/core/stores/tagsViewRoutes.mjs +22 -0
  88. package/es/packages/core/stores/themeConfig.mjs +161 -0
  89. package/es/packages/core/stores/userInfo.mjs +156 -0
  90. package/es/packages/core/utils/array/index.mjs +59 -0
  91. package/es/packages/core/utils/base64/index.mjs +57 -0
  92. package/es/packages/core/utils/comm/calendar.mjs +785 -0
  93. package/es/packages/core/utils/comm/commonFunction.mjs +83 -0
  94. package/es/packages/core/utils/comm/data-signature.mjs +39 -0
  95. package/es/packages/core/utils/comm/download.mjs +78 -0
  96. package/es/packages/core/utils/comm/formatTime.mjs +110 -0
  97. package/es/packages/core/utils/comm/idleTimeout.mjs +124 -0
  98. package/es/packages/core/utils/comm/index.mjs +7 -0
  99. package/es/packages/core/utils/comm/setIconfont.mjs +36 -0
  100. package/es/packages/core/utils/comm/signalR.mjs +45 -0
  101. package/es/packages/core/utils/comm/sysInfo.mjs +54 -0
  102. package/es/packages/core/utils/comm/theme.mjs +54 -0
  103. package/es/packages/core/utils/comm/toolsValidate.mjs +140 -0
  104. package/es/packages/core/utils/comm/uploadfileurl.mjs +12 -0
  105. package/es/packages/core/utils/const/index.mjs +13 -0
  106. package/es/packages/core/utils/emit/index.mjs +5 -0
  107. package/es/packages/core/utils/index.mjs +13 -0
  108. package/es/packages/core/utils/other/index.mjs +137 -0
  109. package/es/packages/core/utils/storage/index.mjs +55 -0
  110. package/es/packages/core/utils/watermark/index.mjs +39 -0
  111. package/index.js +23664 -5696
  112. package/index.min.js +42 -10
  113. package/index.min.mjs +42 -10
  114. package/index.mjs +23590 -5694
  115. package/lib/_virtual/de-DE.js +1 -1
  116. package/lib/_virtual/en-US.js +1 -1
  117. package/lib/_virtual/es-ES.js +1 -1
  118. package/lib/_virtual/fr-FR.js +1 -1
  119. package/lib/_virtual/it-IT.js +1 -1
  120. package/lib/_virtual/ja-JP.js +1 -1
  121. package/lib/_virtual/ko-KR.js +1 -1
  122. package/lib/_virtual/nb-NO.js +1 -1
  123. package/lib/_virtual/pt-BR.js +1 -1
  124. package/lib/_virtual/ru-RU.js +1 -1
  125. package/lib/_virtual/th-TH.js +1 -1
  126. package/lib/_virtual/vi-VN.js +1 -1
  127. package/lib/_virtual/zh-CN.js +1 -1
  128. package/lib/_virtual/zh-HK.js +1 -1
  129. package/lib/_virtual/zh-TW.js +1 -1
  130. package/lib/core/api/base/index.d.ts +19 -0
  131. package/lib/core/api/index.d.ts +4 -0
  132. package/lib/core/api/login/index.d.ts +7 -0
  133. package/lib/core/api/sys/index.d.ts +39 -0
  134. package/lib/core/api/utils/request.d.ts +36 -0
  135. package/lib/core/auth/index.d.ts +40 -0
  136. package/lib/core/directive/authDirective.d.ts +8 -0
  137. package/lib/core/directive/customDirective.d.ts +21 -0
  138. package/lib/core/directive/index.d.ts +9 -0
  139. package/lib/core/index.d.ts +5 -2
  140. package/lib/core/stores/index.d.ts +6 -0
  141. package/lib/core/stores/inpinia.d.ts +3 -0
  142. package/lib/core/stores/keepAliveNames.d.ts +17 -0
  143. package/lib/core/stores/requestOldRoutes.d.ts +9 -0
  144. package/lib/core/stores/routesList.d.ts +14 -0
  145. package/lib/core/stores/tagsViewRoutes.d.ts +11 -0
  146. package/lib/core/stores/themeConfig.d.ts +5 -0
  147. package/lib/core/stores/userInfo.d.ts +21 -0
  148. package/lib/core/utils/array/index.d.ts +23 -0
  149. package/lib/core/utils/base64/index.d.ts +30 -0
  150. package/lib/core/utils/comm/commonFunction.d.ts +17 -0
  151. package/lib/core/utils/comm/data-signature.d.ts +17 -0
  152. package/lib/core/utils/comm/download.d.ts +46 -0
  153. package/lib/core/utils/comm/formatTime.d.ts +37 -0
  154. package/lib/core/utils/comm/idleTimeout.d.ts +45 -0
  155. package/lib/core/utils/comm/index.d.ts +7 -0
  156. package/lib/core/utils/comm/setIconfont.d.ts +12 -0
  157. package/lib/core/utils/comm/signalR.d.ts +3 -0
  158. package/lib/core/utils/comm/sysInfo.d.ts +2 -0
  159. package/lib/core/utils/comm/theme.d.ts +13 -0
  160. package/lib/core/utils/comm/toolsValidate.d.ts +148 -0
  161. package/lib/core/utils/comm/uploadfileurl.d.ts +2 -0
  162. package/lib/core/utils/const/index.d.ts +11 -0
  163. package/lib/core/utils/emit/index.d.ts +4 -0
  164. package/lib/core/utils/index.d.ts +7 -0
  165. package/lib/core/utils/other/index.d.ts +69 -0
  166. package/lib/core/utils/storage/index.d.ts +27 -0
  167. package/lib/core/utils/watermark/index.d.ts +10 -0
  168. package/lib/index.d.ts +1 -2
  169. package/lib/index.js +111 -7
  170. package/lib/node_modules/.pnpm/{vxe-table@4.13.39_vue@3.5.16_typescript@5.8.3_ → vxe-table@4.13.41_vue@3.5.16_typescript@5.8.3_}/node_modules/vxe-table/lib/locale/lang/de-DE.js +6 -0
  171. package/lib/node_modules/.pnpm/{vxe-table@4.13.39_vue@3.5.16_typescript@5.8.3_ → vxe-table@4.13.41_vue@3.5.16_typescript@5.8.3_}/node_modules/vxe-table/lib/locale/lang/en-US.js +6 -0
  172. package/lib/node_modules/.pnpm/{vxe-table@4.13.39_vue@3.5.16_typescript@5.8.3_ → vxe-table@4.13.41_vue@3.5.16_typescript@5.8.3_}/node_modules/vxe-table/lib/locale/lang/es-ES.js +6 -0
  173. package/lib/node_modules/.pnpm/{vxe-table@4.13.39_vue@3.5.16_typescript@5.8.3_ → vxe-table@4.13.41_vue@3.5.16_typescript@5.8.3_}/node_modules/vxe-table/lib/locale/lang/fr-FR.js +6 -0
  174. package/lib/node_modules/.pnpm/{vxe-table@4.13.39_vue@3.5.16_typescript@5.8.3_ → vxe-table@4.13.41_vue@3.5.16_typescript@5.8.3_}/node_modules/vxe-table/lib/locale/lang/it-IT.js +6 -0
  175. package/lib/node_modules/.pnpm/{vxe-table@4.13.39_vue@3.5.16_typescript@5.8.3_ → vxe-table@4.13.41_vue@3.5.16_typescript@5.8.3_}/node_modules/vxe-table/lib/locale/lang/ja-JP.js +6 -0
  176. package/lib/node_modules/.pnpm/{vxe-table@4.13.39_vue@3.5.16_typescript@5.8.3_ → vxe-table@4.13.41_vue@3.5.16_typescript@5.8.3_}/node_modules/vxe-table/lib/locale/lang/ko-KR.js +6 -0
  177. package/lib/node_modules/.pnpm/{vxe-table@4.13.39_vue@3.5.16_typescript@5.8.3_ → vxe-table@4.13.41_vue@3.5.16_typescript@5.8.3_}/node_modules/vxe-table/lib/locale/lang/nb-NO.js +6 -0
  178. package/lib/node_modules/.pnpm/{vxe-table@4.13.39_vue@3.5.16_typescript@5.8.3_ → vxe-table@4.13.41_vue@3.5.16_typescript@5.8.3_}/node_modules/vxe-table/lib/locale/lang/pt-BR.js +6 -0
  179. package/lib/node_modules/.pnpm/{vxe-table@4.13.39_vue@3.5.16_typescript@5.8.3_ → vxe-table@4.13.41_vue@3.5.16_typescript@5.8.3_}/node_modules/vxe-table/lib/locale/lang/ru-RU.js +6 -0
  180. package/lib/node_modules/.pnpm/{vxe-table@4.13.39_vue@3.5.16_typescript@5.8.3_ → vxe-table@4.13.41_vue@3.5.16_typescript@5.8.3_}/node_modules/vxe-table/lib/locale/lang/th-TH.js +6 -0
  181. package/lib/node_modules/.pnpm/{vxe-table@4.13.39_vue@3.5.16_typescript@5.8.3_ → vxe-table@4.13.41_vue@3.5.16_typescript@5.8.3_}/node_modules/vxe-table/lib/locale/lang/vi-VN.js +6 -0
  182. package/lib/node_modules/.pnpm/{vxe-table@4.13.39_vue@3.5.16_typescript@5.8.3_ → vxe-table@4.13.41_vue@3.5.16_typescript@5.8.3_}/node_modules/vxe-table/lib/locale/lang/zh-CHT.js +6 -0
  183. package/lib/node_modules/.pnpm/{vxe-table@4.13.39_vue@3.5.16_typescript@5.8.3_ → vxe-table@4.13.41_vue@3.5.16_typescript@5.8.3_}/node_modules/vxe-table/lib/locale/lang/zh-CN.js +6 -0
  184. package/lib/packages/core/api/base/index.js +181 -0
  185. package/lib/packages/core/api/index.js +26 -0
  186. package/lib/packages/core/api/login/index.js +37 -0
  187. package/lib/packages/core/api/sys/index.js +204 -0
  188. package/lib/packages/core/api/types/global.d.js +2 -0
  189. package/lib/packages/core/api/utils/request.js +190 -0
  190. package/lib/packages/core/auth/index.js +41 -0
  191. package/lib/packages/core/directive/authDirective.js +40 -0
  192. package/lib/packages/core/directive/customDirective.js +151 -0
  193. package/lib/packages/core/directive/index.js +12 -0
  194. package/lib/packages/core/index.js +114 -7
  195. package/lib/packages/core/stores/index.js +17 -0
  196. package/lib/packages/core/stores/inpinia.js +7 -0
  197. package/lib/packages/core/stores/keepAliveNames.js +31 -0
  198. package/lib/packages/core/stores/requestOldRoutes.js +16 -0
  199. package/lib/packages/core/stores/routesList.js +28 -0
  200. package/lib/packages/core/stores/tagsViewRoutes.js +24 -0
  201. package/lib/packages/core/stores/themeConfig.js +163 -0
  202. package/lib/packages/core/stores/userInfo.js +158 -0
  203. package/lib/packages/core/utils/array/index.js +64 -0
  204. package/lib/packages/core/utils/base64/index.js +63 -0
  205. package/lib/packages/core/utils/comm/calendar.js +789 -0
  206. package/lib/packages/core/utils/comm/commonFunction.js +87 -0
  207. package/lib/packages/core/utils/comm/data-signature.js +41 -0
  208. package/lib/packages/core/utils/comm/download.js +86 -0
  209. package/lib/packages/core/utils/comm/formatTime.js +115 -0
  210. package/lib/packages/core/utils/comm/idleTimeout.js +128 -0
  211. package/lib/packages/core/utils/comm/index.js +50 -0
  212. package/lib/packages/core/utils/comm/setIconfont.js +42 -0
  213. package/lib/packages/core/utils/comm/signalR.js +66 -0
  214. package/lib/packages/core/utils/comm/sysInfo.js +57 -0
  215. package/lib/packages/core/utils/comm/theme.js +56 -0
  216. package/lib/packages/core/utils/comm/toolsValidate.js +165 -0
  217. package/lib/packages/core/utils/comm/uploadfileurl.js +14 -0
  218. package/lib/packages/core/utils/const/index.js +15 -0
  219. package/lib/packages/core/utils/emit/index.js +9 -0
  220. package/lib/packages/core/utils/index.js +69 -0
  221. package/lib/packages/core/utils/other/index.js +149 -0
  222. package/lib/packages/core/utils/storage/index.js +58 -0
  223. package/lib/packages/core/utils/watermark/index.js +41 -0
  224. package/package.json +2 -2
  225. package/es/core/types/axios/index.d.ts +0 -11
  226. package/es/packages/core/types/axios/index.mjs +0 -2
  227. package/lib/core/types/axios/index.d.ts +0 -11
  228. package/lib/packages/core/types/axios/index.js +0 -28
  229. /package/es/node_modules/.pnpm/{vxe-table@4.13.39_vue@3.5.16_typescript@5.8.3_ → vxe-table@4.13.41_vue@3.5.16_typescript@5.8.3_}/node_modules/vxe-table/lib/locale/lang/zh-HK.mjs +0 -0
  230. /package/es/node_modules/.pnpm/{vxe-table@4.13.39_vue@3.5.16_typescript@5.8.3_ → vxe-table@4.13.41_vue@3.5.16_typescript@5.8.3_}/node_modules/vxe-table/lib/locale/lang/zh-TW.mjs +0 -0
  231. /package/lib/node_modules/.pnpm/{vxe-table@4.13.39_vue@3.5.16_typescript@5.8.3_ → vxe-table@4.13.41_vue@3.5.16_typescript@5.8.3_}/node_modules/vxe-table/lib/locale/lang/zh-HK.js +0 -0
  232. /package/lib/node_modules/.pnpm/{vxe-table@4.13.39_vue@3.5.16_typescript@5.8.3_ → vxe-table@4.13.41_vue@3.5.16_typescript@5.8.3_}/node_modules/vxe-table/lib/locale/lang/zh-TW.js +0 -0
@@ -0,0 +1,83 @@
1
+ import useClipboard from 'vue-clipboard3';
2
+ import { ElMessage } from 'element-plus';
3
+ import { formatDate } from './formatTime.mjs';
4
+ import { useI18n } from 'vue-i18n';
5
+
6
+ function commonFunction() {
7
+ const { toClipboard } = useClipboard();
8
+ const percentFormat = (row, column, cellValue) => {
9
+ return cellValue ? `${cellValue}%` : "-";
10
+ };
11
+ const dateFormatYMD = (row, column, cellValue) => {
12
+ if (!cellValue) return "-";
13
+ return formatDate(new Date(cellValue), "YYYY-mm-dd");
14
+ };
15
+ const dateFormatYMDHMS = (row, column, cellValue) => {
16
+ if (!cellValue) return "-";
17
+ return formatDate(new Date(cellValue), "YYYY-mm-dd HH:MM:SS");
18
+ };
19
+ const dateFormatHMS = (row, column, cellValue) => {
20
+ if (!cellValue) return "-";
21
+ let time = 0;
22
+ if (typeof row === "number") time = row;
23
+ if (typeof cellValue === "number") time = cellValue;
24
+ return formatDate(new Date(time * 1e3), "HH:MM:SS");
25
+ };
26
+ const scaleFormat = (value = "0", scale = 4) => {
27
+ return Number.parseFloat(value).toFixed(scale);
28
+ };
29
+ const scale2Format = (value = "0") => {
30
+ return Number.parseFloat(value).toFixed(2);
31
+ };
32
+ const groupSeparator = (value, minimumFractionDigits = 2) => {
33
+ return value.toLocaleString("en-US", {
34
+ minimumFractionDigits,
35
+ maximumFractionDigits: 2
36
+ });
37
+ };
38
+ const copyText = (text) => {
39
+ const { t } = useI18n();
40
+ return new Promise((resolve, reject) => {
41
+ try {
42
+ toClipboard(text);
43
+ ElMessage.success(t("message.layout.copyTextSuccess"));
44
+ resolve(text);
45
+ } catch (e) {
46
+ ElMessage.error(t("message.layout.copyTextError"));
47
+ reject(e);
48
+ }
49
+ });
50
+ };
51
+ const removeHtmlSub = (value) => {
52
+ var str = value.replace(/<[^>]+>/g, "");
53
+ if (str.length > 50) return str.substring(0, 50) + "......";
54
+ else return str;
55
+ };
56
+ const removeHtml = (value) => {
57
+ return value.replace(/<[^>]+>/g, "");
58
+ };
59
+ const getEnumDesc = (key, lstEnum) => {
60
+ return lstEnum.find((x) => x.value == key)?.describe;
61
+ };
62
+ const appendQueryParams = (url, params) => {
63
+ if (!params || Object.keys(params).length == 0) return url;
64
+ const queryString = Object.keys(params).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`).join("&");
65
+ return `${url}${url.includes("?") ? "&" : "?"}${queryString}`;
66
+ };
67
+ return {
68
+ percentFormat,
69
+ dateFormatYMD,
70
+ dateFormatYMDHMS,
71
+ dateFormatHMS,
72
+ scaleFormat,
73
+ scale2Format,
74
+ groupSeparator,
75
+ copyText,
76
+ removeHtmlSub,
77
+ removeHtml,
78
+ getEnumDesc,
79
+ appendQueryParams
80
+ };
81
+ }
82
+
83
+ export { commonFunction as default };
@@ -0,0 +1,39 @@
1
+ import CryptoJS from 'crypto-js';
2
+
3
+ function signatureByKSort(appId, appKey, command, data, timestamp = null) {
4
+ const input = typeof data === "string" ? data : JSON.stringify(data);
5
+ if (!timestamp) {
6
+ timestamp = (/* @__PURE__ */ new Date()).getTime() - (/* @__PURE__ */ new Date("1970-01-01T00:00:00Z")).getTime();
7
+ }
8
+ const sData = {
9
+ app_id: appId,
10
+ app_key: appKey,
11
+ command,
12
+ data: input,
13
+ timestamp
14
+ };
15
+ const keys = Object.keys(sData);
16
+ keys.sort();
17
+ let result = "";
18
+ for (let i = 0; i < keys.length; i++) {
19
+ const key = keys[i];
20
+ const value = sData[key];
21
+ result += key + "=" + value;
22
+ if (i < keys.length - 1) {
23
+ result += ",";
24
+ }
25
+ }
26
+ const hash = CryptoJS.MD5(result);
27
+ const hexString = hash.toString(CryptoJS.enc.Hex);
28
+ var signature = hexString.toLowerCase();
29
+ return {
30
+ app_id: appId,
31
+ app_key: appKey,
32
+ command,
33
+ data: input,
34
+ timestamp,
35
+ signature
36
+ };
37
+ }
38
+
39
+ export { signatureByKSort };
@@ -0,0 +1,78 @@
1
+ import { urlToBase64, dataURLtoBlob } from '../base64/index.mjs';
2
+
3
+ function downloadByOnlineUrl(url, filename, mime, bom) {
4
+ urlToBase64(url).then((base64) => {
5
+ downloadByBase64(base64, filename, mime, bom);
6
+ });
7
+ }
8
+ function downloadByBase64(buf, filename, mime, bom) {
9
+ const base64Buf = dataURLtoBlob(buf);
10
+ downloadByData(base64Buf, filename, mime, bom);
11
+ }
12
+ function downloadByData(data, filename, mime, bom) {
13
+ const blobData = typeof bom !== "undefined" ? [bom, data] : [data];
14
+ const blob = new Blob(blobData, { type: mime || "application/octet-stream" });
15
+ const blobURL = window.URL.createObjectURL(blob);
16
+ const tempLink = document.createElement("a");
17
+ tempLink.style.display = "none";
18
+ tempLink.href = blobURL;
19
+ tempLink.setAttribute("download", filename);
20
+ if (typeof tempLink.download === "undefined") {
21
+ tempLink.setAttribute("target", "_blank");
22
+ }
23
+ document.body.appendChild(tempLink);
24
+ tempLink.click();
25
+ document.body.removeChild(tempLink);
26
+ window.URL.revokeObjectURL(blobURL);
27
+ }
28
+ function downloadByUrl({ url, target = "_blank", fileName }) {
29
+ const isChrome = window.navigator.userAgent.toLowerCase().indexOf("chrome") > -1;
30
+ const isSafari = window.navigator.userAgent.toLowerCase().indexOf("safari") > -1;
31
+ if (/(iP)/g.test(window.navigator.userAgent)) {
32
+ console.error("Your browser does not support download!");
33
+ return false;
34
+ }
35
+ if (isChrome || isSafari) {
36
+ const link = document.createElement("a");
37
+ link.href = url;
38
+ link.target = target;
39
+ if (link.download !== void 0) {
40
+ link.download = fileName || url.substring(url.lastIndexOf("/") + 1, url.length);
41
+ }
42
+ if (document.createEvent) {
43
+ const e = document.createEvent("MouseEvents");
44
+ e.initEvent("click", true, true);
45
+ link.dispatchEvent(e);
46
+ return true;
47
+ }
48
+ }
49
+ if (url.indexOf("?") === -1) {
50
+ url += "?download";
51
+ }
52
+ openWindow(url, { target });
53
+ return true;
54
+ }
55
+ function openWindow(url, opt) {
56
+ const { target = "__blank", noopener = true, noreferrer = true } = opt || {};
57
+ const feature = [];
58
+ noopener && feature.push("noopener=yes");
59
+ noreferrer && feature.push("noreferrer=yes");
60
+ window.open(url, target, feature.join(","));
61
+ }
62
+ function getFileName(headers) {
63
+ var fileName = headers["content-disposition"].split(";")[1].split("filename=")[1];
64
+ var fileNameUnicode = headers["content-disposition"].split("filename*=")[1];
65
+ if (fileName?.includes("%")) fileName = decodeURIComponent(fileName);
66
+ if (fileNameUnicode) {
67
+ fileName = decodeURIComponent(fileNameUnicode.split("''")[1]);
68
+ }
69
+ return fileName;
70
+ }
71
+ function downloadStreamFile(res, fileName = void 0) {
72
+ const contentType = res.headers["content-type"];
73
+ fileName = fileName || getFileName(res.headers);
74
+ const blob = res.data instanceof Blob ? res.data : new Blob([res.data], { type: contentType });
75
+ downloadByUrl({ url: window.URL.createObjectURL(blob), fileName });
76
+ }
77
+
78
+ export { downloadByBase64, downloadByData, downloadByOnlineUrl, downloadByUrl, downloadStreamFile, getFileName, openWindow };
@@ -0,0 +1,110 @@
1
+ function formatDate(date, format) {
2
+ let we = date.getDay();
3
+ let z = getWeek(date);
4
+ let qut = Math.floor((date.getMonth() + 3) / 3).toString();
5
+ const opt = {
6
+ "Y+": date.getFullYear().toString(),
7
+ // 年
8
+ "m+": (date.getMonth() + 1).toString(),
9
+ // 月(月份从0开始,要+1)
10
+ "d+": date.getDate().toString(),
11
+ // 日
12
+ "H+": date.getHours().toString(),
13
+ // 时
14
+ "M+": date.getMinutes().toString(),
15
+ // 分
16
+ "S+": date.getSeconds().toString(),
17
+ // 秒
18
+ "q+": qut
19
+ // 季度
20
+ };
21
+ const week = {
22
+ "0": "\u65E5",
23
+ "1": "\u4E00",
24
+ "2": "\u4E8C",
25
+ "3": "\u4E09",
26
+ "4": "\u56DB",
27
+ "5": "\u4E94",
28
+ "6": "\u516D"
29
+ };
30
+ const quarter = {
31
+ "1": "\u4E00",
32
+ "2": "\u4E8C",
33
+ "3": "\u4E09",
34
+ "4": "\u56DB"
35
+ };
36
+ if (/(W+)/.test(format)) format = format.replace(RegExp.$1, RegExp.$1.length > 1 ? RegExp.$1.length > 2 ? "\u661F\u671F" + week[we] : "\u5468" + week[we] : week[we]);
37
+ if (/(Q+)/.test(format)) format = format.replace(RegExp.$1, RegExp.$1.length == 4 ? "\u7B2C" + quarter[qut] + "\u5B63\u5EA6" : quarter[qut]);
38
+ if (/(Z+)/.test(format)) format = format.replace(RegExp.$1, RegExp.$1.length == 3 ? "\u7B2C" + z + "\u5468" : z + "");
39
+ for (let k in opt) {
40
+ let r = new RegExp("(" + k + ")").exec(format);
41
+ if (r) format = format.replace(r[1], RegExp.$1.length == 1 ? opt[k] : opt[k].padStart(RegExp.$1.length, "0"));
42
+ }
43
+ return format;
44
+ }
45
+ function getWeek(dateTime) {
46
+ let temptTime = new Date(dateTime.getTime());
47
+ let weekday = temptTime.getDay() || 7;
48
+ temptTime.setDate(temptTime.getDate() - weekday + 1 + 5);
49
+ let firstDay = new Date(temptTime.getFullYear(), 0, 1);
50
+ let dayOfWeek = firstDay.getDay();
51
+ let spendDay = 1;
52
+ if (dayOfWeek != 0) spendDay = 7 - dayOfWeek + 1;
53
+ firstDay = new Date(temptTime.getFullYear(), 0, 1 + spendDay);
54
+ let d = Math.ceil((temptTime.valueOf() - firstDay.valueOf()) / 864e5);
55
+ let result = Math.ceil(d / 7);
56
+ return result;
57
+ }
58
+ function formatPast(param, format = "YYYY-mm-dd") {
59
+ let t, s;
60
+ let time = (/* @__PURE__ */ new Date()).getTime();
61
+ typeof param === "string" || "object" ? t = new Date(param).getTime() : t = param;
62
+ time = Number.parseInt(`${time - t}`);
63
+ if (time < 1e4) {
64
+ return "\u521A\u521A";
65
+ } else if (time < 6e4 && time >= 1e4) {
66
+ s = Math.floor(time / 1e3);
67
+ return `${s}\u79D2\u524D`;
68
+ } else if (time < 36e5 && time >= 6e4) {
69
+ s = Math.floor(time / 6e4);
70
+ return `${s}\u5206\u949F\u524D`;
71
+ } else if (time < 864e5 && time >= 36e5) {
72
+ s = Math.floor(time / 36e5);
73
+ return `${s}\u5C0F\u65F6\u524D`;
74
+ } else if (time < 2592e5 && time >= 864e5) {
75
+ s = Math.floor(time / 864e5);
76
+ return `${s}\u5929\u524D`;
77
+ } else {
78
+ let date = typeof param === "string" || "object" ? new Date(param) : param;
79
+ return formatDate(date, format);
80
+ }
81
+ }
82
+ function formatAxis(param, t) {
83
+ let hour = new Date(param).getHours();
84
+ const defaultMessages = {
85
+ dawnGreeting: "\u51CC\u6668\u597D",
86
+ mornGreeting: "\u65E9\u4E0A\u597D",
87
+ amGreeting: "\u4E0A\u5348\u597D",
88
+ noonGreeting: "\u4E2D\u5348\u597D",
89
+ pmGreeting: "\u4E0B\u5348\u597D",
90
+ duskGreeting: "\u508D\u665A\u597D",
91
+ eveningGreeting: "\u665A\u4E0A\u597D",
92
+ nightGreeting: "\u591C\u91CC\u597D"
93
+ };
94
+ const getMessage = (key) => {
95
+ if (t) {
96
+ return t(`message.list.${key}`);
97
+ }
98
+ return defaultMessages[key];
99
+ };
100
+ if (hour < 6) return getMessage("dawnGreeting");
101
+ else if (hour < 9) return getMessage("mornGreeting");
102
+ else if (hour < 12) return getMessage("amGreeting");
103
+ else if (hour < 14) return getMessage("noonGreeting");
104
+ else if (hour < 17) return getMessage("pmGreeting");
105
+ else if (hour < 19) return getMessage("duskGreeting");
106
+ else if (hour < 22) return getMessage("eveningGreeting");
107
+ else return getMessage("nightGreeting");
108
+ }
109
+
110
+ export { formatAxis, formatDate, formatPast, getWeek };
@@ -0,0 +1,124 @@
1
+ import { debounce } from 'lodash-es';
2
+ import { Local, Session } from '../storage/index.mjs';
3
+ import { ElMessageBox } from 'element-plus';
4
+ import { PUB } from '../const/index.mjs';
5
+ import { useI18n } from 'vue-i18n';
6
+
7
+ let signalR;
8
+ async function loadSignalR() {
9
+ if (!signalR) {
10
+ const module = await import('./signalR.mjs');
11
+ signalR = module.signalR;
12
+ }
13
+ return signalR;
14
+ }
15
+ class IdleTimeoutManager {
16
+ timerId = null;
17
+ config;
18
+ debouncedReset;
19
+ /** 检查闲置超时时间间隔 */
20
+ checkTimeoutInterval = 2 * 1e3;
21
+ constructor(config = {}) {
22
+ this.config = {
23
+ timeout: 30 * 60,
24
+ events: ["mousewheel", "keydown", "click"],
25
+ onTimeout: this.timeOutExec.bind(this),
26
+ debounceInterval: 200,
27
+ ...config
28
+ };
29
+ this.debouncedReset = this.config.debounceInterval > 0 ? debounce(this.setLastActivityTime.bind(this), this.config.debounceInterval) : this.setLastActivityTime.bind(this);
30
+ this.init();
31
+ }
32
+ init() {
33
+ this.config.events.forEach((event) => {
34
+ window.addEventListener(event, this.debouncedReset);
35
+ });
36
+ document.addEventListener("visibilitychange", this.handleVisibilityChange);
37
+ this.setLastActivityTime();
38
+ this.updateIdleTimeout(this.config.timeout);
39
+ }
40
+ handleVisibilityChange = () => {
41
+ if (document.visibilityState === "visible") {
42
+ this.setLastActivityTime();
43
+ }
44
+ };
45
+ /** 设置最后活动时间 */
46
+ setLastActivityTime() {
47
+ Local.set("lastActivityTime", (/* @__PURE__ */ new Date()).getTime());
48
+ }
49
+ /**
50
+ * 更新空闲超时时间
51
+ * @param timeout - 新的超时时间(毫秒)
52
+ */
53
+ updateIdleTimeout(timeout) {
54
+ this.config.timeout = timeout;
55
+ if (this.config.timeout > 0 && this.timerId == null) {
56
+ this.timerId = window.setInterval(this.checkTimeout.bind(this), this.checkTimeoutInterval);
57
+ } else if (this.config.timeout == 0 && this.timerId != null) {
58
+ window.clearInterval(this.timerId);
59
+ this.timerId = null;
60
+ }
61
+ }
62
+ /** 检查是否超时 */
63
+ checkTimeout() {
64
+ const currentTime = (/* @__PURE__ */ new Date()).getTime();
65
+ const lastActivityTime = Number(Local.get("lastActivityTime"));
66
+ if (lastActivityTime == 0) return;
67
+ const accessToken = Local.get(PUB.accessTokenKey);
68
+ if (!accessToken || accessToken == "invalid_token") return;
69
+ const timeout = this.config.timeout * 1e3;
70
+ if (currentTime - lastActivityTime > timeout) {
71
+ this.destroy();
72
+ this.config.onTimeout();
73
+ }
74
+ }
75
+ /** 销毁实例 */
76
+ destroy() {
77
+ this.config.events.forEach((event) => {
78
+ window.removeEventListener(event, this.debouncedReset);
79
+ });
80
+ document.removeEventListener("visibilitychange", this.handleVisibilityChange);
81
+ if (this.timerId !== null) {
82
+ window.clearInterval(this.timerId);
83
+ this.timerId = null;
84
+ }
85
+ }
86
+ /** 超时时执行 */
87
+ timeOutExec() {
88
+ const appEl = document.getElementById("app");
89
+ appEl?.remove();
90
+ loadSignalR().then((signalR2) => {
91
+ signalR2.stop();
92
+ });
93
+ Local.remove(PUB.accessTokenKey);
94
+ Local.remove(PUB.refreshAccessTokenKey);
95
+ Session.clear();
96
+ const { t } = useI18n();
97
+ ElMessageBox.alert(t("message.list.idleTimeoutMessage"), t("message.list.sysMessage"), {
98
+ type: "warning",
99
+ draggable: true,
100
+ callback: () => {
101
+ window.location.reload();
102
+ }
103
+ });
104
+ }
105
+ }
106
+ function initIdleTimeout(config) {
107
+ if (!window.__IDLE_TIMEOUT__) {
108
+ window.__IDLE_TIMEOUT__ = new IdleTimeoutManager(config);
109
+ }
110
+ return window.__IDLE_TIMEOUT__;
111
+ }
112
+ function destroyIdleTimeout() {
113
+ if (window.__IDLE_TIMEOUT__) {
114
+ window.__IDLE_TIMEOUT__.destroy();
115
+ window.__IDLE_TIMEOUT__ = void 0;
116
+ }
117
+ }
118
+ function updateIdleTimeout(timeout) {
119
+ if (window.__IDLE_TIMEOUT__) {
120
+ window.__IDLE_TIMEOUT__.updateIdleTimeout(timeout);
121
+ }
122
+ }
123
+
124
+ export { destroyIdleTimeout, initIdleTimeout, updateIdleTimeout };
@@ -0,0 +1,7 @@
1
+ export { judgementIdCard, verifiyNumberInteger, verifyAccount, verifyAndSpace, verifyCarNum, verifyCnAndSpace, verifyEmail, verifyEnAndSpace, verifyFullName, verifyIPAddress, verifyIdCard, verifyNumberCnUppercase, verifyNumberComma, verifyNumberIntegerAndFloat, verifyNumberPercentage, verifyNumberPercentageFloat, verifyPassword, verifyPasswordPowerful, verifyPasswordStrength, verifyPhone, verifyPostalCode, verifyTelPhone, verifyTextColor, verifyUrl } from './toolsValidate.mjs';
2
+ export { formatAxis, formatDate, formatPast, getWeek } from './formatTime.mjs';
3
+ export { useChangeColor } from './theme.mjs';
4
+ export { downloadByBase64, downloadByData, downloadByOnlineUrl, downloadByUrl, downloadStreamFile, getFileName, openWindow } from './download.mjs';
5
+ export { signatureByKSort } from './data-signature.mjs';
6
+ import './commonFunction.mjs';
7
+ export { getFileUrl } from './uploadfileurl.mjs';
@@ -0,0 +1,36 @@
1
+ const cssCdnUrlList = [
2
+ // 调整为从本地引入,注释下面的 url
3
+ // '//at.alicdn.com/t/c/font_2298093_rnp72ifj3ba.css',
4
+ // '//netdna.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css',
5
+ ];
6
+ const jsCdnUrlList = [];
7
+ function setCssCdn() {
8
+ if (cssCdnUrlList.length <= 0) return false;
9
+ cssCdnUrlList.map((v) => {
10
+ let link = document.createElement("link");
11
+ link.rel = "stylesheet";
12
+ link.href = v;
13
+ link.crossOrigin = "anonymous";
14
+ document.getElementsByTagName("head")[0].appendChild(link);
15
+ });
16
+ }
17
+ function setJsCdn() {
18
+ if (jsCdnUrlList.length <= 0) return false;
19
+ jsCdnUrlList.map((v) => {
20
+ let link = document.createElement("script");
21
+ link.src = v;
22
+ document.body.appendChild(link);
23
+ });
24
+ }
25
+ const setIntroduction = {
26
+ // 设置css
27
+ cssCdn: () => {
28
+ setCssCdn();
29
+ },
30
+ // 设置js
31
+ jsCdn: () => {
32
+ setJsCdn();
33
+ }
34
+ };
35
+
36
+ export { setIntroduction as default, setCssCdn, setJsCdn };
@@ -0,0 +1,45 @@
1
+ import * as SignalR from '@microsoft/signalr';
2
+ import { ElNotification } from 'element-plus';
3
+ import '../../api/index.mjs';
4
+ import { getToken } from '../../api/utils/request.mjs';
5
+
6
+ const connection = new SignalR.HubConnectionBuilder().configureLogging(SignalR.LogLevel.Information).withUrl(`${window.__env__.VITE_API_URL}/fmauth/hubs/onlineUser?token=${getToken()}`, { transport: SignalR.HttpTransportType.WebSockets, skipNegotiation: true }).withAutomaticReconnect({
7
+ nextRetryDelayInMilliseconds: () => {
8
+ return 5e3;
9
+ }
10
+ }).build();
11
+ connection.keepAliveIntervalInMilliseconds = 15 * 1e3;
12
+ connection.serverTimeoutInMilliseconds = 30 * 60 * 1e3;
13
+ connection.serverTimeoutInMilliseconds = 30 * 1e3;
14
+ connection.keepAliveIntervalInMilliseconds = 15 * 1e3;
15
+ connection.start().then(() => {
16
+ });
17
+ connection.onclose(async () => {
18
+ });
19
+ connection.onreconnecting(() => {
20
+ ElNotification({
21
+ title: "\u63D0\u793A",
22
+ message: "\u670D\u52A1\u5668\u5DF2\u65AD\u7EBF...",
23
+ type: "error",
24
+ position: "bottom-right"
25
+ });
26
+ });
27
+ connection.onreconnected(() => {
28
+ });
29
+ connection.on("OnlineUserList", () => {
30
+ });
31
+ connection.on("ReceiveMessage", (message) => {
32
+ var tmpMsg = `<div style="white-space: pre-wrap;">${message.message}<div><br/>`;
33
+ tmpMsg += `<p style="color:#808080; font-size:12px">\u53D1\u9001\u4EBA\u5458\uFF1A${message.sendUserName}<p>`;
34
+ tmpMsg += `<p style="color:#808080; font-size:12px">\u53D1\u9001\u65F6\u95F4\uFF1A${message.sendTime}<p>`;
35
+ ElNotification({
36
+ title: `\u6D88\u606F\u3010${message.title}\u3011`,
37
+ message: tmpMsg,
38
+ type: "info",
39
+ position: "top-right",
40
+ dangerouslyUseHTMLString: true,
41
+ duration: 0
42
+ });
43
+ });
44
+
45
+ export { connection as signalR };
@@ -0,0 +1,54 @@
1
+ import { Local } from '../storage/index.mjs';
2
+ import { storeToRefs } from 'pinia';
3
+ import '../../stores/index.mjs';
4
+ import { PUB } from '../const/index.mjs';
5
+ import '../../api/index.mjs';
6
+ import { updateIdleTimeout } from './idleTimeout.mjs';
7
+ import { useThemeConfig } from '../../stores/themeConfig.mjs';
8
+ import { feature, useSysApi } from '../../api/sys/index.mjs';
9
+
10
+ const storesThemeConfig = useThemeConfig();
11
+ const { themeConfig } = storeToRefs(storesThemeConfig);
12
+ async function loadSysInfo(tenantid) {
13
+ const [err, res] = await feature(useSysApi().getSysInfo(Number(tenantid)));
14
+ if (err) {
15
+ themeConfig.value.logoUrl = "logo.png";
16
+ Local.remove(PUB.themeConfig);
17
+ Local.set(PUB.themeConfig, storesThemeConfig.themeConfig);
18
+ return;
19
+ } else {
20
+ if (res.data.type != "success" || res.data.result == null) return;
21
+ const data = res.data.result;
22
+ themeConfig.value.logoUrl = data.logo;
23
+ themeConfig.value.globalTitle = data.title;
24
+ themeConfig.value.globalViceTitle = data.viceTitle;
25
+ themeConfig.value.globalViceTitleMsg = data.viceDesc;
26
+ themeConfig.value.icp = data.icp;
27
+ themeConfig.value.icpUrl = data.icpUrl;
28
+ themeConfig.value.isWatermark = data.watermark != null;
29
+ themeConfig.value.watermarkText = data.watermark;
30
+ themeConfig.value.copyright = data.copyright;
31
+ themeConfig.value.version = data.version;
32
+ themeConfig.value.primary = data.themeColor;
33
+ themeConfig.value.layout = data.layout;
34
+ themeConfig.value.animation = data.animation;
35
+ themeConfig.value.secondVer = data.secondVer;
36
+ themeConfig.value.captcha = data.captcha;
37
+ themeConfig.value.forceChangePassword = data.forceChangePassword;
38
+ themeConfig.value.passwordExpirationTime = data.passwordExpirationTime;
39
+ themeConfig.value.i18NSwitch = data.i18NSwitch;
40
+ themeConfig.value.idleTimeout = data.idleTimeout;
41
+ themeConfig.value.onlineNotice = data.onlineNotice;
42
+ window.__env__.VITE_SM_PUBLIC_KEY = data.publicKey;
43
+ updateFavicon(data.logo);
44
+ updateIdleTimeout(themeConfig.value.idleTimeout ?? 0);
45
+ Local.remove(PUB.themeConfig);
46
+ Local.set(PUB.themeConfig, storesThemeConfig.themeConfig);
47
+ }
48
+ }
49
+ const updateFavicon = (url) => {
50
+ const favicon = document.getElementById("favicon");
51
+ favicon.href = url ? url : "data:;base64,=";
52
+ };
53
+
54
+ export { loadSysInfo, updateFavicon };
@@ -0,0 +1,54 @@
1
+ import { ElMessage } from 'element-plus';
2
+
3
+ function useChangeColor() {
4
+ const hexToRgb = (str) => {
5
+ let hexs = "";
6
+ let reg = /^\#?[0-9A-Fa-f]{6}$/;
7
+ if (!reg.test(str)) {
8
+ ElMessage.warning("\u8F93\u5165\u9519\u8BEF\u7684hex");
9
+ return "";
10
+ }
11
+ str = str.replace("#", "");
12
+ hexs = str.match(/../g);
13
+ for (let i = 0; i < 3; i++) hexs[i] = parseInt(hexs[i], 16);
14
+ return hexs;
15
+ };
16
+ const rgbToHex = (r, g, b) => {
17
+ let reg = /^\d{1,3}$/;
18
+ if (!reg.test(r) || !reg.test(g) || !reg.test(b)) {
19
+ ElMessage.warning("\u8F93\u5165\u9519\u8BEF\u7684rgb\u989C\u8272\u503C");
20
+ return "";
21
+ }
22
+ let hexs = [r.toString(16), g.toString(16), b.toString(16)];
23
+ for (let i = 0; i < 3; i++) if (hexs[i].length == 1) hexs[i] = `0${hexs[i]}`;
24
+ return `#${hexs.join("")}`;
25
+ };
26
+ const getDarkColor = (color, level) => {
27
+ let reg = /^\#?[0-9A-Fa-f]{6}$/;
28
+ if (!reg.test(color)) {
29
+ ElMessage.warning("\u8F93\u5165\u9519\u8BEF\u7684hex\u989C\u8272\u503C");
30
+ return "";
31
+ }
32
+ let rgb = useChangeColor().hexToRgb(color);
33
+ for (let i = 0; i < 3; i++) rgb[i] = Math.floor(rgb[i] * (1 - level));
34
+ return useChangeColor().rgbToHex(rgb[0], rgb[1], rgb[2]);
35
+ };
36
+ const getLightColor = (color, level) => {
37
+ let reg = /^\#?[0-9A-Fa-f]{6}$/;
38
+ if (!reg.test(color)) {
39
+ ElMessage.warning("\u8F93\u5165\u9519\u8BEF\u7684hex\u989C\u8272\u503C");
40
+ return "";
41
+ }
42
+ let rgb = useChangeColor().hexToRgb(color);
43
+ for (let i = 0; i < 3; i++) rgb[i] = Math.floor((255 - rgb[i]) * level + rgb[i]);
44
+ return useChangeColor().rgbToHex(rgb[0], rgb[1], rgb[2]);
45
+ };
46
+ return {
47
+ hexToRgb,
48
+ rgbToHex,
49
+ getDarkColor,
50
+ getLightColor
51
+ };
52
+ }
53
+
54
+ export { useChangeColor };