mediaMixins.js 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. methods: {
  24. //点击了回放
  25. async PlayBackAll(item) {
  26. if (!item.BackAudioPlay) {
  27. const res = await activity.getActivityDetail({
  28. ActivityId: item.ActivityId,
  29. });
  30. if (res.Ret === 200) {
  31. item.BackAudioPlay = res.Data;
  32. }
  33. }
  34. this.hasPermission = item.BackAudioPlay.HasPermission;
  35. this.jurisdictionList.ActivityId = item.ActivityId;
  36. if (this.hasPermission == 1) {
  37. item.FileType == 2 ? this.handelVideoPlay(item) : this.audioPlayBack(item);
  38. } else if (this.hasPermission == 2) {
  39. this.jurisdictionList.SellerMobile = item.BackAudioPlay.SellerMobile;
  40. this.jurisdictionList.SellerName = item.BackAudioPlay.SellerName;
  41. this.jurisdictionList.PopupMsg = item.BackAudioPlay.PopupMsg;
  42. this.isShowhasPermission = true;
  43. } else if (this.hasPermission == 3 || this.hasPermission == 4 || this.hasPermission == 5) {
  44. this.jurisdictionList.PopupMsg = item.BackAudioPlay.PopupMsg;
  45. this.applyForIsShow = true;
  46. }
  47. },
  48. //视频的播放事件
  49. handelVideoPlay(item) {
  50. if (this.$store.state.videoPlay.playVideoActId != item.VideoDetail.ActivityId) {
  51. this.$store.commit("videoPlay/palyTimeUpdate", 0);
  52. this.$store.commit("videoPlay/playVideoActivity", item.VideoDetail.ActivityId);
  53. }
  54. this.globalBgAudioManager.stop();
  55. this.videoPopList = item.VideoDetail;
  56. this.showVideoPop = true;
  57. },
  58. //音频的播放事件
  59. audioPlayBack(item) {
  60. this.$store.commit("audioBg/parseIntAudio", true);
  61. // 判断是否为同一个音频
  62. if (this.$store.state.audioBg.activityId == item.ActivityId) {
  63. if (this.globalBgAudioManager.paused) {
  64. this.globalBgAudioManager.play();
  65. } else {
  66. this.globalBgAudioManager.pause();
  67. }
  68. } else {
  69. this.$store.commit("audioBg/addAudio", { list: item.VoiceList, activityId: item.ActivityId, activityTitle: item.ActivityName });
  70. }
  71. this.showAudioPop = true;
  72. },
  73. },
  74. };