depotMonitoring.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. <template>
  2. <view class="wrap">
  3. <view class='title'>库点监控管理</view>
  4. <view class="dropdown">
  5. <view class="left">仓库名称</view>
  6. <view class="right" @click='show1=true'>
  7. <view>{{warehouseName}}</view>
  8. <u-icon name="arrow-right" color=""></u-icon>
  9. <u-picker @confirm="warehousechange" range-key='warehouseName' mode="selector" v-model="show1"
  10. :range="warehouseList"></u-picker>
  11. </view>
  12. </view>
  13. <view class="content no-content" v-if="warehouseName!='山东诸城迈饶库'">暂无视频</view>
  14. <view class="content" v-if="warehouseName=='山东诸城迈饶库'">
  15. <view class='title'>监控视频</view>
  16. <view class="video-list">
  17. <view class=" cu-list grid col-4 no-border">
  18. <view class="cu-item" style='text-align:center;' v-for="(item,index) in videoList"
  19. @click="gridClick(item)">
  20. <view v-if="item.Status == 'ON'">
  21. <image v-if="item.SnapURL" :src="'https://live.eliangeyun.com'+item.SnapURL" class="sign1">
  22. </image>
  23. <view v-else style="background-color: #008000;" class="sign1">
  24. <image src="../../static/img/play-btn.png"
  25. style="width: 80rpx;height: 80rpx;margin-top: 40rpx;"></image>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. <!-- <iframe class='video-iframe' v-show="item.isPlay" :src="item.src" width="" height="" allowfullscreen="true"
  31. webkitallowfullscreen="true" mozallowfullscreen="true"
  32. allow="autoplay; fullscreen; microphone;"></iframe> -->
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. import {
  40. mapState
  41. } from 'vuex';
  42. export default {
  43. components: {
  44. },
  45. data() {
  46. return {
  47. show1: false,
  48. warehouseName: '',
  49. warehouseList: [],
  50. monitorUrl2: '',
  51. videoList: []
  52. }
  53. },
  54. onLoad() {
  55. },
  56. // #ifndef MP
  57. onNavigationBarButtonTap(e) {
  58. const index = e.index;
  59. if (index === 0) {
  60. this.navTo('/pages/set/set');
  61. } else if (index === 1) {
  62. // #ifdef APP-PLUS
  63. const pages = getCurrentPages();
  64. const page = pages[pages.length - 1];
  65. const currentWebview = page.$getAppWebview();
  66. currentWebview.hideTitleNViewButtonRedDot({
  67. index
  68. });
  69. // #endif
  70. uni.navigateTo({
  71. url: '/pages/notice/notice'
  72. })
  73. }
  74. },
  75. // #endif
  76. computed: {
  77. ...mapState(['hasLogin', 'userInfo']),
  78. },
  79. onShow() {
  80. debugger
  81. this.$api.doRequest('get', '/commonUser/api/checkSession').then(res => {
  82. console.log("checkSession", res)
  83. if (res.data.data == "INVALID") {
  84. uni.showModal({
  85. title: '登录提示',
  86. content: '当前登入信息验证失败,是否重新登录?',
  87. showCancel: true,
  88. confirmText: '登录',
  89. success: (e) => {
  90. if (e.confirm) {
  91. uni.navigateTo({
  92. url: '/pages/public/login'
  93. })
  94. }
  95. },
  96. fail: () => {},
  97. complete: () => {}
  98. })
  99. }
  100. })
  101. var that = this
  102. uni.request({
  103. url: 'https://live.eliangeyun.com/api/v1/device/channellist',
  104. method: 'GET',
  105. success: (res) => {
  106. if (res.statusCode === 200) {
  107. that.videoList = res.data.ChannelList
  108. }
  109. },
  110. fail: (res) => {
  111. console.log("fail::", res)
  112. }
  113. })
  114. this.$api.doRequest('get', '/openServiceInfo/selectCommonCompany', {
  115. phone: this.userInfo.phone
  116. }).then(res => {
  117. if (res.data.code == 200) {
  118. this.init(res.data.data[0].compId)
  119. }
  120. })
  121. console.log("hasLogin", this.hasLogin)
  122. },
  123. methods: {
  124. /**
  125. * 统一跳转接口,拦截未登录路由
  126. * navigator标签现在默认没有转场动画,所以用view
  127. */
  128. navTo(url) {
  129. if (!this.hasLogin) {
  130. url = '/pages/public/login';
  131. }
  132. uni.navigateTo({
  133. url
  134. })
  135. },
  136. init(compId) {
  137. console.log(this.userInfo)
  138. this.$api.doRequest('get', '/warehouseBaseInfo/selectWarehouseSelf', {
  139. compId: compId,
  140. }).then(res => {
  141. if (res.data.data.length != 0) {
  142. console.log('res', res.data.data)
  143. this.warehouseName = res.data.data[0].warehouseName
  144. let _showData = uni.getStorageSync("depotMonitoring")
  145. this.warehouseList = res.data.data;
  146. if (_showData) {
  147. this.warehouseName = _showData.warehouseName
  148. } else {
  149. this.warehouseName = res.data.data[0].warehouseName
  150. }
  151. } else {
  152. this.warehouseList = []
  153. this.warehouseName = '暂无仓库'
  154. }
  155. })
  156. },
  157. warehousechange(e) {
  158. this.warehouseName = this.warehouseList[e[0]].warehouseName
  159. console.log(this.warehouseName)
  160. uni.setStorageSync("depotMonitoring", this.warehouseList[e[0]])
  161. },
  162. gridClick(item) {
  163. var param = "https://live.eliangeyun.com/play.html?serial=" + item.DeviceID + "&code=" + item.ID +
  164. "&aspect=fullscreen"
  165. uni.setStorageSync("mintor", param)
  166. uni.navigateTo({
  167. url: '/pages/user/mintor'
  168. })
  169. console.log("param", param)
  170. }
  171. }
  172. }
  173. </script>
  174. <style lang='scss' scoped>
  175. page {
  176. background: #F5F6FA;
  177. }
  178. .cu-list>.cu-item:after {
  179. border: none;
  180. }
  181. .sign {
  182. width: 35px;
  183. height: 35px;
  184. top: 4px;
  185. }
  186. .sign1 {
  187. width: 76px;
  188. height: 76px;
  189. top: 4px;
  190. }
  191. .wrap {
  192. background: #fff;
  193. margin: 10px;
  194. border-radius: 10px;
  195. padding: 10px;
  196. .title {
  197. font-size: 16px;
  198. font-weight: 700;
  199. }
  200. .dropdown {
  201. display: flex;
  202. margin: 20rpx 0;
  203. justify-content: space-between;
  204. /* border-bottom: 1px solid #EEEEEE; */
  205. padding-bottom: 20rpx;
  206. .left,
  207. .right {
  208. display: flex;
  209. align-items: center;
  210. }
  211. }
  212. }
  213. .video-list {
  214. position: relative;
  215. .video-list-item {
  216. position: relative;
  217. height: 400rpx;
  218. margin: 20rpx 0;
  219. .img-content {
  220. position: relative;
  221. width: 100%;
  222. height: 400rpx;
  223. background: green;
  224. .play {
  225. position: absolute;
  226. width: 100rpx;
  227. height: 100rpx;
  228. top: 0;
  229. bottom: 0;
  230. left: 0;
  231. right: 0;
  232. margin: auto;
  233. z-index: 3;
  234. }
  235. }
  236. .img {}
  237. .video-iframe {
  238. position: absolute;
  239. width: 100%;
  240. height: 100%;
  241. z-index: 1;
  242. border: 0;
  243. }
  244. }
  245. }
  246. .no-content {
  247. text-align: center;
  248. }
  249. </style>