Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
Z
zhmes-agecal
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
耿迪迪
zhmes-agecal
Commits
8703e1a5
Commit
8703e1a5
authored
Jan 26, 2026
by
wanghao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1解绑或版绑定时 失败增加 提示音效果
parent
b805f280
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
0 deletions
+34
-0
error-sound.mp3
zhmes-agecal-web/src/assets/sound/error-sound.mp3
+0
-0
main.js
zhmes-agecal-web/src/main.js
+4
-0
sound.js
zhmes-agecal-web/src/utils/sound.js
+24
-0
TrayBinding.vue
zhmes-agecal-web/src/views/screen/components/TrayBinding.vue
+6
-0
No files found.
zhmes-agecal-web/src/assets/sound/error-sound.mp3
0 → 100644
View file @
8703e1a5
File added
zhmes-agecal-web/src/main.js
View file @
8703e1a5
...
@@ -21,6 +21,10 @@ import Pagination from "@/components/Pagination";
...
@@ -21,6 +21,10 @@ import Pagination from "@/components/Pagination";
// 自定义表格工具扩展
// 自定义表格工具扩展
import
RightToolbar
from
"@/components/RightToolbar"
import
RightToolbar
from
"@/components/RightToolbar"
// 挂载到Vue原型,组件内可通过 this.$sound 调用
Vue
.
prototype
.
$sound
=
soundPlayer
// 引入音效播放器
import
soundPlayer
from
'@/utils/sound'
// 引入 datav
// 引入 datav
import
DataV
from
'@jiaminghi/data-view'
import
DataV
from
'@jiaminghi/data-view'
Vue
.
use
(
DataV
)
Vue
.
use
(
DataV
)
...
...
zhmes-agecal-web/src/utils/sound.js
0 → 100644
View file @
8703e1a5
// src/utils/sound.js
class
SoundPlayer
{
constructor
()
{
// 预加载音效。这里以失败音效为例
this
.
errorSound
=
new
Audio
(
require
(
'@/assets/sound/error-sound.mp3'
));
this
.
errorSound
.
load
();
}
// 播放扫描失败音效
playScanError
()
{
// 每次播放前重置到开头,确保短促音效能立即重复播放
this
.
errorSound
.
currentTime
=
0
;
const
playPromise
=
this
.
errorSound
.
play
();
// 处理可能因浏览器策略导致的自动播放错误
if
(
playPromise
!==
undefined
)
{
playPromise
.
catch
(
e
=>
{
console
.
log
(
'音效自动播放被阻止:'
,
e
);
});
}
}
}
// 导出单例
export
default
new
SoundPlayer
();
zhmes-agecal-web/src/views/screen/components/TrayBinding.vue
View file @
8703e1a5
...
@@ -482,6 +482,8 @@ export default {
...
@@ -482,6 +482,8 @@ export default {
// 调整点5: 在标定完成状态下,只有异常设备才允许解绑
// 调整点5: 在标定完成状态下,只有异常设备才允许解绑
const
device
=
this
.
devices
[
deviceIndex
];
const
device
=
this
.
devices
[
deviceIndex
];
if
(
!
this
.
isDeviceError
(
device
))
{
if
(
!
this
.
isDeviceError
(
device
))
{
// 网络请求失败或业务逻辑失败时,播放失败音效
this
.
$sound
.
playScanError
();
// 正常设备不允许解绑
// 正常设备不允许解绑
this
.
$message
.
warning
(
`设备
${
this
.
deviceInput
}
状态正常,不能解绑`
);
this
.
$message
.
warning
(
`设备
${
this
.
deviceInput
}
状态正常,不能解绑`
);
this
.
deviceInput
=
''
;
this
.
deviceInput
=
''
;
...
@@ -491,6 +493,8 @@ export default {
...
@@ -491,6 +493,8 @@ export default {
// 找到设备,直接解绑(不弹确认对话框)
// 找到设备,直接解绑(不弹确认对话框)
this
.
executeUnbind
(
deviceIndex
);
this
.
executeUnbind
(
deviceIndex
);
}
else
{
}
else
{
// 网络请求失败或业务逻辑失败时,播放失败音效
this
.
$sound
.
playScanError
();
// 设备不存在提示
// 设备不存在提示
this
.
$message
.
warning
(
`设备
${
this
.
deviceInput
}
不存在或未绑定`
);
this
.
$message
.
warning
(
`设备
${
this
.
deviceInput
}
不存在或未绑定`
);
}
}
...
@@ -504,6 +508,8 @@ export default {
...
@@ -504,6 +508,8 @@ export default {
);
);
if
(
existingIndex
!==
-
1
)
{
if
(
existingIndex
!==
-
1
)
{
// 网络请求失败或业务逻辑失败时,播放失败音效
this
.
$sound
.
playScanError
();
// 发现重复设备号
// 发现重复设备号
this
.
$message
.
error
({
this
.
$message
.
error
({
message
:
`设备
${
trimmedInput
}
已存在于位置
${
existingIndex
+
1
}
中,请勿重复添加`
,
message
:
`设备
${
trimmedInput
}
已存在于位置
${
existingIndex
+
1
}
中,请勿重复添加`
,
...
...
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