depotMonitoring.vue 6.3 KB

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