Browse Source

[完善]更新预警播报声音

test-assets
邵佳豪 10 months ago
parent
commit
9ca4e6a7d8
  1. 2
      src/app/app.component.ts
  2. 42
      src/app/pages/home/home.component.ts
  3. 2
      src/app/system-management/user/user.component.html
  4. BIN
      src/assets/sound/chouyan.mp3
  5. BIN
      src/assets/sound/chuangru.mp3
  6. BIN
      src/assets/sound/dadianhua.mp3
  7. BIN
      src/assets/sound/gongzhuang.mp3
  8. BIN
      src/assets/sound/jinchukou.mp3
  9. BIN
      src/assets/sound/minghuo.mp3
  10. BIN
      src/assets/sound/xychaichuxyguan.mp3
  11. BIN
      src/assets/sound/xygeli.mp3
  12. BIN
      src/assets/sound/xyjianxie.mp3
  13. BIN
      src/assets/sound/xyjiedi.mp3
  14. BIN
      src/assets/sound/xymiehuoqi.mp3
  15. BIN
      src/assets/sound/xywuren.mp3
  16. BIN
      src/assets/sound/xyxianchang.mp3
  17. BIN
      src/assets/sound/xyxieyouguan.mp3
  18. BIN
      src/assets/sound/yanwu.mp3

2
src/app/app.component.ts

@ -19,7 +19,7 @@ export class AppComponent {
public token: CacheTokenService, public token: CacheTokenService,
private notificationService: NzNotificationService private notificationService: NzNotificationService
) {} ) {}
VERSION = 20230807; VERSION = 20240513;
ngOnInit(): void { ngOnInit(): void {
this.sayHello(); this.sayHello();
} }

42
src/app/pages/home/home.component.ts

@ -162,7 +162,6 @@ export class HomeComponent implements OnInit {
this.router.events this.router.events
.pipe(filter((event) => event instanceof NavigationEnd)) .pipe(filter((event) => event instanceof NavigationEnd))
.subscribe((event: any) => { .subscribe((event: any) => {
console.log('走这里Elma44',event)
//管理者进入油站页面 //管理者进入油站页面
if (event.url.indexOf("petrolStation") != -1 && !this.isGasStation) { if (event.url.indexOf("petrolStation") != -1 && !this.isGasStation) {
//控制返回按钮显示 //控制返回按钮显示
@ -286,7 +285,6 @@ export class HomeComponent implements OnInit {
abp.event.on("abp.notifications.received", this.reloadPage); abp.event.on("abp.notifications.received", this.reloadPage);
} }
reloadPage = (userNotification) => { reloadPage = (userNotification) => {
console.log("abp.notifications.received收到通知", userNotification); console.log("abp.notifications.received收到通知", userNotification);
if ( if (
@ -306,18 +304,7 @@ export class HomeComponent implements OnInit {
messageId = []; messageId = [];
receiptOfNotification(userNotification) { receiptOfNotification(userNotification) {
if (this.isWarningVoice) { if (this.isWarningVoice) {
// if (!window.speechSynthesis) { this.Sound(userNotification);
// this.message.create("warning", `该游览器不支持语音播报`);
// } else {
// let speakMsg = new SpeechSynthesisUtterance(
// "请注意,收到一条新的预警信息,请及时处理!"
// );
// speakMsg.lang = "zh-CN";
// speakMsg.rate = 1;
// speakMsg.pitch = 1.5;
// window.speechSynthesis.speak(speakMsg);
// }
this.Sound();
} }
if (this.isWarningWindow) { if (this.isWarningWindow) {
let obj = { let obj = {
@ -332,9 +319,30 @@ export class HomeComponent implements OnInit {
this.messageId.push(obj); this.messageId.push(obj);
} }
} }
Sound() { Sound(userNotification) {
var mp3Url = "../../../assets/sound/warning.mp3"; let violationName =
var player = new Audio(mp3Url); 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这个音频对象 player.play(); //播放 mp3这个音频对象
} }
modalData; modalData;

2
src/app/system-management/user/user.component.html

@ -86,7 +86,7 @@
nzTheme="outline"></i>新增</button> nzTheme="outline"></i>新增</button>
</div> </div>
</div> </div>
<div class="tablebox"> <div class="tablebox" #tablebox>
<nz-table #basicTable [nzLoading]="loading" [nzData]="usersLIst" [nzShowPagination]='false' [nzPageSize]='16'> <nz-table #basicTable [nzLoading]="loading" [nzData]="usersLIst" [nzShowPagination]='false' [nzPageSize]='16'>
<thead> <thead>
<tr> <tr>

BIN
src/assets/sound/chouyan.mp3

Binary file not shown.

BIN
src/assets/sound/chuangru.mp3

Binary file not shown.

BIN
src/assets/sound/dadianhua.mp3

Binary file not shown.

BIN
src/assets/sound/gongzhuang.mp3

Binary file not shown.

BIN
src/assets/sound/jinchukou.mp3

Binary file not shown.

BIN
src/assets/sound/minghuo.mp3

Binary file not shown.

BIN
src/assets/sound/xychaichuxyguan.mp3

Binary file not shown.

BIN
src/assets/sound/xygeli.mp3

Binary file not shown.

BIN
src/assets/sound/xyjianxie.mp3

Binary file not shown.

BIN
src/assets/sound/xyjiedi.mp3

Binary file not shown.

BIN
src/assets/sound/xymiehuoqi.mp3

Binary file not shown.

BIN
src/assets/sound/xywuren.mp3

Binary file not shown.

BIN
src/assets/sound/xyxianchang.mp3

Binary file not shown.

BIN
src/assets/sound/xyxieyouguan.mp3

Binary file not shown.

BIN
src/assets/sound/yanwu.mp3

Binary file not shown.
Loading…
Cancel
Save