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

213 lines
6.0 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
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)">
  6. <span />
  7. <p>全景图</p>
  8. </li>
  9. <li :class="{ 'active-nav': activeIndex == 1 }" @click="changeActiveTab(1)">
  10. <span />
  11. <p>档案库</p>
  12. </li>
  13. <li :class="{ 'active-nav': activeIndex == 2 }" @click="changeActiveTab(2)">
  14. <span />
  15. <p>整理室</p>
  16. </li>
  17. <li :class="{ 'active-nav': activeIndex == 3 }" @click="changeActiveTab(3)">
  18. <span />
  19. <p>阅览室</p>
  20. </li>
  21. </ul>
  22. <component :is="comName" />
  23. </div>
  24. <!-- 摄像头视频 -->
  25. <Video ref="camera" />
  26. </div>
  27. </template>
  28. <script>
  29. import fullView from './fullView/index.vue'
  30. import archivesStorage from './archivesStorage/index.vue'
  31. import collateRoom from './collateRoom/index.vue'
  32. import readRoom from './readRoom/index.vue'
  33. import Video from './module/video'
  34. export default {
  35. name: 'Warehouse3D',
  36. components: { fullView, archivesStorage, readRoom, collateRoom, Video },
  37. data() {
  38. return {
  39. activeIndex: 0
  40. }
  41. },
  42. computed: {
  43. comName: function() {
  44. if (this.activeIndex === 0) {
  45. return 'fullView'
  46. } else if (this.activeIndex === 1) {
  47. return 'archivesStorage'
  48. } else if (this.activeIndex === 2) {
  49. return 'collateRoom'
  50. } else if (this.activeIndex === 3) {
  51. return 'readRoom'
  52. }
  53. return 'fullView'
  54. }
  55. },
  56. mounted() {
  57. // 监听 iframe 传来的值
  58. window.addEventListener('message', this.handleMessageEvent)
  59. if (localStorage.getItem('isDeseCabinetPage')) {
  60. this.activeIndex = 1
  61. localStorage.removeItem('isDeseCabinetPage')
  62. }
  63. },
  64. created() {
  65. // console.log(1111)
  66. // this.initWebSocket()
  67. if (this.$route.params.roomId) {
  68. this.activeIndex = this.$route.params.roomId
  69. }
  70. },
  71. methods: {
  72. handleMessageEvent(event) {
  73. const _this = this
  74. if (event.data && event.data.data) {
  75. const data = event.data.data
  76. if (data === 'A区') {
  77. _this.activeIndex = 1
  78. } else if (data === 'B区') {
  79. _this.activeIndex = 2
  80. } else if (data === 'C区') {
  81. _this.activeIndex = 3
  82. }
  83. // 摄像头
  84. if (data.includes('CAM')) {
  85. _this.$nextTick(() => {
  86. // ToDo....
  87. this.$refs.camera.openVideoVisible = true
  88. // 后期看接口调试变化
  89. this.$refs.camera.videoSrc = 'https://qiniu.aiyxlib.com/1606275873000.mp4'
  90. this.$refs.camera.videoTitle = data
  91. })
  92. }
  93. }
  94. },
  95. changeActiveTab(data) {
  96. this.activeIndex = data
  97. },
  98. destroyed() {
  99. window.removeEventListener('message', this.handleMessageEvent)
  100. }
  101. // ,
  102. // initWebSocket() {
  103. // // 初始化weosocket
  104. // const url = 'ws://192.168.99.65:7071/webSocket'
  105. // const wsuri = url // ws地址
  106. // this.websocket = new WebSocket(wsuri)
  107. // this.websocket.onopen = this.websocketonopen
  108. // this.websocket.onerror = this.websocketonerror
  109. // this.websocket.onmessage = this.websocketonmessage
  110. // this.websocket.onclose = this.websocketclose
  111. // },
  112. // websocketonopen() {
  113. // console.log('WebSocket连接成功')
  114. // // co data = {
  115. // // type: 'user_init',
  116. // // userid: 'xxx'
  117. // // }
  118. // // this.websocket.send(
  119. // // // 发送数据
  120. // // JSON.stringify(data)
  121. // // )
  122. // },
  123. // websocketonerror(e) {
  124. // // 错误
  125. // // this.initWebSocket()
  126. // console.log('WebSocket连接发生错误')
  127. // },
  128. // websocketonmessage(e) {
  129. // // 数据接收
  130. // console.log(e.data)
  131. // var data = JSON.parse(e.data)
  132. // this.$store.commit('SET_ws', data)
  133. // console.log('接收数据')
  134. // // 操作处理...
  135. // },
  136. // websocketsend(agentData) {
  137. // // 数据发送
  138. // this.websocket.send(agentData)
  139. // },
  140. // websocketclose(e) {
  141. // // 关闭
  142. // console.log('WebSocket关闭')
  143. // console.log(JSON.stringify(e))
  144. // }
  145. }
  146. }
  147. </script>
  148. <style lang="scss" scoped>
  149. .warehouse-tab {
  150. color: #3298fa;
  151. .warehouse-nav {
  152. display: flex;
  153. position: absolute;
  154. bottom: 20px;
  155. left: 20px;
  156. z-index: 11;
  157. // width: calc(100vw - 545px);
  158. width: calc(100vw - 800px);
  159. height: 90px;
  160. min-height: 90px;
  161. padding: 0;
  162. li {
  163. display: flex;
  164. flex-wrap: nowrap;
  165. align-items: center;
  166. align-content: center;
  167. justify-content: center;
  168. width: 25%;
  169. height: 90px;
  170. line-height: 90px;
  171. text-align: right;
  172. // padding-right: 20px;
  173. margin-right: 20px;
  174. font-size: 18px;
  175. position: relative;
  176. cursor: default;
  177. background: url("~@/assets/images/warehouse_tab_bg.png") no-repeat;
  178. background-size: 100% 100%;
  179. span {
  180. width: 72px;
  181. height: 52px;
  182. // position: absolute;
  183. // left: 60px;
  184. // top: 20px;
  185. }
  186. p {
  187. // flex: 1;
  188. text-align: left;
  189. }
  190. &:first-child span {
  191. background: url("~@/assets/images/tab_fullview_logo.png") no-repeat;
  192. }
  193. &:nth-child(2) span {
  194. background: url("~@/assets/images/tab_archives_logo.png") no-repeat;
  195. }
  196. &:nth-child(3) span {
  197. background: url("~@/assets/images/tab_collate_logo.png") no-repeat;
  198. }
  199. &:nth-child(4) span {
  200. background: url("~@/assets/images/tab_read_logo.png") no-repeat;
  201. }
  202. }
  203. .active-nav {
  204. color: #fff;
  205. background: url("~@/assets/images/warehouse_tab_active.png") no-repeat;
  206. background-size: 100% 100%;
  207. }
  208. }
  209. }
  210. </style>