From 15340ce75e118014c10c33f925309b3e66d07a7f Mon Sep 17 00:00:00 2001 From: Sjh <55341701@qq.com> Date: Thu, 22 Aug 2024 11:32:11 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BF=AE=E6=94=B9]=E9=A2=84=E8=AD=A6=E5=A3=B0?= =?UTF-8?q?=E9=9F=B3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- proxy.config.json | 4 +- src/app/app.component.ts | 2 +- src/app/pages/home/home.component.ts | 87 +++++++++++++++---- .../singlelogin/singlelogin.component.ts | 2 +- .../or-binding/or-binding.component.html | 5 +- .../or-binding/or-binding.component.ts | 29 ++++++- 6 files changed, 101 insertions(+), 28 deletions(-) diff --git a/proxy.config.json b/proxy.config.json index 3bf5489..b1b6471 100644 --- a/proxy.config.json +++ b/proxy.config.json @@ -1,6 +1,6 @@ { "/api": { - "target": "http://10.156.134.54:8906/", + "target": "http://121.36.37.70:8906/", "测试1": "http://121.36.37.70:8906/", "测试2": "https://znaq.sinochemoilmarketing.com/", "测试3": "https://gas.anxincloud.cn/", @@ -9,7 +9,7 @@ "changeOrigin": true }, "/signalr": { - "target": "http://10.156.134.54:8906/", + "target": "http://121.36.37.70:8906/", "secure": false, "ws": true, "logLevel": "debug" diff --git a/src/app/app.component.ts b/src/app/app.component.ts index e87217a..42f8ca9 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -19,7 +19,7 @@ export class AppComponent { public token: CacheTokenService, private notificationService: NzNotificationService ) {} - VERSION = 20240725; + VERSION = 20240822; ngOnInit(): void { this.sayHello(); } diff --git a/src/app/pages/home/home.component.ts b/src/app/pages/home/home.component.ts index ae8a329..c1cd3e9 100644 --- a/src/app/pages/home/home.component.ts +++ b/src/app/pages/home/home.component.ts @@ -320,31 +320,80 @@ export class HomeComponent implements OnInit { this.messageId.push(obj); } } + + msg = new SpeechSynthesisUtterance(); + playingViolationName = ""; Sound(userNotification) { let violationName = userNotification.notification.data.properties.ViolationName; + let CameraNo = userNotification.notification.data.properties.CameraNo; const soundMap = { - 油罐区非工作人员闯入: "../../../assets/sound/chuangru.mp3", - 进出口长时间停放车辆: "../../../assets/sound/jinchukou.mp3", - 前庭有顾客疑似抽烟: "../../../assets/sound/chouyan.mp3", - 前庭有顾客接打电话: "../../../assets/sound/dadianhua.mp3", - 卸油前未按规定设置隔离: "../../../assets/sound/xygeli.mp3", - 卸油后未按规定拆除卸油管: "../../../assets/sound/xychaichuxyguan.mp3", - 卸油前未按规定连接静电接地: "../../../assets/sound/xyjiedi.mp3", - 卸油前未按规定放置灭火器: "../../../assets/sound/xymiehuoqi.mp3", - 卸油后长时间未清理现场: "../../../assets/sound/xyxianchang.mp3", - 油罐车长时间无人卸油: "../../../assets/sound/xywuren.mp3", - 卸油前未按规定连接卸油管: "../../../assets/sound/xyxieyouguan.mp3", - 卸油中未按规定全程监卸: "../../../assets/sound/xyjianxie.mp3", - 疑似烟雾: "../../../assets/sound/yanwu.mp3", - 疑似明火: "../../../assets/sound/minghuo.mp3", + 油罐区非工作人员闯入: `请注意,${CameraNo}有非工作人员闯入,请及时处理`, + 进出口长时间停放车辆: `请注意,${CameraNo}有长时间停放车辆,请及时处理`, + 前庭有顾客疑似抽烟: `请注意,${CameraNo}有顾客疑似抽烟,请及时处理`, + 前庭有顾客接打电话: `请注意,${CameraNo}有顾客接打电话,请及时处理`, + 卸油前未按规定设置隔离: "请注意,卸油前未按规定设置隔离,请及时处理", + 卸油后未按规定拆除卸油管: "请注意,卸油后未按规定拆除卸油管,请及时处理", + 卸油前未按规定连接静电接地: + "请注意,卸油前未按规定连接静电接地,请及时处理", + 卸油前未按规定放置灭火器: "请注意,卸油前未按规定放置灭火器,请及时处理", + 卸油后长时间未清理现场: "请注意,卸油后长时间未清理现场,请及时处理", + 油罐车长时间无人卸油: "请注意,油罐车长时间无人卸油,请及时处理", + 卸油前未按规定连接卸油管: "请注意,卸油前未按规定连接卸油管,请及时处理", + 卸油中未按规定全程监卸: "请注意,卸油中未按规定全程监卸,请及时处理", + 疑似烟雾: `请注意,${CameraNo}疑似出现烟雾,请及时处理`, + 疑似明火: `请注意,${CameraNo}疑似出现明火,请及时处理`, "收银员未穿工装/非工作人员闯入收银区": - "../../../assets/sound/gongzhuang.mp3", - default: "../../../assets/sound/warning.mp3", + "请注意,收银员未穿工装或非工作人员闯入收银区,请及时处理", + }; + if (violationName == "前庭有顾客疑似抽烟") { + window.speechSynthesis.cancel(); + } + if ( + violationName == "前庭有顾客接打电话" && + this.playingViolationName !== "前庭有顾客疑似抽烟" + ) { + window.speechSynthesis.cancel(); + } + + // 如果你想控制语速、音量或声音等 + this.msg.text = + soundMap[violationName] || "请注意,收到一条新的预警信息,请及时处理"; + this.msg.rate = 0.8; // 语速,默认值为1 + this.msg.volume = 1; // 音量,0到1之间 + this.msg.lang = "zh-CN"; // 语言,支持多种语言 + + this.playingViolationName = violationName; + window.speechSynthesis.speak(this.msg); + + // 监听语音结束事件 + this.msg.onend = () => { + this.playingViolationName = ""; }; - const audioUrl = soundMap[violationName] || soundMap.default; - var player = new Audio(audioUrl); - player.play(); //播放 mp3这个音频对象 + // let violationName = + // userNotification.notification.data.properties.ViolationName; + // const soundMap = { + // 油罐区非工作人员闯入: "../../../assets/sound/chuangru.mp3", + // 进出口长时间停放车辆: "../../../assets/sound/jinchukou.mp3", + // 前庭有顾客疑似抽烟: "../../../assets/sound/chouyan.mp3", + // 前庭有顾客接打电话: "../../../assets/sound/dadianhua.mp3", + // 卸油前未按规定设置隔离: "../../../assets/sound/xygeli.mp3", + // 卸油后未按规定拆除卸油管: "../../../assets/sound/xychaichuxyguan.mp3", + // 卸油前未按规定连接静电接地: "../../../assets/sound/xyjiedi.mp3", + // 卸油前未按规定放置灭火器: "../../../assets/sound/xymiehuoqi.mp3", + // 卸油后长时间未清理现场: "../../../assets/sound/xyxianchang.mp3", + // 油罐车长时间无人卸油: "../../../assets/sound/xywuren.mp3", + // 卸油前未按规定连接卸油管: "../../../assets/sound/xyxieyouguan.mp3", + // 卸油中未按规定全程监卸: "../../../assets/sound/xyjianxie.mp3", + // 疑似烟雾: "../../../assets/sound/yanwu.mp3", + // 疑似明火: "../../../assets/sound/minghuo.mp3", + // "收银员未穿工装/非工作人员闯入收银区": + // "../../../assets/sound/gongzhuang.mp3", + // default: "../../../assets/sound/warning.mp3", + // }; + // const audioUrl = soundMap[violationName] || soundMap.default; + // var player = new Audio(audioUrl); + // player.play(); //播放 mp3这个音频对象 } modalData; diff --git a/src/app/pages/singlelogin/singlelogin.component.ts b/src/app/pages/singlelogin/singlelogin.component.ts index 87f7093..466a431 100644 --- a/src/app/pages/singlelogin/singlelogin.component.ts +++ b/src/app/pages/singlelogin/singlelogin.component.ts @@ -170,7 +170,7 @@ export class SingleloginComponent implements OnInit { resolve(); }, (err) => { - alert("SinochemLogin失败"); + alert(err?.error?.error?.message || "SinochemLogin接口请求失败"); reject(); } ); diff --git a/src/app/system-management/or-binding/or-binding.component.html b/src/app/system-management/or-binding/or-binding.component.html index 2cc31b2..ac21658 100644 --- a/src/app/system-management/or-binding/or-binding.component.html +++ b/src/app/system-management/or-binding/or-binding.component.html @@ -6,8 +6,9 @@ {{listConfig.totalCount}}个组织