lcw
This commit is contained in:
@ -23,29 +23,18 @@ class AudioPlayerClass {
|
||||
this.audioPlayer = new Audio(audioPath);
|
||||
this.audioPlayer.loop = loop; // 设置循环播放
|
||||
|
||||
// 监听音频加载完成事件
|
||||
this.audioPlayer.addEventListener('canplaythrough', () => {
|
||||
console.log('音频加载完成,可以播放');
|
||||
this.isLoaded = true;
|
||||
resolve(true);
|
||||
});
|
||||
|
||||
// 监听错误事件
|
||||
this.audioPlayer.addEventListener('error', (error) => {
|
||||
console.error('音频加载错误:', error);
|
||||
console.error('错误代码:', error.code);
|
||||
console.error('音频网络状态:', this.audioPlayer.networkState);
|
||||
console.error('音频就绪状态:', this.audioPlayer.readyState);
|
||||
reject(error);
|
||||
});
|
||||
|
||||
// 预加载音频
|
||||
console.log('开始预加载音频...');
|
||||
this.audioPlayer.load();
|
||||
console.log('音频预加载请求已发送');
|
||||
} catch (error) {
|
||||
console.error('初始化音频播放器失败:', error);
|
||||
console.error('错误详情:', error.stack);
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
@ -79,26 +68,19 @@ class AudioPlayerClass {
|
||||
this.audioPlayer.play()
|
||||
.then(() => {
|
||||
this.isPlaying = true;
|
||||
console.log('音频播放成功');
|
||||
resolve(true);
|
||||
})
|
||||
.catch(error => {
|
||||
if (error.name === 'NotAllowedError') {
|
||||
console.error('播放被浏览器自动播放策略阻止,需要用户交互后才能播放');
|
||||
}
|
||||
reject(error);
|
||||
});
|
||||
.catch(error => reject(error));
|
||||
}, 0);
|
||||
} else {
|
||||
this.audioPlayer.play()
|
||||
.then(() => {
|
||||
this.isPlaying = true;
|
||||
console.log('音频播放成功');
|
||||
resolve(true);
|
||||
})
|
||||
.catch(error => {
|
||||
if (error.name === 'NotAllowedError') {
|
||||
console.error('播放被浏览器自动播放策略阻止,需要用户交互后才能播放');
|
||||
// 浏览器自动播放策略阻止,静默忽略
|
||||
}
|
||||
reject(error);
|
||||
});
|
||||
@ -117,7 +99,6 @@ class AudioPlayerClass {
|
||||
if (this.audioPlayer) {
|
||||
this.audioPlayer.pause();
|
||||
this.isPlaying = false;
|
||||
console.log('音频已暂停');
|
||||
}
|
||||
}
|
||||
|
||||
@ -167,7 +148,6 @@ class AudioPlayerClass {
|
||||
this.audioPlayer = null;
|
||||
this.isLoaded = false;
|
||||
this.isPlaying = false;
|
||||
console.log('音频播放器已销毁');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,8 +14,7 @@ export function isLocalDict(dictCode) {
|
||||
D_GS_BQ_DJ: true, // "岗哨系统标签管理标签等级"
|
||||
D_GS_SSYJ: true, // "岗哨系统四色预警"
|
||||
D_BZ_SF: true, // "是否"
|
||||
BD_BK_CLYJBQ: true, // "车辆预警标签"
|
||||
D_YJXX_CZCSLX: true //常控处置措施类型
|
||||
BD_BK_CLYJBQ: true // "车辆预警标签"
|
||||
};
|
||||
return localDicObj[dictCode];
|
||||
}
|
||||
|
||||
@ -6,10 +6,62 @@ export function getLocalDic(key) {
|
||||
let dicobj = {
|
||||
/** "岗哨系统重点人员预警等级" */
|
||||
D_GS_ZDR_YJDJ: [
|
||||
{ "itemList": null, "id": "01", "zdId": 59588112, "zdbh": "D_GS_ZDR_YJDJ", "zdmc": "一级", "dm": "01", "py": "YJ", "px": 1, "bz": "", "label": "一级", "value": "01", "children": null },
|
||||
{ "itemList": null, "id": "02", "zdId": 59588112, "zdbh": "D_GS_ZDR_YJDJ", "zdmc": "二级", "dm": "02", "py": "EJ", "px": 2, "bz": "", "label": "二级", "value": "02", "children": null },
|
||||
{ "itemList": null, "id": "03", "zdId": 59588112, "zdbh": "D_GS_ZDR_YJDJ", "zdmc": "三级", "dm": "03", "py": "SJ", "px": 3, "bz": "", "label": "三级", "value": "03", "children": null },
|
||||
{ "itemList": null, "id": "04", "zdId": 59588112, "zdbh": "D_GS_ZDR_YJDJ", "zdmc": "四级", "dm": "04", "py": "SJ", "px": 4, "bz": "", "label": "四级", "value": "04", "children": null }
|
||||
{
|
||||
"itemList": null,
|
||||
"id": "01",
|
||||
"zdId": 59588112,
|
||||
"zdbh": "D_GS_ZDR_YJDJ",
|
||||
"zdmc": "一级",
|
||||
"dm": "01",
|
||||
"py": "YJ",
|
||||
"px": 1,
|
||||
"bz": "",
|
||||
"label": "一级",
|
||||
"value": "01",
|
||||
"children": null
|
||||
},
|
||||
{
|
||||
"itemList": null,
|
||||
"id": "02",
|
||||
"zdId": 59588112,
|
||||
"zdbh": "D_GS_ZDR_YJDJ",
|
||||
"zdmc": "二级",
|
||||
"dm": "02",
|
||||
"py": "EJ",
|
||||
"px": 2,
|
||||
"bz": "",
|
||||
"label": "二级",
|
||||
"value": "02",
|
||||
"children": null
|
||||
},
|
||||
{
|
||||
"itemList": null,
|
||||
"id": "03",
|
||||
"zdId": 59588112,
|
||||
"zdbh": "D_GS_ZDR_YJDJ",
|
||||
"zdmc": "三级",
|
||||
"dm": "03",
|
||||
"py": "SJ",
|
||||
"px": 3,
|
||||
"bz": "",
|
||||
"label": "三级",
|
||||
"value": "03",
|
||||
"children": null
|
||||
},
|
||||
{
|
||||
"itemList": null,
|
||||
"id": "04",
|
||||
"zdId": 59588112,
|
||||
"zdbh": "D_GS_ZDR_YJDJ",
|
||||
"zdmc": "四级",
|
||||
"dm": "04",
|
||||
"py": "SJ",
|
||||
"px": 4,
|
||||
"bz": "",
|
||||
"label": "四级",
|
||||
"value": "04",
|
||||
"children": null
|
||||
}
|
||||
],
|
||||
/** 性别 */
|
||||
D_BZ_XB: [
|
||||
@ -235,66 +287,8 @@ export function getLocalDic(key) {
|
||||
"value": "1",
|
||||
"children": null
|
||||
}
|
||||
],
|
||||
]
|
||||
/** 常控处置措施类型 */
|
||||
D_YJXX_CZCSLX: [
|
||||
{
|
||||
"itemList": null,
|
||||
"id": "01",
|
||||
"zdId": 59589206,
|
||||
"zdbh": "D_YJXX_CZCSLX",
|
||||
"zdmc": "抓捕",
|
||||
"dm": "01",
|
||||
"py": "ZP",
|
||||
"px": 1,
|
||||
"bz": "",
|
||||
"label": "抓捕",
|
||||
"value": "01",
|
||||
"children": null
|
||||
},
|
||||
{
|
||||
"itemList": null,
|
||||
"id": "02",
|
||||
"zdId": 59589206,
|
||||
"zdbh": "D_YJXX_CZCSLX",
|
||||
"zdmc": "管控",
|
||||
"dm": "02",
|
||||
"py": "GK",
|
||||
"px": 2,
|
||||
"bz": "",
|
||||
"label": "管控",
|
||||
"value": "02",
|
||||
"children": null
|
||||
},
|
||||
{
|
||||
"itemList": null,
|
||||
"id": "03",
|
||||
"zdId": 59589206,
|
||||
"zdbh": "D_YJXX_CZCSLX",
|
||||
"zdmc": "经营",
|
||||
"dm": "03",
|
||||
"py": "JY",
|
||||
"px": 3,
|
||||
"bz": "",
|
||||
"label": "经营",
|
||||
"value": "03",
|
||||
"children": null
|
||||
},
|
||||
{
|
||||
"itemList": null,
|
||||
"id": "04",
|
||||
"zdId": 59589206,
|
||||
"zdbh": "D_YJXX_CZCSLX",
|
||||
"zdmc": "关注",
|
||||
"dm": "04",
|
||||
"py": "GZ",
|
||||
"px": 4,
|
||||
"bz": "",
|
||||
"label": "关注",
|
||||
"value": "04",
|
||||
"children": null
|
||||
}
|
||||
],
|
||||
}
|
||||
return dicobj[key]
|
||||
};
|
||||
return dicobj[key];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user