华农3D项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

147 lines
3.8 KiB

7 months ago
7 months ago
7 months ago
6 months ago
6 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
6 months ago
7 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
  1. <template>
  2. <!-- 全景 -->
  3. <div class="page-container">
  4. <div v-show="!isGetClear" class="page-item fullView-left">
  5. <div class="database-title">设备概况</div>
  6. <div class="content-item last-item">
  7. <div class="content-item-title">防火门/卷帘门</div>
  8. <ul class="content-state state-02">
  9. <li class="leakage-warn"><p>3F1#卷帘门</p><span class="leakage-state-tip" /></li>
  10. <li><p>3F2#卷帘门</p><span class="leakage-state-tip" /></li>
  11. <li class="leakage-warn"><p>3F3#卷帘门</p><span class="leakage-state-tip" /></li>
  12. </ul>
  13. </div>
  14. </div>
  15. <!-- 3D -->
  16. <div class="page-3d">
  17. <iframe
  18. id="myIframe"
  19. ref="myIframe"
  20. class="iframe_box"
  21. src="/webThird/index.html"
  22. frameborder="0"
  23. scrolling="no"
  24. style="background-color: transparent;"
  25. />
  26. </div>
  27. <div v-show="!isGetClear" class="fullView-right" style="justify-content: flex-start;">
  28. <Video ref="cameraList" @view-video="handleViewVideo" />
  29. <Alarm />
  30. </div>
  31. <!-- 查看监控视频 -->
  32. <ViewVideo ref="camera" :dialog-open.sync="open" />
  33. </div>
  34. </template>
  35. <script>
  36. import Video from '@/components/video'
  37. import Alarm from '@/components/alarm'
  38. import ViewVideo from '@/components/viewVideo'
  39. export default {
  40. name: 'PageThirdFloor',
  41. components: { Video, Alarm, ViewVideo },
  42. props: {
  43. isGetClear: {
  44. type: Boolean,
  45. default: false
  46. }
  47. },
  48. data() {
  49. return {
  50. open: false
  51. }
  52. },
  53. computed: {
  54. },
  55. async created() {
  56. window.getIframeLoading = this.getIframeLoading // 把vue实例中的方法引用给window对象
  57. },
  58. activated() {
  59. },
  60. beforeDestroy() {
  61. window.removeEventListener('message', this.handleMessageEvent)
  62. },
  63. mounted() {
  64. // const _this = this
  65. this.iframeWin = this.$refs.myIframe.contentWindow
  66. // inframe 加载完成之后
  67. // document.getElementById('myIframe').onload = function() {
  68. // const data = {
  69. // 'deviceId': 'S004',
  70. // 'isAlarm': true
  71. // }
  72. // _this.deviceState(data)
  73. // }
  74. // 监听 iframe 传来的值
  75. window.addEventListener('message', this.handleMessageEvent)
  76. this.$nextTick(() => {
  77. this.$refs.cameraList.cameraList = []
  78. this.$refs.cameraList.getCameraList('2')
  79. })
  80. },
  81. methods: {
  82. // 加载完成状态传值
  83. getIframeLoading(value) {
  84. // console.log(`我是iframe传过来的参数:${value}`)
  85. if (value === 'false') {
  86. const data = [
  87. {
  88. 'deviceId': 'S004',
  89. 'isAlarm': true
  90. },
  91. {
  92. 'deviceId': 'S002',
  93. 'isAlarm': true
  94. }
  95. ]
  96. this.deviceState(data)
  97. }
  98. },
  99. // 传入设备状态data / 给iframe传初始值
  100. deviceState(e) {
  101. this.iframeWin.postMessage({
  102. data: e
  103. }, '*')
  104. },
  105. handleMessageEvent(event) {
  106. if (event.data && event.data.data) {
  107. const data = event.data.data
  108. console.log(data)
  109. // 摄像头
  110. if (data.includes('C')) {
  111. this.open = true
  112. this.$nextTick(() => {
  113. this.$refs.camera.camConfig = {
  114. 'id': data,
  115. 'area_id': '2'
  116. }
  117. this.$refs.camera.getVideoUrl()
  118. })
  119. }
  120. }
  121. },
  122. handleViewVideo(item) {
  123. this.$refs.camera.videoTitle = item.name
  124. this.$refs.camera.openVideo(item.rtsp_url)
  125. }
  126. }
  127. }
  128. </script>
  129. <style lang="scss" scoped>
  130. @import "~@/assets/styles/index.scss";
  131. // .page-3d{
  132. // position: fixed;
  133. // top: 0;
  134. // left: 0;
  135. // width: 100%;
  136. // height: calc(100vh + 336px) !important;
  137. // margin-top: -400px;
  138. // text-align: center;
  139. // }
  140. </style>