Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
ef81aeb4
Commit
ef81aeb4
authored
Dec 19, 2025
by
shaw
Browse files
fix: 修复dashboard页面用户名的显示bug
parent
22414326
Changes
2
Hide whitespace changes
Inline
Side-by-side
frontend/src/types/index.ts
View file @
ef81aeb4
...
@@ -541,7 +541,7 @@ export interface ModelStat {
...
@@ -541,7 +541,7 @@ export interface ModelStat {
export
interface
UserUsageTrendPoint
{
export
interface
UserUsageTrendPoint
{
date
:
string
;
date
:
string
;
user_id
:
number
;
user_id
:
number
;
username
:
string
;
email
:
string
;
requests
:
number
;
requests
:
number
;
tokens
:
number
;
tokens
:
number
;
cost
:
number
;
// 标准计费
cost
:
number
;
// 标准计费
...
...
frontend/src/views/admin/DashboardView.vue
View file @
ef81aeb4
...
@@ -462,13 +462,21 @@ const trendChartData = computed(() => {
...
@@ -462,13 +462,21 @@ const trendChartData = computed(() => {
const
userTrendChartData
=
computed
(()
=>
{
const
userTrendChartData
=
computed
(()
=>
{
if
(
!
userTrend
.
value
?.
length
)
return
null
if
(
!
userTrend
.
value
?.
length
)
return
null
// Extract display name from email (part before @)
const
getDisplayName
=
(
email
:
string
,
userId
:
number
):
string
=>
{
if
(
email
&&
email
.
includes
(
'
@
'
))
{
return
email
.
split
(
'
@
'
)[
0
]
}
return
`User #
${
userId
}
`
}
// Group by user
// Group by user
const
userGroups
=
new
Map
<
string
,
{
name
:
string
;
data
:
Map
<
string
,
number
>
}
>
()
const
userGroups
=
new
Map
<
string
,
{
name
:
string
;
data
:
Map
<
string
,
number
>
}
>
()
const
allDates
=
new
Set
<
string
>
()
const
allDates
=
new
Set
<
string
>
()
userTrend
.
value
.
forEach
(
point
=>
{
userTrend
.
value
.
forEach
(
point
=>
{
allDates
.
add
(
point
.
date
)
allDates
.
add
(
point
.
date
)
const
key
=
point
.
username
||
`User #
${
point
.
user_id
}
`
const
key
=
getDisplayName
(
point
.
email
,
point
.
user_id
)
if
(
!
userGroups
.
has
(
key
))
{
if
(
!
userGroups
.
has
(
key
))
{
userGroups
.
set
(
key
,
{
name
:
key
,
data
:
new
Map
()
})
userGroups
.
set
(
key
,
{
name
:
key
,
data
:
new
Map
()
})
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment