diff --git a/src/pages/DeviceManage.vue b/src/pages/DeviceManage.vue index 943ba13..458e931 100644 --- a/src/pages/DeviceManage.vue +++ b/src/pages/DeviceManage.vue @@ -357,23 +357,19 @@ export default { this.speech.init().then(() => {}) }, // 播放函数 - play (textContent, id, needcast, i, len) { - if (needcast === '0') { - return - } + play (textContent, id, needcast) { this.speech.speak({ - text: textContent, // 播放的文本内容 + text: needcast === '1' ? textContent : '', // 播放的文本内容 listeners: { // 开始播放 onstart: () => { - this.pkId = id + this.pkId = needcast === '1' ? id : '' }, // 判断播放是否完毕 onend: () => { this.pkId = '' - this.ids.push(id) - if (i === len - 1) { - this._updateWarnTime() + if (needcast === '1') { + this._updateWarnTime([id]) } }, // 恢复播放 @@ -875,16 +871,16 @@ export default { if (res.code === '1') { this.gridArr5 = [...res.srb.device_group_arr] if (this.gridArr5.length > 0) { - this.gridArr5.map((el, i) => { - this.play(el.fault_desc, el.id, el.needcast, i, this.gridArr5.length) + this.gridArr5.map((e, i) => { + this.play(e.fault_desc, e.id, e.needcast) }) } } else { this.Dialog(res.desc) } }, - async _updateWarnTime () { - let res = await updateWarnTime(this.ids) + async _updateWarnTime (id) { + let res = await updateWarnTime(id) if (res.code === '1') { // this.toast(res.desc) } else { diff --git a/src/pages/Setup1.vue b/src/pages/Setup1.vue index 28c3c0a..ae5442e 100644 --- a/src/pages/Setup1.vue +++ b/src/pages/Setup1.vue @@ -28,7 +28,7 @@
- +