depotMonitoring.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  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. this.$api.doRequest('get', '/commonUser/api/checkSession').then(res => {
  81. console.log("checkSession", res)
  82. if (res.data.data == "INVALID") {
  83. uni.showModal({
  84. title: '登录提示',
  85. content: '当前登入信息验证失败,是否重新登录?',
  86. showCancel: true,
  87. confirmText: '登录',
  88. success: (e) => {
  89. if (e.confirm) {
  90. uni.navigateTo({
  91. url: '/pages/public/login'
  92. })
  93. }
  94. },
  95. fail: () => {},
  96. complete: () => {}
  97. })
  98. }
  99. })
  100. var that = this
  101. uni.request({
  102. url: 'https://live.eliangeyun.com/api/v1/device/channellist',
  103. method: 'GET',
  104. success: (res) => {
  105. if (res.statusCode === 200) {
  106. that.videoList = res.data.ChannelList
  107. }
  108. },
  109. fail: (res) => {
  110. console.log("fail::", res)
  111. }
  112. })
  113. this.$api.doRequest('get', '/openServiceInfo/selectCommonCompany', {
  114. phone: this.userInfo.phone
  115. }).then(res => {
  116. if (res.data.code == 200) {
  117. this.init(res.data.data[0].compId)
  118. }
  119. })
  120. console.log("hasLogin", this.hasLogin)
  121. },
  122. methods: {
  123. /**
  124. * 统一跳转接口,拦截未登录路由
  125. * navigator标签现在默认没有转场动画,所以用view
  126. */
  127. navTo(url) {
  128. if (!this.hasLogin) {
  129. url = '/pages/public/login';
  130. }
  131. uni.navigateTo({
  132. url
  133. })
  134. },
  135. init(compId) {
  136. console.log(this.userInfo)
  137. this.$api.doRequest('get', '/warehouseBaseInfo/selectWarehouseSelf', {
  138. compId: compId,
  139. }).then(res => {
  140. if (res.data.data.length != 0) {
  141. console.log('res', res.data.data)
  142. this.warehouseName = res.data.data[0].warehouseName
  143. let _showData = uni.getStorageSync("depotMonitoring")
  144. this.warehouseList = res.data.data;
  145. if (_showData) {
  146. this.warehouseName = _showData.warehouseName
  147. } else {
  148. this.warehouseName = res.data.data[0].warehouseName
  149. }
  150. } else {
  151. this.warehouseList = []
  152. this.warehouseName = '暂无仓库'
  153. }
  154. })
  155. },
  156. warehousechange(e) {
  157. this.warehouseName = this.warehouseList[e[0]].warehouseName
  158. console.log(this.warehouseName)
  159. uni.setStorageSync("depotMonitoring", this.warehouseList[e[0]])
  160. },
  161. gridClick(item) {
  162. var param = "https://live.eliangeyun.com/play.html?serial=" + item.DeviceID + "&code=" + item.ID +
  163. "&aspect=fullscreen"
  164. uni.setStorageSync("mintor", param)
  165. uni.navigateTo({
  166. url: '/pages/user/mintor'
  167. })
  168. console.log("param", param)
  169. }
  170. }
  171. }
  172. </script>
  173. <style lang='scss' scoped>
  174. page {
  175. background: #F5F6FA;
  176. }
  177. .cu-list>.cu-item:after {
  178. border: none;
  179. }
  180. .sign {
  181. width: 35px;
  182. height: 35px;
  183. top: 4px;
  184. }
  185. .sign1 {
  186. width: 76px;
  187. height: 76px;
  188. top: 4px;
  189. }
  190. .wrap {
  191. background: #fff;
  192. margin: 10px;
  193. border-radius: 10px;
  194. padding: 10px;
  195. .title {
  196. font-size: 16px;
  197. font-weight: 700;
  198. }
  199. .dropdown {
  200. display: flex;
  201. margin: 20rpx 0;
  202. justify-content: space-between;
  203. /* border-bottom: 1px solid #EEEEEE; */
  204. padding-bottom: 20rpx;
  205. .left,
  206. .right {
  207. display: flex;
  208. align-items: center;
  209. }
  210. }
  211. }
  212. .video-list {
  213. position: relative;
  214. .video-list-item {
  215. position: relative;
  216. height: 400rpx;
  217. margin: 20rpx 0;
  218. .img-content {
  219. position: relative;
  220. width: 100%;
  221. height: 400rpx;
  222. background: green;
  223. .play {
  224. position: absolute;
  225. width: 100rpx;
  226. height: 100rpx;
  227. top: 0;
  228. bottom: 0;
  229. left: 0;
  230. right: 0;
  231. margin: auto;
  232. z-index: 3;
  233. }
  234. }
  235. .img {}
  236. .video-iframe {
  237. position: absolute;
  238. width: 100%;
  239. height: 100%;
  240. z-index: 1;
  241. border: 0;
  242. }
  243. }
  244. }
  245. .no-content {
  246. text-align: center;
  247. }
  248. </style>