mediaMixins.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import { activity, User } from "@/config/api.js";
  2. export default {
  3. data() {
  4. return {
  5. showAudioPop: false,
  6. showVideoPop: false,
  7. videoPopList: {},
  8. };
  9. },
  10. computed: {
  11. curVoiceId() {
  12. //当前正在播放的音频id
  13. return this.$store.state.audioBg.activityId;
  14. },
  15. curAudioPaused() {
  16. //当前音频是否暂停状态
  17. return this.$store.state.audioBg.paused;
  18. },
  19. showAudioBox() {
  20. return this.$store.state.audioBg.parseIntShow;
  21. },
  22. // 播放列表数据
  23. playlistData() {
  24. return this.$store.state.audioJoinPlaylist.playlist;
  25. },
  26. },
  27. methods: {
  28. //点击了回放
  29. async PlayBackAll(item) {
  30. if (!item.BackAudioPlay) {
  31. const res = await activity.getActivityDetail({
  32. ActivityId: item.ActivityId,
  33. });
  34. if (res.Ret === 200) {
  35. item.BackAudioPlay = res.Data;
  36. }
  37. }
  38. this.hasPermission = item.BackAudioPlay.HasPermission;
  39. this.jurisdictionList.ActivityId = item.ActivityId;
  40. if (this.hasPermission == 1) {
  41. item.FileType == 2 ? this.handelVideoPlay(item) : this.audioPlayBack(item);
  42. } else if (this.hasPermission == 2) {
  43. this.jurisdictionList.SellerMobile = item.BackAudioPlay.SellerMobile;
  44. this.jurisdictionList.SellerName = item.BackAudioPlay.SellerName;
  45. this.jurisdictionList.PopupMsg = item.BackAudioPlay.PopupMsg;
  46. this.isShowhasPermission = true;
  47. } else if (this.hasPermission == 3 || this.hasPermission == 4 || this.hasPermission == 5) {
  48. this.jurisdictionList.PopupMsg = item.BackAudioPlay.PopupMsg;
  49. this.applyForIsShow = true;
  50. }
  51. },
  52. //视频的播放事件
  53. handelVideoPlay(item) {
  54. if (this.$store.state.videoPlay.playVideoActId != item.VideoDetail.ActivityId) {
  55. this.$store.commit("videoPlay/palyTimeUpdate", 0);
  56. this.$store.commit("videoPlay/playVideoActivity", item.VideoDetail.ActivityId);
  57. }
  58. this.globalBgAudioManager.stop();
  59. this.videoPopList = item.VideoDetail;
  60. this.showVideoPop = true;
  61. },
  62. //音频的播放事件
  63. audioPlayBack(item) {
  64. this.$store.commit("audioBg/parseIntAudio", true);
  65. // 判断是否为同一个音频
  66. if (this.$store.state.audioBg.indexId == item.ActivityId) {
  67. if (this.globalBgAudioManager.paused) {
  68. this.globalBgAudioManager.play();
  69. } else {
  70. this.globalBgAudioManager.pause();
  71. }
  72. } else {
  73. this.$store.commit("audioBg/addAudio", { list: item.VoiceList, indexId: item.ActivityId, activityId: item.ActivityId, activityTitle: item.VoiceList.Name, recordList: item });
  74. }
  75. this.showAudioPop = true;
  76. },
  77. },
  78. };