depotMonitoring.vue 6.7 KB

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