Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
evm-store
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wanli
evm-store
Commits
4bf4dc0b
Commit
4bf4dc0b
authored
Jul 23, 2021
by
wanli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
feat(): 新增统计功能,完成前后端开发
parent
497be17d
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
410 additions
and
216 deletions
+410
-216
tools/build_out/application/signal_manager.py
tools/build_out/application/signal_manager.py
+3
-1
tools/build_out/controllers/__init__.py
tools/build_out/controllers/__init__.py
+3
-1
tools/build_out/controllers/workbench.py
tools/build_out/controllers/workbench.py
+74
-2
tools/build_out/views/__init__.py
tools/build_out/views/__init__.py
+2
-1
tools/build_out/views/openapi.py
tools/build_out/views/openapi.py
+24
-11
tools/frontend/src/api/openapi.js
tools/frontend/src/api/openapi.js
+8
-1
tools/frontend/src/components/GlobalHeader/RightContent.vue
tools/frontend/src/components/GlobalHeader/RightContent.vue
+62
-65
tools/frontend/src/defaultSettings.js
tools/frontend/src/defaultSettings.js
+5
-5
tools/frontend/src/locales/zh_CN.js
tools/frontend/src/locales/zh_CN.js
+8
-8
tools/frontend/src/store/modules/global-nav.js
tools/frontend/src/store/modules/global-nav.js
+0
-8
tools/frontend/src/views/Dashboard/Analysis.vue
tools/frontend/src/views/Dashboard/Analysis.vue
+221
-113
No files found.
tools/build_out/application/signal_manager.py
View file @
4bf4dc0b
'''
Author: your name
Date: 2021-06-30 18:03:41
LastEditTime: 2021-07-2
0 17:12:57
LastEditTime: 2021-07-2
3 00:26:38
LastEditors: Please set LastEditors
Description: In User Settings Edit
FilePath:
\
evm-store
\t
ools
\b
uild_out
\a
pplication
\
signal_manager.py
...
...
@@ -73,6 +73,8 @@ class SignalManager(object):
actionGetEpk
=
PySignal
()
actionApplicationBuild
=
PySignal
()
actionCheckVersion
=
PySignal
()
# workbench
actionWorkbench
=
PySignal
()
def
__init__
(
self
):
super
()
.
__init__
()
...
...
tools/build_out/controllers/__init__.py
View file @
4bf4dc0b
'''
Author: your name
Date: 2021-06-30 17:43:46
LastEditTime: 2021-07-2
0 17:13:15
LastEditTime: 2021-07-2
3 00:27:31
LastEditors: Please set LastEditors
Description: In User Settings Edit
FilePath:
\
evm-store
\t
ools
\b
uild_out
\
controllers
\
__init__.py
...
...
@@ -25,6 +25,7 @@ from .monitorLvgl import monitorLvglManager
from
.monitorImage
import
monitorImageManager
from
.monitorEvm
import
monitorEvmManager
from
.file
import
fileManager
from
.workbench
import
workbenchResource
def
initConnect
():
signalManager
.
actionPostArea
.
connect
(
areaManager
.
post
)
...
...
@@ -87,3 +88,4 @@ def initConnect():
signalManager
.
actionGetApplication
.
connect
(
appReview
.
getApp
)
signalManager
.
actionGetEpk
.
connect
(
appReview
.
getDownloadFile
)
signalManager
.
actionCheckVersion
.
connect
(
appReview
.
checkAppVersion
)
signalManager
.
actionWorkbench
.
connect
(
workbenchResource
.
get
)
tools/build_out/controllers/workbench.py
View file @
4bf4dc0b
'''
Author: your name
Date: 2021-07-22 04:03:24
LastEditTime: 2021-07-2
2 18:58:34
LastEditTime: 2021-07-2
3 00:51:58
LastEditors: Please set LastEditors
Description: In User Settings Edit
FilePath:
\
evm-store
\t
ools
\b
uild_out
\
controllers
\
workbench.py
'''
import
datetime
from
models.user
import
UserModel
from
datetime
import
datetime
,
timedelta
from
models.device
import
DeviceModel
from
models.app
import
AppModel
from
models.package
import
PackageModel
from
webcreator.log
import
logger
from
webcreator.response
import
ResponseCode
# 今日上传应用数 、历史应用总数
# 今日打包次数、历史打包总数
# 今日新增设备数,绑定设备数
# 今日新增开发者,开发者总数
'''
time_now = datetime.now()
#最近30天数据
result = UserModel.query.filter(UserModel.create_time >= time_now - timedelta(days=30)).all()
...
...
@@ -21,3 +31,65 @@ result = UserModel.query.filter(UserModel.create_time >= time_now - timedelta(da
result = UserModel.query.filter(UserModel.create_time >= time_now - timedelta(hours=12)).all()
#最近半小时
result = UserModel.query.filter(UserModel.create_time >= time_now - timedelta(seconds=30)).all()
'''
class
WorkbenchResource
(
object
):
def
__init__
(
self
):
super
()
.
__init__
()
def
get
(
self
,
jwt
=
{}):
if
not
jwt
:
return
None
,
ResponseCode
.
HTTP_INVAILD_REQUEST
user
=
UserModel
.
query
.
filter
(
UserModel
.
uuid
==
jwt
.
get
(
"uuid"
))
.
one_or_none
()
if
not
user
:
return
None
,
ResponseCode
.
USER_NOT_EXISTS
today
=
datetime
.
date
.
today
()
tomorrow
=
today
+
datetime
.
timedelta
(
days
=
1
)
logger
.
info
(
user
.
role
)
if
user
.
role
==
1
:
total_user
=
UserModel
.
query
.
filter
()
.
count
()
today_user
=
UserModel
.
query
.
filter
(
UserModel
.
create_at
>=
today
.
strftime
(
"
%
Y-
%
m-
%
d 00:00:00"
),
UserModel
.
create_at
<=
tomorrow
.
strftime
(
"
%
Y-
%
m-
%
d 00:00:00"
))
.
count
()
total_device
=
DeviceModel
.
query
.
filter
()
.
count
()
today_device
=
DeviceModel
.
query
.
filter
(
DeviceModel
.
create_at
>=
today
.
strftime
(
"
%
Y-
%
m-
%
d 00:00:00"
),
DeviceModel
.
create_at
<=
tomorrow
.
strftime
(
"
%
Y-
%
m-
%
d 00:00:00"
))
.
count
()
total_app
=
AppModel
.
query
.
filter
()
.
count
()
today_app
=
AppModel
.
query
.
filter
(
AppModel
.
create_at
>=
today
.
strftime
(
"
%
Y-
%
m-
%
d 00:00:00"
),
AppModel
.
create_at
<=
tomorrow
.
strftime
(
"
%
Y-
%
m-
%
d 00:00:00"
))
.
count
()
total_package
=
PackageModel
.
query
.
filter
()
.
count
()
today_package
=
PackageModel
.
query
.
filter
(
PackageModel
.
create_at
>=
today
.
strftime
(
"
%
Y-
%
m-
%
d 00:00:00"
),
PackageModel
.
create_at
<=
tomorrow
.
strftime
(
"
%
Y-
%
m-
%
d 00:00:00"
))
.
count
()
else
:
total_user
=
UserModel
.
query
.
filter
(
UserModel
.
create_by
==
user
.
id
)
.
count
()
today_user
=
UserModel
.
query
.
filter
(
UserModel
.
create_by
==
user
.
id
,
UserModel
.
create_at
>=
today
.
strftime
(
"
%
Y-
%
m-
%
d 00:00:00"
),
UserModel
.
create_at
<=
tomorrow
.
strftime
(
"
%
Y-
%
m-
%
d 00:00:00"
))
.
count
()
total_device
=
DeviceModel
.
query
.
filter
(
DeviceModel
.
create_by
==
user
.
id
)
.
count
()
today_device
=
DeviceModel
.
query
.
filter
(
DeviceModel
.
create_by
==
user
.
id
,
DeviceModel
.
create_at
>=
today
.
strftime
(
"
%
Y-
%
m-
%
d 00:00:00"
),
DeviceModel
.
create_at
<=
tomorrow
.
strftime
(
"
%
Y-
%
m-
%
d 00:00:00"
))
.
count
()
total_app
=
AppModel
.
query
.
filter
(
AppModel
.
create_by
==
user
.
id
)
.
count
()
today_app
=
AppModel
.
query
.
filter
(
AppModel
.
create_by
==
user
.
id
,
AppModel
.
create_at
>=
today
.
strftime
(
"
%
Y-
%
m-
%
d 00:00:00"
),
AppModel
.
create_at
<=
tomorrow
.
strftime
(
"
%
Y-
%
m-
%
d 00:00:00"
))
.
count
()
total_package
=
PackageModel
.
query
.
filter
(
PackageModel
.
create_by
==
user
.
id
)
.
count
()
today_package
=
PackageModel
.
query
.
filter
(
PackageModel
.
create_by
==
user
.
id
,
PackageModel
.
create_at
>=
today
.
strftime
(
"
%
Y-
%
m-
%
d 00:00:00"
),
PackageModel
.
create_at
<=
tomorrow
.
strftime
(
"
%
Y-
%
m-
%
d 00:00:00"
))
.
count
()
result
=
{
'total_user'
:
total_user
,
'today_user'
:
today_user
,
'total_device'
:
total_device
,
'today_device'
:
today_device
,
'total_app'
:
total_app
,
'today_app'
:
today_app
,
'total_package'
:
total_package
,
'today_package'
:
today_package
}
logger
.
info
(
result
)
return
result
,
ResponseCode
.
HTTP_SUCCESS
workbenchResource
=
WorkbenchResource
()
\ No newline at end of file
tools/build_out/views/__init__.py
View file @
4bf4dc0b
'''
Author: your name
Date: 2021-07-15 03:22:19
LastEditTime: 2021-07-2
2 18:51:05
LastEditTime: 2021-07-2
3 00:32:33
LastEditors: Please set LastEditors
Description: In User Settings Edit
FilePath:
\
evm-store
\t
ools
\b
uild_out
\v
iews
\
__init__.py
...
...
@@ -41,6 +41,7 @@ api.add_resource(app.AppResourceList, '/app')
api
.
add_resource
(
openapi
.
AppReviewResource
,
'/api/app-review'
)
api
.
add_resource
(
openapi
.
CStringToolResource
,
'/api/convert-to-c-string'
)
api
.
add_resource
(
openapi
.
BuildAppResource
,
'/evm_store/application/build'
)
api
.
add_resource
(
openapi
.
Workbench
,
'/api/workbench'
)
api
.
add_resource
(
openapi
.
App
,
'/api/app'
)
api
.
add_resource
(
openapi
.
AppInfo
,
'/api/app-info'
)
api
.
add_resource
(
openapi
.
LauncherResource
,
'/api/app-launcher'
)
...
...
tools/build_out/views/openapi.py
View file @
4bf4dc0b
'''
Author: your name
Date: 2021-07-19 14:29:33
LastEditTime: 2021-07-2
2 18:47:43
LastEditTime: 2021-07-2
3 00:37:20
LastEditors: Please set LastEditors
Description: In User Settings Edit
FilePath:
\
evm-store
\t
ools
\b
uild_out
\v
iews
\a
pi.py
...
...
@@ -107,6 +107,8 @@ class BuildAppResource(Resource):
def
get
(
self
):
try
:
return
ResponseCode
.
HTTP_SUCCESS
result
=
db
.
session
.
query
(
AnnexModel
)
.
all
()
for
item
in
result
:
item
.
uuid
=
uuid
.
uuid1
()
.
hex
...
...
@@ -419,8 +421,6 @@ class ObfuscatedCode(Resource):
return
response_result
(
ResponseCode
.
HTTP_SERVER_ERROR
,
data
=
data
)
# 获取启动器接口
class
LauncherResource
(
Resource
):
def
__init__
(
self
)
->
None
:
super
()
.
__init__
()
...
...
@@ -455,8 +455,6 @@ class LauncherResource(Resource):
return
response_result
(
ResponseCode
.
HTTP_SERVER_ERROR
,
data
=
data
)
# 获取App列表接口
class
AppListResource
(
Resource
):
def
__init__
(
self
)
->
None
:
super
()
.
__init__
()
...
...
@@ -537,8 +535,6 @@ class AppListResource(Resource):
return
response_result
(
ResponseCode
.
HTTP_SERVER_ERROR
,
data
=
data
)
# 获取应用接口
class
App
(
Resource
):
def
__init__
(
self
)
->
None
:
super
()
.
__init__
()
...
...
@@ -575,8 +571,6 @@ class App(Resource):
return
response_result
(
ResponseCode
.
HTTP_SERVER_ERROR
,
data
=
data
)
# 获取应用信息接口
class
AppInfo
(
Resource
):
def
__init__
(
self
)
->
None
:
super
()
.
__init__
()
...
...
@@ -611,8 +605,6 @@ class AppInfo(Resource):
return
response_result
(
ResponseCode
.
HTTP_SERVER_ERROR
,
data
=
data
)
# 下载EPK文件接口
class
DownloadEpk
(
Resource
):
def
__init__
(
self
)
->
None
:
super
()
.
__init__
()
...
...
@@ -678,3 +670,24 @@ class DownloadApp(Resource):
data
=
e
.
args
current_app
.
logger
.
error
(
e
)
return
response_result
(
ResponseCode
.
HTTP_SERVER_ERROR
,
data
=
data
)
class
Workbench
(
Resource
):
def
__init__
(
self
)
->
None
:
super
()
.
__init__
()
self
.
parser
=
RequestParser
()
@
jwt_required
(
locations
=
[
"headers"
])
def
get
(
self
):
# 特殊参数,即不是从json获取参数的接口,可以将这个注释打开
# self.parser.add_argument("page", type=int, location="args", default=1)
self
.
parser
.
add_argument
(
"string"
,
type
=
str
,
location
=
"json"
,
required
=
False
)
args
=
self
.
parser
.
parse_args
()
try
:
jwt
=
get_jwt_identity
()
result
,
message
=
signalManager
.
actionWorkbench
.
emit
(
jwt
)
return
response_result
(
message
,
data
=
result
)
except
Exception
as
e
:
traceback
.
print_exc
()
current_app
.
logger
.
error
(
e
)
return
response_result
(
ResponseCode
.
HTTP_SERVER_ERROR
)
\ No newline at end of file
tools/frontend/src/api/openapi.js
View file @
4bf4dc0b
/*
* @Author: your name
* @Date: 2021-07-15 09:33:39
* @LastEditTime: 2021-07-2
2 18:53:32
* @LastEditTime: 2021-07-2
3 00:35:38
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \evm-store\tools\frontend\src\api\openapi.js
...
...
@@ -15,6 +15,13 @@ export function menuNav() {
})
}
export
function
workbench
()
{
return
request
({
url
:
"
/api/v1/api/workbench
"
,
method
:
'
get
'
})
}
export
function
getWatchList
()
{
return
request
({
url
:
"
/api/v1/monitor/watch
"
,
...
...
tools/frontend/src/components/GlobalHeader/RightContent.vue
View file @
4bf4dc0b
...
...
@@ -13,14 +13,14 @@
<a-menu
slot=
"overlay"
@
click=
"handleMenuClick"
>
<a-menu-item
key=
"gitee"
>
<a
target=
"_blank"
href=
"https://gitee.com/scriptiot/evm"
>
<a-icon
type=
"slack-square"
theme=
"outlined"
/>
Gitee
<a-icon
type=
"slack-square"
theme=
"outlined"
/>
Gitee
</a>
</a-menu-item>
<a-menu-item
key=
"github"
>
<a
target=
"_blank"
href=
"https://github.com/scriptiot/evm"
>
<a-icon
type=
"github"
/>
Github
<a-icon
type=
"github"
/>
Github
</a>
</a-menu-item>
</a-menu>
...
...
@@ -28,27 +28,11 @@
<a-notice-icon
class=
"ai-notice"
className=
"action"
:count=
"
8
"
:count=
"
msgCount
"
:loading=
"false"
>
<a-notice-icon-tab
:list=
"[
{
id: '000000001',
avatar:
'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png',
title: '你收到了 14 份新周报',
datetime: '2017-08-09',
},
{
id: '000000002',
avatar:
'https://gw.alipayobjects.com/zos/rmsportal/OKJXDXrmkNshAMvwtvhu.png',
title: '你推荐的 曲妮妮 已通过第三轮面试',
datetime: '2017-08-08',
read: true,
},
]"
:list=
"msgList"
title=
"通知"
emptyText=
"你已查看所有通知"
emptyImage=
"https://gw.alipayobjects.com/zos/rmsportal/wAhyIChODzsoKIOBHcBk.svg"
...
...
@@ -60,39 +44,7 @@
emptyImage=
"https://gw.alipayobjects.com/zos/rmsportal/sAuJeJzSKbUmHfBQRzmZ.svg"
/>
<a-notice-icon-tab
:list=
"[
{
id: '000000009',
title: '任务名称',
description: '任务需要在 2017-01-12 20:00 前启动',
extra: '未开始',
status: 'todo',
},
{
id: '000000010',
title: '第三方紧急代码变更',
description:
'冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务',
extra: '马上到期',
read: true,
status: 'urgent',
},
{
id: '000000011',
title: '信息安全考试',
description: '指派竹尔于 2017-01-09 前完成更新并发布',
extra: '已耗时 8 天',
status: 'doing',
},
{
id: '000000012',
title: 'ABCD 版本发布',
description:
'冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务',
extra: '进行中',
status: 'processing',
},
]"
:list=
"todoList"
title=
"待办"
emptyText=
"你已完成所有待办"
emptyImage=
"https://gw.alipayobjects.com/zos/rmsportal/HsIsxMZiWKrNUavQUXqx.svg"
...
...
@@ -169,6 +121,57 @@ import SettingDrawer from "@/components/SettingDrawer";
export
default
{
data
:
()
=>
({
collapse
:
false
,
msgCount
:
null
,
msgList
:
[
// {
// id: "000000001",
// avatar:
// "https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png",
// title: "你收到了 14 份新周报",
// datetime: "2017-08-09",
// },
// {
// id: "000000002",
// avatar:
// "https://gw.alipayobjects.com/zos/rmsportal/OKJXDXrmkNshAMvwtvhu.png",
// title: "你推荐的 曲妮妮 已通过第三轮面试",
// datetime: "2017-08-08",
// read: true,
// },
],
todoList
:
[
// {
// id: "000000009",
// title: "任务名称",
// description: "任务需要在 2017-01-12 20:00 前启动",
// extra: "未开始",
// status: "todo",
// },
// {
// id: "000000010",
// title: "第三方紧急代码变更",
// description:
// "冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务",
// extra: "马上到期",
// read: true,
// status: "urgent",
// },
// {
// id: "000000011",
// title: "信息安全考试",
// description: "指派竹尔于 2017-01-09 前完成更新并发布",
// extra: "已耗时 8 天",
// status: "doing",
// },
// {
// id: "000000012",
// title: "ABCD 版本发布",
// description:
// "冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务",
// extra: "进行中",
// status: "processing",
// },
],
}),
components
:
{
ATooltip
:
Tooltip
,
...
...
@@ -190,15 +193,9 @@ export default {
},
handleMenuClick
(
e
)
{
if
(
e
.
key
===
"
gitee
"
)
{
window
.
open
(
"
https://gitee.com/scriptiot/evm
"
,
"
_blank
"
);
window
.
open
(
"
https://gitee.com/scriptiot/evm
"
,
"
_blank
"
);
}
else
{
window
.
open
(
"
https://gitee.com/scriptiot/evm
"
,
"
_blank
"
);
window
.
open
(
"
https://gitee.com/scriptiot/evm
"
,
"
_blank
"
);
}
},
logout
()
{
...
...
@@ -227,8 +224,8 @@ export default {
return
className
;
},
userinfo
()
{
return
this
.
$store
.
state
.
frontend
.
login
.
userinfo
}
return
this
.
$store
.
state
.
frontend
.
login
.
userinfo
;
}
,
},
};
</
script
>
tools/frontend/src/defaultSettings.js
View file @
4bf4dc0b
/*
* @Author: your name
* @Date: 2021-07-15 09:33:39
* @LastEditTime: 2021-07-22
19:26:5
9
* @LastEditTime: 2021-07-22
23:16:0
9
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \evm-store\tools\frontend\src\defaultSettings.js
...
...
@@ -10,10 +10,10 @@ export default {
navTheme
:
'
dark
'
,
// theme for nav menu
primaryColor
:
'
#1890FF
'
,
// primary color of ant design
layout
:
'
sidemenu
'
,
// nav menu position: sidemenu or topmenu
contentWidth
:
'
F
ixe
d
'
,
// layout of content: Fluid or Fixed, only works when layout is topmenu
fixedHeader
:
tru
e
,
// sticky header
autoHideHeader
:
tru
e
,
// auto hide header
fixSiderbar
:
tru
e
,
// sticky siderbar
contentWidth
:
'
F
lui
d
'
,
// layout of content: Fluid or Fixed, only works when layout is topmenu
fixedHeader
:
fals
e
,
// sticky header
autoHideHeader
:
fals
e
,
// auto hide header
fixSiderbar
:
fals
e
,
// sticky siderbar
leftMenuTitle
:
"
EVM 应用商店
"
,
// 左侧边栏顶部名称
leftMenuIcon
:
""
,
// 左侧边栏顶部Logo
appSlogan
:
"
EVM,致力于为互联网行业提供物联网解决方案
"
,
// 应用宣传文案
...
...
tools/frontend/src/locales/zh_CN.js
View file @
4bf4dc0b
...
...
@@ -62,17 +62,17 @@ export default {
'
app.home.introduce
'
:
'
介绍
'
,
'
app.analysis.test
'
:
'
工专路 {no} 号店
'
,
'
app.analysis.introduce
'
:
'
指标说明
'
,
'
app.analysis.total-sales
'
:
'
总销售额
'
,
'
app.analysis.day-sales
'
:
'
日销售额
'
,
'
app.analysis.visits
'
:
'
访问量
'
,
'
app.analysis.total-sales
'
:
'
应用总数
'
,
'
app.analysis.day-sales
'
:
'
今日新增
'
,
'
app.analysis.visits
'
:
'
打包总数
'
,
'
app.analysis.visits-trend
'
:
'
访问量趋势
'
,
'
app.analysis.visits-ranking
'
:
'
门店访问量排名
'
,
'
app.analysis.day-visits
'
:
'
日访问量
'
,
'
app.analysis.day-visits
'
:
'
今日新增
'
,
'
app.analysis.week
'
:
'
周同比
'
,
'
app.analysis.day
'
:
'
日同比
'
,
'
app.analysis.payments
'
:
'
支付笔
数
'
,
'
app.analysis.conversion-rate
'
:
'
转化率
'
,
'
app.analysis.operational-effect
'
:
'
运营活动效果
'
,
'
app.analysis.day
'
:
'
今日新增
'
,
'
app.analysis.payments
'
:
'
开发者
数
'
,
'
app.analysis.conversion-rate
'
:
'
今日新增
'
,
'
app.analysis.operational-effect
'
:
'
设备总数
'
,
'
app.analysis.sales-trend
'
:
'
销售趋势
'
,
'
app.analysis.sales-ranking
'
:
'
门店销售额排名
'
,
'
app.analysis.all-year
'
:
'
全年
'
,
...
...
tools/frontend/src/store/modules/global-nav.js
View file @
4bf4dc0b
...
...
@@ -59,14 +59,6 @@ const mock = [
leaf
:
true
,
children
:
[],
},
{
id
:
"
1044886630122659841
"
,
parentId
:
"
1044886629921333248
"
,
name
:
"
file-manager
"
,
path
:
"
/system/setting/file-manager
"
,
leaf
:
true
,
children
:
[],
},
],
},
{
...
...
tools/frontend/src/views/Dashboard/Analysis.vue
View file @
4bf4dc0b
<
template
>
<a-grid-content>
<a-row
:gutter=
"24"
>
<a-col
:xs=
"24"
:sm=
"12"
:md=
"12"
:lg=
"12"
:xl=
"6"
:style=
"
{marginBottom: '24px'}">
<a-chart-card
:loading=
"loading"
contentHeight=
"46px"
:total=
"yuan(158829)"
:title=
"$t('app.analysis.total-sales')"
>
<a-col
:xs=
"24"
:sm=
"12"
:md=
"12"
:lg=
"12"
:xl=
"6"
:style=
"
{ marginBottom: '24px' }"
>
<a-chart-card
:loading=
"loading"
contentHeight=
"46px"
:total=
"numeral(summary.total_app).format('0,0')"
:title=
"$t('app.analysis.total-sales')"
>
<a-tooltip
placement=
"top"
slot=
"action"
>
<span
slot=
"title"
>
<span
v-html=
"$t('app.analysis.introduce')"
></span>
<span
v-html=
"$t('app.analysis.introduce')"
></span>
</span>
<a-icon
type=
"info-circle-o"
/>
</a-tooltip>
<a-field
slot=
"footer"
:label=
"$t('app.analysis.day-sales')"
:value=
"yuan(6093)"
/>
<a-trend
flag=
"up"
:style=
"
{marginRight: '16px'}">
{{
$t
(
'
app.analysis.week
'
)
}}
<a-field
slot=
"footer"
:label=
"$t('app.analysis.day-sales')"
:value=
"numeral(summary.today_app).format('0,0')"
/>
<a-trend
flag=
"up"
:style=
"
{ marginRight: '16px' }">
{{
$t
(
"
app.analysis.week
"
)
}}
<span
class=
"trendText"
>
12%
</span>
</a-trend>
<a-trend
flag=
"down"
>
{{
$t
(
'
app.analysis.day
'
)
}}
{{
$t
(
"
app.analysis.day
"
)
}}
<span
class=
"trendText"
>
11%
</span>
</a-trend>
</a-chart-card>
</a-col>
<a-col
:xs=
"24"
:sm=
"12"
:md=
"12"
:lg=
"12"
:xl=
"6"
:style=
"
{marginBottom: '24px'}">
<a-chart-card
:loading=
"loading"
contentHeight=
"46px"
:total=
"numeral(36784).format('0,0')"
:title=
"$t('app.analysis.visits')"
>
<a-col
:xs=
"24"
:sm=
"12"
:md=
"12"
:lg=
"12"
:xl=
"6"
:style=
"
{ marginBottom: '24px' }"
>
<a-chart-card
:loading=
"loading"
contentHeight=
"46px"
:total=
"numeral(summary.total_package).format('0,0')"
:title=
"$t('app.analysis.visits')"
>
<a-tooltip
placement=
"top"
slot=
"action"
>
<span
slot=
"title"
>
<span
v-html=
"$t('app.analysis.introduce')"
></span>
<span
v-html=
"$t('app.analysis.introduce')"
></span>
</span>
<a-icon
type=
"info-circle-o"
/>
</a-tooltip>
<a-field
slot=
"footer"
:label=
"$t('app.analysis.day-visits')"
:value=
"numeral(6678).format('0,0')"
/>
<a-field
slot=
"footer"
:label=
"$t('app.analysis.day-visits')"
:value=
"numeral(summary.today_package).format('0,0')"
/>
<!--
<a-mini-area
color=
"#975FE4"
/>
-->
<a-trend
flag=
"up"
:style=
"
{
marginRight: '16px'
}">
{{
$t
(
'
app.analysis.week
'
)
}}
<a-trend
flag=
"up"
:style=
"
{
marginRight: '16px'
}">
{{
$t
(
"
app.analysis.week
"
)
}}
<span
class=
"trendText"
>
6%
</span>
</a-trend>
<a-trend
flag=
"down"
>
{{
$t
(
'
app.analysis.day
'
)
}}
{{
$t
(
"
app.analysis.day
"
)
}}
<span
class=
"trendText"
>
2%
</span>
</a-trend>
</a-chart-card>
</a-col>
<a-col
:xs=
"24"
:sm=
"12"
:md=
"12"
:lg=
"12"
:xl=
"6"
:style=
"
{marginBottom: '24px'}">
<a-chart-card
:loading=
"loading"
contentHeight=
"46px"
:total=
"numeral(6560).format('0,0')"
:title=
"$t('app.analysis.payments')"
>
<a-col
:xs=
"24"
:sm=
"12"
:md=
"12"
:lg=
"12"
:xl=
"6"
:style=
"
{ marginBottom: '24px' }"
>
<a-chart-card
:loading=
"loading"
contentHeight=
"46px"
:total=
"numeral(summary.total_user).format('0,0')"
:title=
"$t('app.analysis.payments')"
>
<a-tooltip
placement=
"top"
slot=
"action"
>
<span
slot=
"title"
>
<span
v-html=
"$t('app.analysis.introduce')"
></span>
<span
v-html=
"$t('app.analysis.introduce')"
></span>
</span>
<a-icon
type=
"info-circle-o"
/>
</a-tooltip>
<!--
<a-mini-bar
/>
-->
<a-mini-progress
:percent=
"55"
:strokeWidth=
"8"
:target=
"80"
color=
"#975FE4"
/>
<a-field
slot=
"footer"
:label=
"$t('app.analysis.conversion-rate')"
value=
"30%"
/>
<a-mini-progress
:percent=
"55"
:strokeWidth=
"8"
:target=
"80"
color=
"#975FE4"
/>
<a-field
slot=
"footer"
:label=
"$t('app.analysis.conversion-rate')"
:value=
"numeral(summary.today_user).format('0,0')"
/>
</a-chart-card>
</a-col>
<a-col
:xs=
"24"
:sm=
"12"
:md=
"12"
:lg=
"12"
:xl=
"6"
:style=
"
{marginBottom: '24px'}">
<a-chart-card
:loading=
"loading"
contentHeight=
"46px"
total=
"78%"
:title=
"$t('app.analysis.operational-effect')"
>
<a-col
:xs=
"24"
:sm=
"12"
:md=
"12"
:lg=
"12"
:xl=
"6"
:style=
"
{ marginBottom: '24px' }"
>
<a-chart-card
:loading=
"loading"
contentHeight=
"46px"
:total=
"numeral(summary.total_device).format('0,0')"
:title=
"$t('app.analysis.operational-effect')"
>
<a-tooltip
placement=
"top"
slot=
"action"
>
<span
slot=
"title"
>
<span
v-html=
"$t('app.analysis.introduce')"
></span>
<span
v-html=
"$t('app.analysis.introduce')"
></span>
</span>
<a-icon
type=
"info-circle-o"
/>
</a-tooltip>
<a-mini-progress
:percent=
"30"
:strokeWidth=
"8"
:target=
"80"
color=
"#13C2C2"
/>
<div
:style=
"
{whiteSpace:'nowrap',overflow:'hidden'}" slot="footer">
<a-mini-progress
:percent=
"30"
:strokeWidth=
"8"
:target=
"80"
color=
"#13C2C2"
/>
<div
:style=
"
{ whiteSpace: 'nowrap', overflow: 'hidden' }"
slot="footer"
>
<!--
<a-trend
flag=
"up"
:style=
"
{marginRight: '16px'}">
{{
$t
(
'
app.analysis.week
'
)
}}
<span
class=
"trendText"
>
12%
</span>
</a-trend>
-->
<a-trend
flag=
"up"
>
{{
$t
(
'
app.analysis.day
'
)
}}
<span
class=
"trendText"
>
28%
</span>
{{
$t
(
"
app.analysis.day
"
)
}}
<span
class=
"trendText"
>
{{
summary
.
today_device
}}
</span>
</a-trend>
</div>
</a-chart-card>
</a-col>
</a-row>
<a-card
:loading=
"loading"
:bordered=
"false"
:bodyStyle=
"
{padding:'0px'}">
<div
class=
"salesCard"
>
<a-tabs
size=
"large"
:tabBarStyle=
"
{marginBottom: '24px',paddingLeft:'16px'}">
<div
slot=
"tabBarExtraContent"
class=
"salesExtraWrap"
>
<div
class=
"salesExtra"
>
<a
>
{{
$t
(
'
app.analysis.all-day
'
)
}}
</a>
<a
class=
"currentDate"
>
{{
$t
(
'
app.analysis.all-week
'
)
}}
</a>
<a
>
{{
$t
(
'
app.analysis.all-month
'
)
}}
</a>
<a
>
{{
$t
(
'
app.analysis.all-year
'
)
}}
</a>
</div>
<a-range-picker
style=
"width:256px;"
/>
<a-card
:loading=
"loading"
:bordered=
"false"
:bodyStyle=
"
{ padding: '0px' }"
>
<div
class=
"salesCard"
>
<a-tabs
size=
"large"
:tabBarStyle=
"
{ marginBottom: '24px', paddingLeft: '16px' }"
>
<div
slot=
"tabBarExtraContent"
class=
"salesExtraWrap"
>
<div
class=
"salesExtra"
>
<a>
{{
$t
(
"
app.analysis.all-day
"
)
}}
</a>
<a
class=
"currentDate"
>
{{
$t
(
"
app.analysis.all-week
"
)
}}
</a>
<a>
{{
$t
(
"
app.analysis.all-month
"
)
}}
</a>
<a>
{{
$t
(
"
app.analysis.all-year
"
)
}}
</a>
</div>
<a-tab-pane
key=
"sales"
:tab=
"$t('app.analysis.sales')"
>
<a-row>
<a-col
:xl=
"16"
:lg=
"12"
:md=
"12"
:sm=
"24"
:xs=
"24"
>
<div
class=
"salesBar"
>
<!--
<h4>
活动实时交易情况
</h4>
-->
<a-row>
<a-col
:md=
"6"
:sm=
"12"
:xs=
"24"
>
<a-number-info
subTitle=
"今日交易总额"
suffix=
"万元"
:total=
"numeral(12233).format('0,0')"
/>
</a-col>
<a-col
:md=
"6"
:sm=
"12"
:xs=
"24"
>
<a-number-info
subTitle=
"销售目标完成率"
total=
"92%"
/>
</a-col>
<a-col
:md=
"6"
:sm=
"12"
:xs=
"24"
>
<!--
<NumberInfo
subTitle=
"活动剩余时间"
total=
{
<CountDown
target=
{targetTime} />} /> -->
<a-number-info
subTitle=
"活动剩余时间"
total=
"01:04:53"
/>
</a-col>
<a-col
:md=
"6"
:sm=
"12"
:xs=
"24"
>
<a-number-info
subTitle=
"每秒交易总额"
suffix=
"元"
:total=
"numeral(21234).format('0,0')"
/>
</a-col>
</a-row>
<div
class=
"mapChart"
>
<a-tooltip
title=
"等待后期实现"
>
<img
src=
"https://gw.alipayobjects.com/zos/rmsportal/HBWnDEUXCnGnGrRfrpKa.png"
alt=
"map"
/>
</a-tooltip>
</div>
</div>
</a-col>
<a-col
:xl=
"8"
:lg=
"12"
:md=
"12"
:sm=
"24"
:xs=
"24"
>
<div
class=
"salesRank"
>
<h4
class=
"rankingTitle"
>
{{
$t
(
'
app.analysis.sales-ranking
'
)
}}
</h4>
<ul
class=
"rankingList"
>
<li
v-for=
"(item,i) in 10"
:key=
"i"
>
<span
class=
"rankingItemNumber "
:class=
"
{'active':i
<3
}"
>
{{
i
+
1
}}
</span>
<span
class=
"rankingItemTitle"
>
中国 🇨🇳 加油 ⛽️ ⛽ ️⛽️
</span>
<span
class=
"rankingItemValue"
>
0,0
</span>
</li>
</ul>
</div>
</a-col>
</a-row>
</a-tab-pane>
<a-tab-pane
key=
"visits"
:tab=
"$t('app.analysis.visits')"
>
</a-tab-pane>
</a-tabs>
</div>
<a-range-picker
style=
"width: 256px"
/>
</div>
<a-tab-pane
key=
"sales"
:tab=
"$t('app.analysis.sales')"
>
<a-row>
<a-col
:xl=
"16"
:lg=
"12"
:md=
"12"
:sm=
"24"
:xs=
"24"
>
<div
class=
"salesBar"
>
<!--
<h4>
活动实时交易情况
</h4>
-->
<a-row>
<a-col
:md=
"6"
:sm=
"12"
:xs=
"24"
>
<a-number-info
subTitle=
"今日交易总额"
suffix=
"万元"
:total=
"numeral(12233).format('0,0')"
/>
</a-col>
<a-col
:md=
"6"
:sm=
"12"
:xs=
"24"
>
<a-number-info
subTitle=
"销售目标完成率"
total=
"92%"
/>
</a-col>
<a-col
:md=
"6"
:sm=
"12"
:xs=
"24"
>
<!--
<NumberInfo
subTitle=
"活动剩余时间"
total=
{
<CountDown
target=
{targetTime} />} /> -->
<a-number-info
subTitle=
"活动剩余时间"
total=
"01:04:53"
/>
</a-col>
<a-col
:md=
"6"
:sm=
"12"
:xs=
"24"
>
<a-number-info
subTitle=
"每秒交易总额"
suffix=
"元"
:total=
"numeral(21234).format('0,0')"
/>
</a-col>
</a-row>
<div
class=
"mapChart"
>
<a-tooltip
title=
"等待后期实现"
>
<img
src=
"https://gw.alipayobjects.com/zos/rmsportal/HBWnDEUXCnGnGrRfrpKa.png"
alt=
"map"
/>
</a-tooltip>
</div>
</div>
</a-col>
<a-col
:xl=
"8"
:lg=
"12"
:md=
"12"
:sm=
"24"
:xs=
"24"
>
<div
class=
"salesRank"
>
<h4
class=
"rankingTitle"
>
{{
$t
(
"
app.analysis.sales-ranking
"
)
}}
</h4>
<ul
class=
"rankingList"
>
<li
v-for=
"(item, i) in 10"
:key=
"i"
>
<span
class=
"rankingItemNumber"
:class=
"
{ active: i
<
3
}"
>
{{
i
+
1
}}
</span>
<span
class=
"rankingItemTitle"
>
中国 🇨🇳 加油 ⛽️ ⛽ ️⛽️
</span>
<span
class=
"rankingItemValue"
>
0,0
</span>
</li>
</ul>
</div>
</a-col>
</a-row>
</a-tab-pane>
<a-tab-pane
key=
"visits"
:tab=
"$t('app.analysis.visits')"
>
</a-tab-pane>
</a-tabs>
</div>
</a-card>
<!--
<a-row
:gutter=
"24"
>
8
</a-row>
-->
</a-grid-content>
...
...
@@ -169,7 +251,8 @@ import {
Tooltip
,
Icon
,
Tabs
,
DatePicker
DatePicker
,
message
,
}
from
"
ant-design-vue
"
;
import
GridContent
from
"
@/components/PageHeaderWrapper/GridContent
"
;
import
Trend
from
"
@/components/Trend
"
;
...
...
@@ -178,7 +261,7 @@ import {
ChartCard
,
Field
,
yuan
,
MiniProgress
MiniProgress
,
// MiniBar,
// MiniArea
}
from
"
@/components/Charts
"
;
...
...
@@ -187,9 +270,21 @@ import numeral from "numeral";
// import 'moment/locale/zh-cn';
// moment.locale('zh-cn');
import
{
workbench
}
from
"
@/api/openapi
"
;
export
default
{
data
:
()
=>
({
loading
:
false
loading
:
false
,
summary
:
{
total_user
:
null
,
today_user
:
null
,
total_device
:
null
,
today_device
:
null
,
total_app
:
null
,
today_app
:
null
,
total_package
:
null
,
today_package
:
null
,
},
}),
components
:
{
AGridContent
:
GridContent
,
...
...
@@ -207,12 +302,25 @@ export default {
ATabs
:
Tabs
,
ATabPane
:
Tabs
.
TabPane
,
ARangePicker
:
DatePicker
.
RangePicker
,
ANumberInfo
:
NumberInfo
ANumberInfo
:
NumberInfo
,
},
methods
:
{
yuan
,
numeral
}
numeral
,
workbench
()
{
workbench
()
.
then
((
res
)
=>
{
this
.
summary
=
res
.
data
console
.
log
(
res
);
})
.
catch
((
err
)
=>
{
message
.
error
(
err
.
msg
);
});
},
},
created
()
{
this
.
workbench
();
},
};
</
script
>
<
style
lang=
"less"
>
...
...
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