befly-admin-ui 1.48.0 → 1.49.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "befly-admin-ui",
3
- "version": "1.48.0",
3
+ "version": "1.49.0",
4
4
  "gitHead": "071d17be177355cdd61f30659c6e4c5873f87d39",
5
5
  "private": false,
6
6
  "description": "Befly - 管理后台功能组件",
@@ -50,7 +50,7 @@
50
50
  "dependencies": {},
51
51
  "peerDependencies": {
52
52
  "tdesign-icons-vue-next": ">=0.4.0",
53
- "tdesign-vue-next": ">=1.0.0",
53
+ "tdesign-vue-next": ">=1.20.2",
54
54
  "vue": ">=3.0.0",
55
55
  "vue-router": ">=5.0.0"
56
56
  }
@@ -43,20 +43,9 @@
43
43
  <t-col :span="2" class="dashboard-card-col">
44
44
  <div class="dashboard-card">
45
45
  <div class="dashboard-card-content">
46
- <div class="dashboard-card-label">今日访客</div>
46
+ <div class="dashboard-card-label">今日在线</div>
47
47
  <div class="dashboard-card-value-row">
48
- <div class="dashboard-card-main dashboard-card-main--metric dashboard-card-main--success">{{ $Computed.visitTodayCount }}</div>
49
- </div>
50
- </div>
51
- </div>
52
- </t-col>
53
-
54
- <t-col :span="2" class="dashboard-card-col">
55
- <div class="dashboard-card">
56
- <div class="dashboard-card-content">
57
- <div class="dashboard-card-label">当前在线</div>
58
- <div class="dashboard-card-value-row">
59
- <div class="dashboard-card-main dashboard-card-main--metric dashboard-card-main--primary">{{ $Computed.onlineCount }}</div>
48
+ <div class="dashboard-card-main dashboard-card-main--metric dashboard-card-main--success">{{ $Computed.dailyTodayCount }}</div>
60
49
  </div>
61
50
  </div>
62
51
  </div>
