depotMonitoring.vue 6.5 KB

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