audio.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // 全局音频背景播放状态管理模块
  2. const audioModules={
  3. namespaced: true,
  4. state:{
  5. show:false,//是否显示音频弹窗
  6. showBig:false,//显示大弹窗
  7. list:[],//[{url:音频地址,time:音频时长,title:音频标题,}]
  8. index:0,//当前是播放第几个
  9. reportId:0,//当前是哪个报告的音频
  10. voiceId:0,//当前是哪个语音播报的音频
  11. questionId:0,//当前是哪个问答的音频
  12. paused:true,//当前是否音频正在播放 true暂停状态
  13. curTime:0,//当前正在播放的音频播放的时间
  14. recordId:0,//播放记录id
  15. lastType:0,//上次播放的是那种的音频,用于更新媒体播放记录时长中的source
  16. },
  17. mutations: {
  18. addAudio(state,e){
  19. state.show=true
  20. state.list=e.list
  21. state.index=0
  22. state.reportId=e.reportId||0
  23. state.voiceId=e.voiceId||0
  24. state.questionId=e.questionId||0
  25. },
  26. updateAudioIndex(state,e){
  27. state.index=e
  28. },
  29. // 音频状态
  30. updateAudioPause(state,e){
  31. state.paused=e
  32. },
  33. // 更新音频播放进度
  34. updateAudioTime(state,e){
  35. state.curTime=e
  36. },
  37. removeAudio(state,e){
  38. state.show=false
  39. state.list=[]
  40. state.index=0
  41. state.reportId=0
  42. state.voiceId=0
  43. state.questionId=0
  44. state.paused=true
  45. },
  46. //显示弹窗
  47. showPopAudio(state){
  48. state.show=true
  49. },
  50. showBig(state,e){
  51. state.showBig=e
  52. },
  53. // 关闭弹窗
  54. closePopAudio(state){
  55. state.show=false
  56. },
  57. // 设置播放记录id
  58. addAudioRecordId(state,e){
  59. state.recordId=e.recordId
  60. state.lastType=e.source
  61. }
  62. }
  63. }
  64. export default audioModules;