Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
3c2470a3
authored
Sep 12, 2025
by
Jony.L
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
首页统计3.0 顶部导航栏统计 当天的新增用户、新增订单、新增订单金额
parent
e4c9cee2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
18 deletions
+24
-18
src/api/Home/count/index.ts
+6
-0
src/views/Home/Index.vue
+18
-18
No files found.
src/api/Home/count/index.ts
View file @
3c2470a3
...
@@ -27,4 +27,10 @@ export const getApiCallsData = async(dateType) => {
...
@@ -27,4 +27,10 @@ export const getApiCallsData = async(dateType) => {
})
})
}
}
export
const
getTopBarData
=
async
()
=>
{
return
await
request
.
get
({
url
:
`/index/count/getTopBarData`
,
})
}
src/views/Home/Index.vue
View file @
3c2470a3
...
@@ -21,31 +21,31 @@
...
@@ -21,31 +21,31 @@
<el-col
:xl=
"12"
:lg=
"12"
:md=
"12"
:sm=
"24"
:xs=
"24"
>
<el-col
:xl=
"12"
:lg=
"12"
:md=
"12"
:sm=
"24"
:xs=
"24"
>
<div
class=
"h-70px flex items-center justify-end lt-sm:mt-10px"
>
<div
class=
"h-70px flex items-center justify-end lt-sm:mt-10px"
>
<div
class=
"px-8px text-right"
>
<div
class=
"px-8px text-right"
>
<div
class=
"mb-16px text-14px text-gray-400"
>
{{
t
(
'workplace.project'
)
}}
</div>
<div
class=
"mb-16px text-14px text-gray-400"
>
{{
'今日新增用户'
}}
</div>
<CountTo
<CountTo
class=
"text-20px"
class=
"text-20px"
:start-val=
"0"
:start-val=
"0"
:end-val=
"to
talSate.projec
t"
:end-val=
"to
dayData.newUsersCoun
t"
:duration=
"2600"
:duration=
"2600"
/>
/>
</div>
</div>
<el-divider
direction=
"vertical"
/>
<el-divider
direction=
"vertical"
/>
<div
class=
"px-8px text-right"
>
<div
class=
"px-8px text-right"
>
<div
class=
"mb-16px text-14px text-gray-400"
>
{{
t
(
'workplace.toDo'
)
}}
</div>
<div
class=
"mb-16px text-14px text-gray-400"
>
{{
'今日订单'
}}
</div>
<CountTo
<CountTo
class=
"text-20px"
class=
"text-20px"
:start-val=
"0"
:start-val=
"0"
:end-val=
"to
talSate.todo
"
:end-val=
"to
dayData.newOrdersCount
"
:duration=
"2600"
:duration=
"2600"
/>
/>
</div>
</div>
<el-divider
direction=
"vertical"
border-style=
"dashed"
/>
<el-divider
direction=
"vertical"
border-style=
"dashed"
/>
<div
class=
"px-8px text-right"
>
<div
class=
"px-8px text-right"
>
<div
class=
"mb-16px text-14px text-gray-400"
>
{{
t
(
'workplace.access'
)
}}
</div>
<div
class=
"mb-16px text-14px text-gray-400"
>
{{
'今日订单金额'
}}
</div>
<CountTo
<CountTo
class=
"text-20px"
class=
"text-20px"
:start-val=
"0"
:start-val=
"0"
:end-val=
"to
talSate.access
"
:end-val=
"to
dayData.newOrdersAmount
"
:duration=
"2600"
:duration=
"2600"
/>
/>
</div>
</div>
...
@@ -133,6 +133,7 @@ import type {WorkplaceTotal} from './types'
...
@@ -133,6 +133,7 @@ import type {WorkplaceTotal} from './types'
import
{
useRouter
}
from
'vue-router'
import
{
useRouter
}
from
'vue-router'
import
{
useI18n
}
from
'vue-i18n'
// 确保导入i18n
import
{
useI18n
}
from
'vue-i18n'
// 确保导入i18n
import
*
as
IndexCountApi
from
"@/api/Home/count"
;
import
*
as
IndexCountApi
from
"@/api/Home/count"
;
import
Index
from
"@/views/ai/music/index/index.vue"
;
defineOptions
({
name
:
'Index'
})
defineOptions
({
name
:
'Index'
})
...
@@ -166,10 +167,10 @@ const changeOrderDateType = () => {
...
@@ -166,10 +167,10 @@ const changeOrderDateType = () => {
}
}
// 统计数据
// 统计数据
const
to
talSate
=
reactive
<
WorkplaceTotal
>
({
const
to
dayData
=
reactive
<
WorkplaceTotal
>
({
projec
t
:
0
,
newUsersCoun
t
:
0
,
access
:
0
,
newOrdersCount
:
0
,
todo
:
0
newOrdersAmount
:
0
})
})
// 用户数柱状图配置
// 用户数柱状图配置
...
@@ -329,7 +330,6 @@ const orderChartOptions = ref<EChartsOption>({
...
@@ -329,7 +330,6 @@ const orderChartOptions = ref<EChartsOption>({
const
getOrderChartData
=
async
(
orderDateType
)
=>
{
const
getOrderChartData
=
async
(
orderDateType
)
=>
{
let
ordersData
=
await
IndexCountApi
.
getOrdersData
(
orderDateType
);
let
ordersData
=
await
IndexCountApi
.
getOrdersData
(
orderDateType
);
orderChartOptions
.
value
.
xAxis
!
.
data
=
ordersData
.
map
(
item
=>
t
(
item
.
countDate
))
orderChartOptions
.
value
.
xAxis
!
.
data
=
ordersData
.
map
(
item
=>
t
(
item
.
countDate
))
orderChartOptions
.
value
.
series
!
[
0
].
data
=
ordersData
.
map
(
item
=>
item
.
computeOrdersCount
)
orderChartOptions
.
value
.
series
!
[
0
].
data
=
ordersData
.
map
(
item
=>
item
.
computeOrdersCount
)
orderChartOptions
.
value
.
series
!
[
1
].
data
=
ordersData
.
map
(
item
=>
item
.
apiOrdersCount
)
orderChartOptions
.
value
.
series
!
[
1
].
data
=
ordersData
.
map
(
item
=>
item
.
apiOrdersCount
)
...
@@ -353,13 +353,13 @@ const initData = async () => {
...
@@ -353,13 +353,13 @@ const initData = async () => {
// 获取统计数
// 获取统计数
const
getCount
=
async
()
=>
{
const
getCount
=
async
()
=>
{
// 模拟接口数据
// 模拟接口数据
const
data
=
{
// const data = {
project
:
40
,
// newUsersCount: 10,
access
:
2340
,
// newOrdersCount: 40,
todo
:
10
// newOrdersAmount: 2340
}
// }
Object
.
assign
(
totalSate
,
data
)
let
res
=
await
IndexCountApi
.
getTopBarData
()
Object
.
assign
(
todayData
,
res
)
}
}
// 页面加载时初始化
initData
()
initData
()
</
script
>
</
script
>
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