Commit cc2425f4355154bf36c32ca0321c835e05a9a596
1 parent
3765f9b4
feat: remove from list when invalid
Showing
1 changed file
with
16 additions
and
0 deletions
pages/result/result.js
| ... | ... | @@ -30,6 +30,22 @@ Page({ |
| 30 | 30 | audio = wx.createInnerAudioContext({useWebAudioImplement: true}); |
| 31 | 31 | audio.autoplay = true; |
| 32 | 32 | audio.src = target.path; |
| 33 | + // 播放失败要移除缓存内容 | |
| 34 | + audio.onError(err => { | |
| 35 | + wx.showModal({ | |
| 36 | + title: '提示', | |
| 37 | + content: '该语音缓存失效,点击确定删除', | |
| 38 | + success: res => { | |
| 39 | + if(!res.confirm){ | |
| 40 | + return; | |
| 41 | + } | |
| 42 | + const newList = app.globalData.setAudioList('delete', target.path); | |
| 43 | + this.setData({ | |
| 44 | + audioList: formateDate(newList) | |
| 45 | + }); | |
| 46 | + } | |
| 47 | + }); | |
| 48 | + }); | |
| 33 | 49 | }, |
| 34 | 50 | download(e){ |
| 35 | 51 | const { path } = e.target.dataset; | ... | ... |