@@ -88,14 +77,11 @@ const $Data = reactive({
88
77
  apiCount: 0,
89
78
  roleCount: 0
90
79
  },
91
- infoStats: {
80
+ dailyStats: {
92
81
  today: {
93
82
  count: 0
94
83
  }
95
84
  },
96
- onlineStats: {
97
- onlineCount: 0
98
- },
99
85
  errorStats: {
100
86
  today: {
101
87
  count: 0
@@ -106,11 +92,10 @@ const $Data = reactive({
106
92
  const $Method = {
107
93
  fetchData: async function () {
108
94
  try {
109
- const [overviewRes, infoStatsRes, onlineStatsRes, errorStatsRes] = await Promise.all([$Http("/core/dashboard/systemOverview", {}, [""]), $Http("/core/tongJi/infoStats", {}, [""]), $Http("/core/tongJi/onlineStats", {}, [""]), $Http("/core/tongJi/errorStats", {}, [""])]);
95
+ const [overviewRes, dailyStatsRes, errorStatsRes] = await Promise.all([$Http("/core/dashboard/systemOverview", {}, [""]), $Http("/core/tongJi/dailyStats", {}, [""]), $Http("/core/tongJi/errorStats", {}, [""])]);
110
96
 
111
97
  Object.assign($Data.permissionStats, overviewRes.data);
112
- $Data.infoStats.today.count = Number(infoStatsRes.data?.today?.count || 0);
113
- $Data.onlineStats.onlineCount = Number(onlineStatsRes.data?.onlineCount || 0);
98
+ $Data.dailyStats.today.count = Number(dailyStatsRes.data?.today?.count || 0);
114
99
  $Data.errorStats.today.count = Number(errorStatsRes.data?.today?.count || 0);
115
100
  } catch (_error) {
116
101
  // 静默失败:不阻断页面展示
@@ -119,11 +104,8 @@ const $Method = {
119
104
  };
120
105
 
121
106
  const $Computed = reactive({
122
- visitTodayCount: computed(() => {
123
- return $Data.infoStats.today.count;
124
- }),
125
- onlineCount: computed(() => {
126
- return $Data.onlineStats.onlineCount;
107
+ dailyTodayCount: computed(() => {
108
+ return $Data.dailyStats.today.count;
127
109
  }),
128
110
  errorTodayCount: computed(() => {
129
111
  return $Data.errorStats.today.count;
@@ -14,43 +14,43 @@
14
14
  <t-row :gutter="[16, 16]">
15
15
  <t-col :xs="12" :sm="6" :md="4" :lg="2" class="metric-col">
16
16
  <div class="metric-card">
17
- <span class="metric-label">在线人数</span>
18
- <strong class="metric-value-online">{{ item.onlineCount }}</strong>
17
+ <span class="metric-label">今日在线</span>
18
+ <strong class="metric-value-daily">{{ item.today }}</strong>
19
19
  </div>
20
20
  </t-col>
21
21
 
22
22
  <t-col :xs="12" :sm="6" :md="4" :lg="2" class="metric-col">
23
23
  <div class="metric-card">
24
- <span class="metric-label">今日访客</span>
25
- <strong class="metric-value-visitor">{{ item.today }}</strong>
24
+ <span class="metric-label">昨日在线</span>
25
+ <strong class="metric-value-daily">{{ item.yesterday }}</strong>
26
26
  </div>
27
27
  </t-col>
28
28
 
29
29
  <t-col :xs="12" :sm="6" :md="4" :lg="2" class="metric-col">
30
30
  <div class="metric-card">
31
- <span class="metric-label">昨日访客</span>
32
- <strong class="metric-value-visitor">{{ item.yesterday }}</strong>
31
+ <span class="metric-label">前天在线</span>
32
+ <strong class="metric-value-daily">{{ item.dayBeforeYesterday }}</strong>
33
33
  </div>
34
34
  </t-col>
35
35
 
36
36
  <t-col :xs="12" :sm="6" :md="4" :lg="2" class="metric-col">
37
37
  <div class="metric-card">
38
- <span class="metric-label">前天访客</span>
39
- <strong class="metric-value-visitor">{{ item.dayBeforeYesterday }}</strong>
38
+ <span class="metric-label">近7天在线</span>
39
+ <strong class="metric-value-daily">{{ item.recent7 }}</strong>
40
40
  </div>
41
41
  </t-col>
42
42
 
43
43
  <t-col :xs="12" :sm="6" :md="4" :lg="2" class="metric-col">
44
44
  <div class="metric-card">
45
- <span class="metric-label">近30天访客</span>
46
- <strong class="metric-value-visitor">{{ item.recent30 }}</strong>
45
+ <span class="metric-label">近30天在线</span>
46
+ <strong class="metric-value-daily">{{ item.recent30 }}</strong>
47
47
  </div>
48
48
  </t-col>
49
49
 
50
50
  <t-col :xs="12" :sm="6" :md="4" :lg="2" class="metric-col">
51
51
  <div class="metric-card">
52
- <span class="metric-label">本月访客</span>
53
- <strong class="metric-value-visitor">{{ item.month }}</strong>
52
+ <span class="metric-label">本月在线</span>
53
+ <strong class="metric-value-daily">{{ item.month }}</strong>
54
54
  </div>
55
55
  </t-col>
56
56
  </t-row>
@@ -75,18 +75,17 @@ const $Data = reactive({
75
75
  });
76
76
 
77
77
  const $Method = {
78
- buildProjectRow: function (visitItem, onlineItem) {
78
+ buildProjectRow: function (item) {
79
79
  return {
80
- key: String(visitItem?.key || onlineItem?.key || visitItem?.productCode || onlineItem?.productCode || ""),
81
- productName: String(visitItem?.productName || onlineItem?.productName || "-"),
82
- productCode: String(visitItem?.productCode || onlineItem?.productCode || ""),
83
-
84
- onlineCount: Number(onlineItem?.onlineCount || 0),
85
- today: Number(visitItem?.today || 0),
86
- yesterday: Number(visitItem?.yesterday || 0),
87
- dayBeforeYesterday: Number(visitItem?.dayBeforeYesterday || 0),
88
- recent30: Number(visitItem?.recent30 || 0),
89
- month: Number(visitItem?.month || 0)
80
+ key: String(item?.key || item?.productCode || ""),
81
+ productName: String(item?.productName || "-"),
82
+ productCode: String(item?.productCode || ""),
83
+ today: Number(item?.today || 0),
84
+ yesterday: Number(item?.yesterday || 0),
85
+ dayBeforeYesterday: Number(item?.dayBeforeYesterday || 0),
86
+ recent7: Number(item?.recent7 || 0),
87
+ recent30: Number(item?.recent30 || 0),
88
+ month: Number(item?.month || 0)
90
89
  };
91
90
  },
92
91
  formatProductTitle: function (row) {
@@ -99,33 +98,11 @@ const $Method = {
99
98
 
100
99
  return productName || productCode || "-";
101
100
  },
102
- mapProjectRows: function (infoStatsData, onlineStatsData) {
103
- const onlineMap = new Map();
104
-
105
- for (const item of onlineStatsData?.products || []) {
106
- onlineMap.set(String(item?.productCode || item?.key || ""), item);
107
- }
108
-
109
- const rows = [];
110
-
111
- for (const item of infoStatsData?.products || []) {
112
- const productCode = String(item?.productCode || item?.key || "");
113
- rows.push($Method.buildProjectRow(item, onlineMap.get(productCode)));
114
- onlineMap.delete(productCode);
115
- }
116
-
117
- for (const item of onlineMap.values()) {
118
- rows.push($Method.buildProjectRow(null, item));
119
- }
120
-
121
- return rows.filter((item) => {
122
- return Boolean(item.key);
123
- });
124
- },
125
101
  fetchData: async function () {
126
102
  try {
127
- const [infoStatsRes, onlineStatsRes] = await Promise.all([$Http("/core/tongJi/infoStats", {}, [""]), $Http("/core/tongJi/onlineStats", {}, [""])]);
128
- $Data.productState.options = $Method.mapProjectRows(infoStatsRes.data, onlineStatsRes.data);
103
+ const dailyStatsRes = await $Http("/core/tongJi/dailyStats", {}, [""]);
104
+
105
+ $Data.productState.options = (dailyStatsRes.data?.products || []).map((item) => $Method.buildProjectRow(item)).filter((item) => Boolean(item.key));
129
106
  } catch (_error) {
130
107
  // 静默失败:不阻断页面展示
131
108
  }
@@ -183,10 +160,12 @@ $Method.fetchData();
183
160
  @include dashboardCard.dashboardCardLabel();
184
161
  }
185
162
 
186
- .metric-value-online {
187
- @include dashboardCard.dashboardCardNumericValue(var(--error-color));
163
+ .metric-value-daily {
164
+ @include dashboardCard.dashboardCardNumericValue(var(--success-color));
188
165
 
189
- color: var(--error-color);
166
+ color: var(--success-color);
167
+ text-align: left;
168
+ white-space: nowrap;
190
169
  }
191
170
 
192
171
  .metric-card {
@@ -201,12 +180,4 @@ $Method.fetchData();
201
180
  justify-content: flex-start;
202
181
  padding: 12px;
203
182
  }
204
-
205
- .metric-value-visitor {
206
- @include dashboardCard.dashboardCardNumericValue(var(--success-color));
207
-
208
- color: var(--success-color);
209
- text-align: left;
210
- white-space: nowrap;
211
- }
212
183
  </style>