audioBg.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // 全局音频背景播放状态管理模块
  2. const audioModules = {
  3. namespaced: true,
  4. state: {
  5. show: false, //是否显示音频弹窗
  6. list: [], //[{url:音频地址,time:音频时长,title:音频标题,}]
  7. activityId: 0, //当前是哪个报告的音频 活动的id
  8. reportId: 0, //文章的id
  9. indexId: 0, //素材库的id
  10. paused: true, //当前是否音频正在播放 true暂停状态
  11. curTime: 0, //当前正在播放的音频播放的时间
  12. activityTitle: "",
  13. multiple: 1, //倍数
  14. parseIntShow: true, //
  15. isDragSlide: false, //是否在拖动进度条
  16. isAudioEnded: false, //
  17. recordList: {}, //记录音频播放的数据
  18. },
  19. mutations: {
  20. addAudio(state, payload) {
  21. state.show = true;
  22. state.list = payload.list;
  23. state.recordList = payload.recordList;
  24. state.activityTitle = payload.activityTitle;
  25. state.activityId = payload.activityId || 0;
  26. state.reportId = payload.reportId || 0;
  27. state.indexId = payload.indexId || 0;
  28. },
  29. // 音频状态
  30. updateAudioPause(state, payload) {
  31. state.paused = payload;
  32. },
  33. setMultiple(state, payload) {
  34. state.multiple = payload;
  35. },
  36. // 更新音频播放进度
  37. updateAudioTime(state, payload) {
  38. state.curTime = Number(payload);
  39. },
  40. //删除当前音频播放
  41. removeAudio(state, payload) {
  42. state.show = false;
  43. state.list = [];
  44. state.recordList = {};
  45. state.activityId = 0;
  46. state.reportId = 0;
  47. state.indexId = 0;
  48. state.curTime = 0;
  49. state.paused = true;
  50. },
  51. parseIntAudio(state, payload) {
  52. state.parseIntShow = payload;
  53. },
  54. setSlide(state, payload) {
  55. state.isDragSlide = payload;
  56. },
  57. setAudioEnd(state, payload) {
  58. state.isAudioEnded = payload;
  59. },
  60. },
  61. };
  62. export default audioModules;