@fmdevui/fm-dev 1.0.4 → 1.0.5

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