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
b63b47de
Commit
b63b47de
authored
Apr 22, 2025
by
lei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:视频分析任务启动状态、监控视频默认第一选项
parent
3ae172f8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
58 deletions
+16
-58
index.vue
src/views/home/index.vue
+14
-56
ring-chart.vue
src/views/home/modules/ring-chart.vue
+2
-2
No files found.
src/views/home/index.vue
View file @
b63b47de
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
import
{
computed
,
ref
,
onMounted
,
reactive
,
nextTick
,
watch
}
from
'
vue
'
;
import
{
computed
,
ref
,
onMounted
,
reactive
,
nextTick
,
watch
}
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
,
NConfigProvider
,
darkTheme
,
NButton
,
NImage
,
NSpace
,
NTag
,
useNotification
,
NDropdown
,
NRow
,
NCol
,
NEllipsis
}
from
"
naive-ui
"
import
{
useMessage
,
NConfigProvider
,
darkTheme
,
NButton
,
NImage
,
NSpace
,
NTag
,
useNotification
,
NDropdown
,
NRow
,
NCol
,
NEllipsis
,
selectDark
}
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
'
;
...
@@ -62,6 +62,7 @@ const start = () => {
...
@@ -62,6 +62,7 @@ const start = () => {
}
}
const
cameraList
=
ref
([]);
const
cameraList
=
ref
([]);
const
selectData
=
ref
(
''
);
// 获取区域
// 获取区域
const
getCameraList
=
async
()
=>
{
const
getCameraList
=
async
()
=>
{
const
params
=
{
const
params
=
{
...
@@ -72,7 +73,10 @@ const getCameraList = async () => {
...
@@ -72,7 +73,10 @@ const getCameraList = async () => {
await
api_getCameraList
(
params
).
then
(
res
=>
{
await
api_getCameraList
(
params
).
then
(
res
=>
{
if
(
res
.
data
.
code
===
200
)
{
if
(
res
.
data
.
code
===
200
)
{
cameraList
.
value
=
res
.
data
.
data
.
records
;
cameraList
.
value
=
res
.
data
.
data
.
records
;
cameraList
.
value
.
length
>
0
&&
switchVideoPalyer
(
cameraList
.
value
[
0
].
id
);
cameraList
.
value
.
length
>
0
&&
switchVideoPalyer
(
cameraList
.
value
[
0
].
id
);
selectData
.
value
=
cameraList
.
value
[
0
].
cameraName
;
}
}
});
});
};
};
...
@@ -84,7 +88,7 @@ const playAudio = async (id: string) => {
...
@@ -84,7 +88,7 @@ const playAudio = async (id: string) => {
// 创建新的音频元素并播放
// 创建新的音频元素并播放
const
audio
=
new
Audio
(
`
${
apiUrl
}
/v1/play/
${
id
}
`
);
const
audio
=
new
Audio
(
`
${
apiUrl
}
/v1/play/
${
id
}
`
);
audio
.
play
();
audio
.
play
();
// 保留原始逻辑备用
// 保留原始逻辑备用
// htmlStr.value = `
<
audio
id
=
"
aWrap
"
controls
autoplay
>
// htmlStr.value = `
<
audio
id
=
"
aWrap
"
controls
autoplay
>
//
<
source
src
=
"
${apiUrl}/v1/play/${id}
"
type
=
"
audio/mpeg
"
>
//
<
source
src
=
"
${apiUrl}/v1/play/${id}
"
type
=
"
audio/mpeg
"
>
...
@@ -92,23 +96,13 @@ const playAudio = async (id: string) => {
...
@@ -92,23 +96,13 @@ const playAudio = async (id: string) => {
// nextTick(() => document.getElementById('aWrap')?.play());
// nextTick(() => document.getElementById('aWrap')?.play());
};
};
const
cId
=
ref
(
''
);
const
cName
=
ref
(
''
);
const
cName
=
ref
(
''
);
const
switchVideoPalyer
=
(
id
:
string
)
=>
{
const
switchVideoPalyer
=
(
id
:
string
)
=>
{
cId
.
value
=
id
;
selectData
.
value
=
cameraList
.
value
.
filter
(
item
=>
item
?.
id
===
id
)[
0
].
cameraName
;
let
camera
=
cameraList
.
value
.
filter
(
item
=>
item
?.
id
===
id
)[
0
];
let
camera
=
cameraList
.
value
.
filter
(
item
=>
item
?.
id
===
id
)[
0
];
console
.
log
(
"
======================================= id
"
,
id
,
camera
?.
cameraAddress
);
// if (!camera?.cameraAddress?.includes('rtsp://')) {
// return message.error('摄像头流地址格式有误!');
// }
cName
.
value
=
camera
.
cameraName
;
cName
.
value
=
camera
.
cameraName
;
jsmpeg
.
value
&&
jsmpeg
.
value
.
destroy
();
jsmpeg
.
value
&&
jsmpeg
.
value
.
destroy
();
nextTick
(()
=>
{
nextTick
(()
=>
{
try
{
try
{
const
rtsp1
=
camera
.
cameraAddress
;
const
rtsp1
=
camera
.
cameraAddress
;
...
@@ -122,7 +116,6 @@ const switchVideoPalyer = (id: string) => {
...
@@ -122,7 +116,6 @@ const switchVideoPalyer = (id: string) => {
}
}
);
);
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
"
======================================= error
"
,
e
);
}
}
});
});
};
};
...
@@ -227,9 +220,9 @@ const getCardData = async () => {
...
@@ -227,9 +220,9 @@ const getCardData = async () => {
if
(
res
.
data
.
code
===
200
)
{
if
(
res
.
data
.
code
===
200
)
{
// devData.value = res.data.data;
// devData.value = res.data.data;
(
res
.
data
.
data
).
forEach
(
item
=>
{
(
res
.
data
.
data
).
forEach
(
item
=>
{
if
(
item
.
status
===
0
)
{
if
(
item
.
status
===
0
)
{
devData
.
value
.
online
=
item
.
count
devData
.
value
.
online
=
item
.
count
}
else
{
}
else
{
devData
.
value
.
offline
=
item
.
count
devData
.
value
.
offline
=
item
.
count
}
}
})
})
...
@@ -249,49 +242,21 @@ const openCamera = (item) => {
...
@@ -249,49 +242,21 @@ const openCamera = (item) => {
const
full
=
ref
(
false
);
const
full
=
ref
(
false
);
// watch(full, (oldType, curType) => {
// if (curType) {
// nextTick(() => {
// const el = document.getElementById('canvas-4');
// const { clientWidth, clientHeight } = el;
// console.log(clientWidth, clientHeight)
// el.width = clientWidth;
// el.height = clientHeight;
// switchVideoPalyer();
// })
// }
// });
/**
* 窗口自适应
*/
// window.addEventListener('resize', (e) => {
// if (full.value) {
// }
// })
onMounted
(()
=>
{
onMounted
(()
=>
{
getAlarmLog
();
getAlarmLog
();
getCameraList
();
getCameraList
();
getCardData
();
getCardData
();
// =============================================================== Demo | S
try
{
try
{
let
ws
=
new
WebSocket
(
`
${
webSocketUrl
}
/ws/
${
localStg
.
get
(
'
id
'
)}
`
);
let
ws
=
new
WebSocket
(
`
${
webSocketUrl
}
/ws/
${
localStg
.
get
(
'
id
'
)}
`
);
ws
.
onopen
=
function
()
{
ws
.
onopen
=
function
()
{
console
.
log
(
'
WebSocket connected --------------------------------------------------------------------------
'
);
ws
.
send
(
'
Hello, Server! -------------------------
'
);
ws
.
send
(
'
Hello, Server! -------------------------
'
);
};
};
ws
.
onmessage
=
function
(
event
)
{
ws
.
onmessage
=
function
(
event
)
{
console
.
log
(
'
---------------------- WebSocket received message:
'
,
JSON
.
parse
(
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
)
{
window
.
$notification
?.
create
({
window
.
$notification
?.
create
({
duration
:
5000
,
duration
:
5000
,
...
@@ -379,17 +344,10 @@ onMounted(() => {
...
@@ -379,17 +344,10 @@ onMounted(() => {
}
}
});
});
});
});
</
script
>
</
script
>
<
template
>
<
template
>
<div
id=
"HomePage"
>
<div
id=
"HomePage"
>
<!--
<canvas
height=
"1080"
width=
"1920"
id=
"canvas-4"
></canvas>
-->
<!-- =================================== 弹窗 | S -->
<!-- =================================== 弹窗 | S -->
<NModal
v-model:show=
"showModal"
>
<NModal
v-model:show=
"showModal"
>
<NCard
v-if=
"isDefaultPreview"
style=
"width: 800px;"
@
close=
"showModal = false"
closable
>
<NCard
v-if=
"isDefaultPreview"
style=
"width: 800px;"
@
close=
"showModal = false"
closable
>
...
@@ -414,8 +372,8 @@ onMounted(() => {
...
@@ -414,8 +372,8 @@ onMounted(() => {
<template
#icon
>
<template
#icon
>
<icon-ic:baseline-slow-motion-video
class=
"text-icon"
/>
<icon-ic:baseline-slow-motion-video
class=
"text-icon"
/>
</
template
>
</
template
>
回放
回放
</NButton>
-->
</NButton>
-->
</NFlex>
</NFlex>
</template>
</template>
<!-- 图片区域 -->
<!-- 图片区域 -->
...
@@ -441,7 +399,7 @@ onMounted(() => {
...
@@ -441,7 +399,7 @@ onMounted(() => {
switchVideoPlayer();
switchVideoPlayer();
isDefaultPreview = true;
isDefaultPreview = true;
}
}
">
">
<NIcon
size=
"25"
style=
"position: relative; top: 2px;"
>
<NIcon
size=
"25"
style=
"position: relative; top: 2px;"
>
<ArrowLeft20Filled
/>
<ArrowLeft20Filled
/>
</NIcon>
</NIcon>
...
@@ -555,7 +513,7 @@ onMounted(() => {
...
@@ -555,7 +513,7 @@ onMounted(() => {
<
template
#
header
-
extra
>
<
template
#
header
-
extra
>
<
div
style
=
"
width: 200px;
"
>
<
div
style
=
"
width: 200px;
"
>
<
NSelect
@
update
:
value
=
"
val => switchVideoPalyer(val)
"
placeholder
=
"
请选择
"
label
-
field
=
"
cameraName
"
<
NSelect
@
update
:
value
=
"
val => switchVideoPalyer(val)
"
:
value
=
"
selectData
"
placeholder
=
"
请选择
"
label
-
field
=
"
cameraName
"
value
-
field
=
"
id
"
:
options
=
"
cameraList
"
><
/NSelect
>
value
-
field
=
"
id
"
:
options
=
"
cameraList
"
><
/NSelect
>
<
/div
>
<
/div
>
<
/template
>
<
/template
>
...
...
src/views/home/modules/ring-chart.vue
View file @
b63b47de
...
@@ -113,8 +113,8 @@ const getCardData = async () => {
...
@@ -113,8 +113,8 @@ const getCardData = async () => {
if
(
res
.
data
.
code
===
200
)
{
if
(
res
.
data
.
code
===
200
)
{
updateOptions
((
opts
)
=>
{
updateOptions
((
opts
)
=>
{
opts
.
series
[
0
].
data
=
[
opts
.
series
[
0
].
data
=
[
{
name
:
`已启动`
,
value
:
res
.
data
.
data
[
0
].
count
},
{
name
:
`已启动`
,
value
:
res
.
data
.
data
[
1
].
count
},
{
name
:
`已停用`
,
value
:
res
.
data
.
data
[
1
].
count
},
{
name
:
`已停用`
,
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