Browse Source

[修改]预警声音修改

test-assets
邵佳豪 5 months ago
parent
commit
15340ce75e
  1. 4
      proxy.config.json
  2. 2
      src/app/app.component.ts
  3. 87
      src/app/pages/home/home.component.ts
  4. 2
      src/app/pages/singlelogin/singlelogin.component.ts
  5. 5
      src/app/system-management/or-binding/or-binding.component.html
  6. 29
      src/app/system-management/or-binding/or-binding.component.ts

4
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"

2
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();
}

87
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;

2
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();
}
);

5
src/app/system-management/or-binding/or-binding.component.html

@ -6,8 +6,9 @@
<span><i nz-icon nzType="search"></i> {{listConfig.totalCount}}个组织</span>
</div>
<div class="righttop">
<button nz-button nzType="primary" style="margin-right: 12px;" (click)="sync()">同步数据</button>
<button nz-button nzType="primary" style="margin-right: 12px;" (click)="syncOr()">全量同步机构</button>
<button nz-button nzType="primary" style="margin-right: 12px;" (click)="syncUser()">全量同步用户</button>
<!-- <button nz-button nzType="primary" style="margin-right: 12px;" (click)="sync()">同步数据</button> -->
<label class="isBinding" nz-checkbox [(ngModel)]="listConfig.IsBindingLocal"
(ngModelChange)="submitForm()">是否绑定本地机构</label>
<form nz-form [formGroup]="validateForm" (ngSubmit)="submitForm()">

29
src/app/system-management/or-binding/or-binding.component.ts

@ -123,10 +123,33 @@ export class OrBindingComponent implements OnInit {
modal.afterClose.subscribe((result) => this.getAllOr());
}
sync() {
// sync() {
// this.http
// .post("/api/services/app/OrganizationSync/AutoSinochemOrgRelate", null)
// .subscribe((data: any) => {
// this.message.create("success", "同步成功");
// });
// }
syncOr() {
this.http
.post("/api/services/app/OrganizationSync/AutoSinochemOrgRelate", null)
.subscribe((data: any) => {
.post("/api/services/app/OrganizationSync/SyncOrgFromSinochem", null)
.subscribe(() => {
this.http
.post(
"/api/services/app/OrganizationSync/AutoSinochemOrgRelate",
null
)
.subscribe(() => {
this.message.create("success", "同步成功");
});
});
}
syncUser() {
this.http
.post("/api/services/app/OrganizationSync/SyncUserFromSinochem", null)
.subscribe(() => {
this.message.create("success", "同步成功");
});
}

Loading…
Cancel
Save