index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <template>
  2. <div class="app-container">
  3. <!-- 裂解区域子组件 -->
  4. <div v-if="area=='cracking1'">
  5. <cracking1 :area="area" @handleDevClick="handleDevClick"></cracking1>
  6. </div>
  7. <div v-if="area=='cracking2'">
  8. <cracking2 :area="area" @handleDevClick="handleDevClick"></cracking2>
  9. </div>
  10. <div v-if="area=='cracking3'">
  11. <cracking3 :area="area" @handleDevClick="handleDevClick"></cracking3>
  12. </div>
  13. <!-- 视频播放组件 -->
  14. <el-dialog
  15. :title="dialogTitle"
  16. :visible.sync="dialogVisible"
  17. width="80%">
  18. <div class="video-player-container">
  19. <video-player
  20. class="video-player"
  21. ref="videoPlayer"
  22. :playsinline="true"
  23. :options="playerOptions"
  24. style="width: 100%;"
  25. ></video-player>
  26. </div>
  27. </el-dialog>
  28. </div>
  29. </template>
  30. <script>
  31. import { getDevVideoByAreaAndDev } from "@/api/aerial/devVideo";
  32. import { videoPlayer } from "vue-video-player";
  33. import Cracking1 from "@/views/aerial/cracking1/index.vue";
  34. import Cracking2 from "@/views/aerial/cracking2/index.vue";
  35. import Cracking3 from "@/views/aerial/cracking3/index.vue";
  36. export default {
  37. components: {
  38. videoPlayer,
  39. Cracking1,
  40. Cracking2,
  41. Cracking3,
  42. },
  43. props: {},
  44. data() {
  45. return {
  46. areaName: '',
  47. area: '',
  48. dialogVisible: false,
  49. dialogTitle: '',
  50. playerOptions: {
  51. playbackRates: [0.5, 1.0, 1.5, 2.0],
  52. autoplay: true,
  53. muted: false,
  54. loop: true,
  55. preload: "auto",
  56. language: "zh-CN",
  57. aspectRatio: "16:9",
  58. fluid: true,
  59. sources: [
  60. {
  61. type: "video/mp4",
  62. // src: "http://www.html5videoplayer.net/videos/madagascar3.mp4",
  63. src: '',
  64. },
  65. ],
  66. poster: "", // 封面地址
  67. width: document.documentElement.clientWidth,
  68. notSupportedMessage: "加载中......", //允许覆盖Video.js无法播放媒体源时显示的默认信息。
  69. controlBar: {
  70. timeDivider: true, // 当前时间和持续时间的分隔符
  71. durationDisplay: true, // 显示持续时间
  72. remainingTimeDisplay: true, // 是否显示剩余时间功能
  73. fullscreenToggle: true, // 是否显示全屏按钮
  74. },
  75. },
  76. }
  77. },
  78. created() {
  79. this.areaName = this.$route.query.areaName;
  80. this.area = this.$route.query.area;
  81. },
  82. methods: {
  83. handleDevClick(devName) {
  84. this.playerOptions.sources = [
  85. {
  86. type: "video/mp4",
  87. src: '',
  88. },
  89. ];
  90. this.playerOptions.notSupportedMessage = '加载中......';
  91. getDevVideoByAreaAndDev({
  92. "areaName": this.areaName,
  93. "devName": devName,
  94. }).then(response => {
  95. if (response.data != null && response.data != "") {
  96. this.playerOptions.sources = [
  97. {
  98. type: "video/mp4",
  99. src: 'http://localhost:8090'+ response.data.fileUrl,
  100. },
  101. ];
  102. } else {
  103. this.playerOptions.notSupportedMessage = '视频未上传......';
  104. }
  105. this.dialogTitle = this.areaName + " - " + devName;
  106. this.dialogVisible = true;
  107. });
  108. },
  109. }
  110. }
  111. </script>
  112. <style scoped>
  113. /deep/.video-js .vjs-big-play-button {
  114. width: 88px !important;
  115. height: 88px !important;
  116. border-radius: 50% !important;
  117. border: 0;
  118. line-height: 88px;
  119. font-size: 56px;
  120. object-fit: cover;
  121. text-align: center;
  122. background-color: rgba(0, 0, 0, 0.5);
  123. display: none;
  124. }
  125. </style>