befly-admin 4.0.18 → 4.1.0
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.
- package/package.json +5 -5
- package/src/plugins/report.js +38 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "befly-admin",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"gitHead": "282f7accca9c8d55956a5490c0365cce4a1ad90d",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "Befly Admin - 基于 Vue3 + TDesign Vue Next 的后台管理系统",
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
"preview": "bunx --bun befly-vite preview"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"befly-admin-ui": "^1.
|
|
32
|
-
"befly-shared": "^2.0
|
|
33
|
-
"befly-vite": "^1.
|
|
31
|
+
"befly-admin-ui": "^1.11.0",
|
|
32
|
+
"befly-shared": "^2.1.0",
|
|
33
|
+
"befly-vite": "^1.8.0",
|
|
34
34
|
"pinia": "^3.0.4",
|
|
35
35
|
"tdesign-icons-vue-next": "^0.4.4",
|
|
36
36
|
"tdesign-vue-next": "^1.20.0",
|
|
37
|
-
"vue": "^3.5.
|
|
37
|
+
"vue": "^3.5.35",
|
|
38
38
|
"vue-router": "^5.0.7"
|
|
39
39
|
},
|
|
40
40
|
"engines": {
|
package/src/plugins/report.js
CHANGED
|
@@ -5,6 +5,7 @@ import { $Router } from "@/plugins/router.js";
|
|
|
5
5
|
const ONLINE_REPORT_MIN_GAP = 15 * 1000;
|
|
6
6
|
const ONLINE_REPORT_HEARTBEAT_INTERVAL = 60 * 1000;
|
|
7
7
|
const ERROR_REPORT_DEDUP_GAP = 3000;
|
|
8
|
+
const ONLINE_REPORT_CLIENT_ID_KEY = "befly-online-client-id";
|
|
8
9
|
|
|
9
10
|
let onlineReportHeartbeatStarted = false;
|
|
10
11
|
let lastOnlineReportTime = 0;
|
|
@@ -15,11 +16,48 @@ let lastErrorKey = "";
|
|
|
15
16
|
let lastErrorTime = 0;
|
|
16
17
|
let fetchWrapped = false;
|
|
17
18
|
|
|
19
|
+
function generateOnlineClientId() {
|
|
20
|
+
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
21
|
+
return crypto.randomUUID();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return `${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function getOnlineClientId() {
|
|
28
|
+
if (typeof window === "undefined") {
|
|
29
|
+
return "";
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
let clientId = "";
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
clientId = String(window.localStorage.getItem(ONLINE_REPORT_CLIENT_ID_KEY) || "").trim();
|
|
36
|
+
} catch {
|
|
37
|
+
clientId = "";
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (clientId) {
|
|
41
|
+
return clientId;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
clientId = generateOnlineClientId();
|
|
45
|
+
|
|
46
|
+
try {
|
|
47
|
+
window.localStorage.setItem(ONLINE_REPORT_CLIENT_ID_KEY, clientId);
|
|
48
|
+
} catch {
|
|
49
|
+
// ignore
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return clientId;
|
|
53
|
+
}
|
|
54
|
+
|
|
18
55
|
function getRouteReportData(route) {
|
|
19
56
|
return {
|
|
20
57
|
pagePath: route?.fullPath || route?.path || "",
|
|
21
58
|
pageName: String(route?.name || route?.meta?.title || route?.path || ""),
|
|
22
59
|
source: "admin",
|
|
60
|
+
clientId: getOnlineClientId(),
|
|
23
61
|
productName: $Config.productName,
|
|
24
62
|
productCode: $Config.productCode,
|
|
25
63
|
productVersion: $Config.productVersion
|