【前端】智能库房综合管理系统前端项目
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.

135 lines
3.7 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <template>
  2. <div class="warehouse">
  3. <div class="warehouse-tab">
  4. <ul class="warehouse-nav">
  5. <li :class="{ 'active-nav': activeIndex == 0 }" @click="changeActiveTab(0)">全景图</li>
  6. <li :class="{ 'active-nav': activeIndex == 1 }" @click="changeActiveTab(1)">档案库</li>
  7. <li :class="{ 'active-nav': activeIndex == 2 }" @click="changeActiveTab(2)">整理室</li>
  8. <li :class="{ 'active-nav': activeIndex == 3 }" @click="changeActiveTab(3)">阅览室</li>
  9. </ul>
  10. <component :is="comName" />
  11. </div>
  12. <!-- 摄像头视频 -->
  13. <Video ref="camera" />
  14. </div>
  15. </template>
  16. <script>
  17. import fullView from './fullView/index.vue'
  18. import archivesStorage from './archivesStorage/index.vue'
  19. import collateRoom from './collateRoom/index.vue'
  20. import readRoom from './readRoom/index.vue'
  21. import Video from './module/video'
  22. export default {
  23. name: 'Warehouse3D',
  24. components: { fullView, archivesStorage, readRoom, collateRoom, Video },
  25. data() {
  26. return {
  27. activeIndex: 0
  28. }
  29. },
  30. computed: {
  31. comName: function() {
  32. if (this.activeIndex === 0) {
  33. return 'fullView'
  34. } else if (this.activeIndex === 1) {
  35. return 'archivesStorage'
  36. } else if (this.activeIndex === 2) {
  37. return 'collateRoom'
  38. } else if (this.activeIndex === 3) {
  39. return 'readRoom'
  40. }
  41. return 'fullView'
  42. }
  43. },
  44. mounted() {
  45. // 监听 iframe 传来的值
  46. window.addEventListener('message', this.handleMessageEvent)
  47. },
  48. methods: {
  49. handleMessageEvent(event) {
  50. const _this = this
  51. if (event.data && event.data.data) {
  52. const data = event.data.data
  53. if (data === 'A区') {
  54. _this.activeIndex = 1
  55. } else if (data === 'B区') {
  56. _this.activeIndex = 2
  57. } else if (data === 'C区') {
  58. _this.activeIndex = 3
  59. }
  60. // 摄像头
  61. if (data.includes('CAM')) {
  62. _this.$nextTick(() => {
  63. this.$refs.camera.openVideoVisible = true
  64. // 后期看接口调试变化
  65. this.$refs.camera.videoSrc = 'https://qiniu.aiyxlib.com/1606275873000.mp4'
  66. this.$refs.camera.videoTitle = data
  67. })
  68. }
  69. }
  70. },
  71. changeActiveTab(data) {
  72. this.activeIndex = data
  73. },
  74. destroyed() {
  75. window.removeEventListener('message', this.handleMessageEvent)
  76. }
  77. }
  78. }
  79. </script>
  80. <style lang="scss" scoped>
  81. .warehouse-tab{
  82. color: #3298FA;
  83. .warehouse-nav{
  84. display: flex;
  85. position: absolute;
  86. bottom: 17px;
  87. left: 20px;
  88. z-index: 11;
  89. height: 90px;
  90. min-height: 90px;
  91. padding: 0;
  92. li{
  93. width: 260px;
  94. height: 90px;
  95. line-height: 90px;
  96. text-align: right;
  97. padding-right: 60px;
  98. margin-right: 20px;
  99. font-size: 18px;
  100. position: relative;
  101. cursor: default;
  102. background: url('~@/assets/images/warehouse_tab_bg.png') no-repeat;
  103. &::before{
  104. content: '';
  105. width: 72px;
  106. height: 52px;
  107. position: absolute;
  108. left: 60px;
  109. top: 20px;
  110. }
  111. &:first-child::before{
  112. background: url('~@/assets/images/tab_fullview_logo.png') no-repeat;
  113. }
  114. &:nth-child(2)::before{
  115. background: url('~@/assets/images/tab_archives_logo.png') no-repeat;
  116. }
  117. &:nth-child(3)::before{
  118. background: url('~@/assets/images/tab_collate_logo.png') no-repeat;
  119. }
  120. &:nth-child(4)::before{
  121. background: url('~@/assets/images/tab_read_logo.png') no-repeat;
  122. }
  123. }
  124. .active-nav{
  125. color: #fff;
  126. background: url('~@/assets/images/warehouse_tab_active.png') no-repeat;
  127. }
  128. }
  129. }
  130. </style>