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
88e658ee
Commit
88e658ee
authored
Apr 14, 2025
by
lei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1111
parent
a2d138a9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
11 deletions
+12
-11
index.vue
src/views/home/index.vue
+12
-11
No files found.
src/views/home/index.vue
View file @
88e658ee
...
...
@@ -21,7 +21,6 @@ import fullScreen from '@/utils/full'
const
serviceUrl
=
import
.
meta
.
env
.
VITE_VIDEO_URL
;
const
apiUrl
=
import
.
meta
.
env
.
VITE_SERVICE_URL
;
const
webSocketUrl
=
import
.
meta
.
env
.
VITE_WEBSOCKET_URL
;
...
...
@@ -73,10 +72,7 @@ const getCameraList = async () => {
await
api_getCameraList
(
params
).
then
(
res
=>
{
if
(
res
.
data
.
code
===
200
)
{
cameraList
.
value
=
res
.
data
.
data
.
records
;
if
(
cameraList
.
value
.
length
>
0
)
{
cId
.
value
=
cameraList
.
value
[
0
].
id
;
// 设置默认选中ID
switchVideoPalyer
(
cameraList
.
value
[
0
].
id
);
}
cameraList
.
value
.
length
>
0
&&
switchVideoPalyer
(
cameraList
.
value
[
0
].
id
);
}
});
};
...
...
@@ -87,7 +83,6 @@ const audioId = ref('');
const
playAudio
=
async
(
id
:
string
)
=>
{
// 创建新的音频元素并播放
const
audio
=
new
Audio
(
`
${
apiUrl
}
/v1/play/
${
id
}
`
);
audio
.
play
();
// 保留原始逻辑备用
...
...
@@ -103,6 +98,7 @@ const switchVideoPalyer = (id: string) => {
cId
.
value
=
id
;
let
camera
=
cameraList
.
value
.
filter
(
item
=>
item
?.
id
===
id
)[
0
];
console
.
log
(
"
======================================= id
"
,
id
,
camera
?.
cameraAddress
);
// if (!camera?.cameraAddress?.includes('rtsp://')) {
// return message.error('摄像头流地址格式有误!');
...
...
@@ -126,6 +122,7 @@ const switchVideoPalyer = (id: string) => {
}
);
}
catch
(
e
)
{
console
.
log
(
"
======================================= error
"
,
e
);
}
});
};
...
...
@@ -163,6 +160,7 @@ const options = [
}
];
const
handleSelect
=
(
key
:
string
)
=>
{
console
.
log
(
key
);
};
// 变更状态
...
...
@@ -204,6 +202,7 @@ let cLogInfo = reactive({});
// 切换视频播放源头
const
switchVideoPlayer
=
()
=>
{
console
.
log
(
"
switchVideoPlayer ==============
"
,
"
rtsp://admin:gemho10-7@192.168.0.56:554/h264/ch1/main/av_stream`
"
)
// nextTick(() => {
// try {
// // 临时测试
...
...
@@ -282,13 +281,14 @@ onMounted(() => {
try
{
let
ws
=
new
WebSocket
(
`
${
webSocketUrl
}
/ws/
${
localStg
.
get
(
'
id
'
)}
`
);
// 应改为(测试用临时方案):
// let ws = new WebSocket(`ws://localhost:9999/ws/${localStg.get('id')}`);
ws
.
onopen
=
function
()
{
console
.
log
(
'
WebSocket connected --------------------------------------------------------------------------
'
);
ws
.
send
(
'
Hello, Server! -------------------------
'
);
};
ws
.
onmessage
=
function
(
event
)
{
console
.
log
(
'
---------------------- WebSocket received message:
'
,
JSON
.
parse
(
event
.
data
));
let
data
=
JSON
.
parse
(
event
.
data
);
data
.
algorithmId
&&
playAudio
(
data
.
algorithmId
);
...
...
@@ -356,14 +356,15 @@ onMounted(() => {
};
ws
.
onclose
=
function
()
{
console
.
log
(
'
WebSocket closed
'
);
};
ws
.
onerror
=
function
(
error
)
{
console
.
error
(
'
WebSocket error:
'
,
error
);
// 检查控制台是否有连接错误
console
.
error
(
'
WebSocket error:
'
,
error
);
};
}
catch
(
e
)
{
console
.
log
(
e
,
'
error
'
)
console
.
log
(
"
error
"
,
e
)
}
...
...
@@ -554,7 +555,7 @@ onMounted(() => {
<
template
#
header
-
extra
>
<
div
style
=
"
width: 200px;
"
>
<
NSelect
v
-
model
:
value
=
"
cId
"
@
update
:
value
=
"
val => switchVideoPalyer(val)
"
placeholder
=
"
请选择
"
label
-
field
=
"
cameraName
"
<
NSelect
@
update
:
value
=
"
val => switchVideoPalyer(val)
"
placeholder
=
"
请选择
"
label
-
field
=
"
cameraName
"
value
-
field
=
"
id
"
:
options
=
"
cameraList
"
><
/NSelect
>
<
/div
>
<
/template
>
...
...
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