Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
AI推理平台
Project
Project
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
lichunliang
AI推理平台
Commits
c1e04c3f
Commit
c1e04c3f
authored
Apr 22, 2025
by
lei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:修复首页饼图数据,报警声音
parent
b63b47de
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
12 deletions
+29
-12
.env
.env
+1
-1
index.vue
src/views/home/index.vue
+24
-7
pie-chart-pro.vue
src/views/home/modules/pie-chart-pro.vue
+4
-4
No files found.
.env
View file @
c1e04c3f
...
@@ -80,7 +80,7 @@ VITE_VIDEO_URL=ws://192.168.3.248:9999
...
@@ -80,7 +80,7 @@ VITE_VIDEO_URL=ws://192.168.3.248:9999
VITE_SERVICE_URL=http://192.168.3.248:9996
VITE_SERVICE_URL=http://192.168.3.248:9996
# 开发环境 - WebSocket 全局地址
# 开发环境 - WebSocket 全局地址
VITE_WEBSOCKET_URL=ws://192.168.3.248:999
9
VITE_WEBSOCKET_URL=ws://192.168.3.248:999
6
VITE_OTHER_SERVICE_BASE_URL= `{
VITE_OTHER_SERVICE_BASE_URL= `{
"demo": "http://192.168.3.248:9999"
"demo": "http://192.168.3.248:9999"
...
...
src/views/home/index.vue
View file @
c1e04c3f
<
script
setup
lang=
"tsx"
>
<
script
setup
lang=
"tsx"
>
import
{
computed
,
ref
,
onMounted
,
reactive
,
nextTick
,
watch
}
from
'
vue
'
;
import
{
computed
,
ref
,
onMounted
,
watch
,
reactive
,
nextTick
}
from
'
vue
'
;
import
{
useAppStore
}
from
'
@/store/modules/app
'
;
import
{
useAppStore
}
from
'
@/store/modules/app
'
;
import
{
ArrowLeft20Filled
}
from
'
@vicons/fluent
'
;
import
{
ArrowLeft20Filled
}
from
'
@vicons/fluent
'
;
import
{
useMessage
,
N
ConfigProvider
,
darkTheme
,
NButton
,
NImage
,
NSpace
,
NTag
,
useNotification
,
NDropdown
,
NRow
,
NCol
,
NEllipsis
,
selectDark
}
from
"
naive-ui
"
import
{
useMessage
,
N
Button
,
NImage
,
NSpace
,
NTag
,
useNotification
,
NDropdown
,
NRow
,
NCol
,
NEllipsis
}
from
"
naive-ui
"
import
HeaderBanner
from
'
./modules/header-banner.vue
'
;
import
HeaderBanner
from
'
./modules/header-banner.vue
'
;
import
CardData
from
'
./modules/card-data.vue
'
;
import
CardData
from
'
./modules/card-data.vue
'
;
import
LineChart
from
'
./modules/line-chart.vue
'
;
import
LineChart
from
'
./modules/line-chart.vue
'
;
...
@@ -250,11 +250,25 @@ onMounted(() => {
...
@@ -250,11 +250,25 @@ onMounted(() => {
getCameraList
();
getCameraList
();
getCardData
();
getCardData
();
try
{
try
{
let
ws
=
new
WebSocket
(
`
${
webSocketUrl
}
/ws/
${
localStg
.
get
(
'
id
'
)}
`
);
const
ws
=
new
WebSocket
(
`
${
webSocketUrl
}
/ws/
${
localStg
.
get
(
'
id
'
)}
`
);
ws
.
onopen
=
function
()
{
// 添加连接状态日志
console
.
log
(
'
WebSocket连接状态:
'
,
ws
.
readyState
);
// 0=连接中,1=已连接,2=关闭中,3=已关闭
ws
.
onopen
=
function
()
{
console
.
log
(
'
WebSocket连接成功
'
);
ws
.
send
(
'
Hello, Server! -------------------------
'
);
ws
.
send
(
'
Hello, Server! -------------------------
'
);
// 添加心跳检测
setInterval
(()
=>
{
if
(
ws
.
readyState
===
WebSocket
.
OPEN
)
{
ws
.
send
(
'
PING
'
);
}
},
30000
);
};
};
ws
.
onmessage
=
function
(
event
)
{
ws
.
onmessage
=
function
(
event
)
{
console
.
log
(
'
收到原始数据:
'
,
event
.
data
);
// 打印原始数据
let
data
=
JSON
.
parse
(
event
.
data
);
let
data
=
JSON
.
parse
(
event
.
data
);
data
.
algorithmId
&&
playAudio
(
data
.
algorithmId
);
data
.
algorithmId
&&
playAudio
(
data
.
algorithmId
);
if
(
data
.
reminderType
===
1
)
{
if
(
data
.
reminderType
===
1
)
{
...
@@ -316,7 +330,10 @@ onMounted(() => {
...
@@ -316,7 +330,10 @@ onMounted(() => {
});
});
}
else
{
}
else
{
logInfo
.
value
=
data
;
logInfo
.
value
=
data
;
showTipModal
.
value
=
true
;
showTipModal
.
value
=
true
;
// 确保状态更新
nextTick
(()
=>
{
showTipModal
.
value
=
true
;
// 强制触发视图更新
});
}
}
};
};
...
...
src/views/home/modules/pie-chart-pro.vue
View file @
c1e04c3f
...
@@ -15,12 +15,12 @@ const getCardData = async () => {
...
@@ -15,12 +15,12 @@ const getCardData = async () => {
updateOptions
((
opts
)
=>
{
updateOptions
((
opts
)
=>
{
opts
.
series
[
0
].
data
=
[
opts
.
series
[
0
].
data
=
[
{
{
name
:
`已启动
${
res
.
data
.
data
[
0
].
count
}
个`
,
name
:
`已启动
${
res
.
data
.
data
[
1
].
count
}
个`
,
value
:
res
.
data
.
data
[
0
].
count
,
value
:
res
.
data
.
data
[
1
].
count
,
},
},
{
{
name
:
`已停用
${
res
.
data
.
data
[
1
].
count
}
个`
,
name
:
`已停用
${
res
.
data
.
data
[
0
].
count
}
个`
,
value
:
res
.
data
.
data
[
1
].
count
,
value
:
res
.
data
.
data
[
0
].
count
,
},
},
];
];
return
opts
;
return
opts
;
...
...
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