online-patrol.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <template>
  2. <view class="body">
  3. <u-navbar
  4. :title="title + '文物管理'"
  5. bgColor="rgba(255,255,255,0.3)"
  6. :placeholder="true"
  7. :autoBack="true"
  8. leftText="返回"
  9. titleStyle="font-weight:bold;color:#7a5831"
  10. ></u-navbar>
  11. <view class="box">
  12. <view>
  13. <view class="justify-between" style="color: #940000; font-size: 36rpx; font-weight: bold; margin-left: 24rpx; margin-top: 40rpx">
  14. <view>文物监控</view>
  15. <view class="gui-margin">[点击预览]</view>
  16. </view>
  17. <view class="gui-card-list">
  18. <view class="gui-card-item" v-for="(item, index) in device_list" :key="index">
  19. <view class="gui-card-img" @click="openVideo(item.device_code)">
  20. <image style="width: 340rpx; height: 240rpx" :src="item.image"></image>
  21. </view>
  22. <text class="gui-card-title gui-block-text gui-text gui-primary-color">{{ item.position }}</text>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. let that = this;
  31. var md5 = require('@/static/js/md5.js');
  32. export default {
  33. data() {
  34. return {
  35. flag: false,
  36. code: '350206-0091',
  37. title: '',
  38. device_list: {}
  39. };
  40. },
  41. onLoad(e) {
  42. that = this;
  43. console.log('传递的参数:');
  44. //当用户点击第一个的时候 跳转到详情页 通过id判断用户点击的是哪一个 根据用户点击的 id 去后端查询这个数据
  45. console.log();
  46. if (e.code) this.code = e.code;
  47. if (e.title) this.title = e.title;
  48. let auth = that.$common.userInfo();
  49. //获取用户权限
  50. if (!(auth === 'undefined' || auth === '' || auth === [] || auth === null) && auth.token !== 'undefined') {
  51. this.$api.userManageCrAuth(
  52. {
  53. main_body_id: 1,
  54. cr_code: this.code
  55. },
  56. function (res) {
  57. console.log(res);
  58. if (res.data !== true) {
  59. that.$common.successToShow('暂无该权限');
  60. return;
  61. }
  62. }
  63. );
  64. }
  65. this.getDevices();
  66. },
  67. methods: {
  68. opens() {
  69. this.flag = !this.flag;
  70. },
  71. closes() {
  72. this.flag = !this.flag;
  73. },
  74. getDevices() {
  75. this.$api.getDevices(
  76. {
  77. code: this.code
  78. },
  79. function (res) {
  80. console.log(res);
  81. that.device_list = res.data;
  82. }
  83. );
  84. },
  85. openGuide(name, address, latitude, longitude) {
  86. // 微信小程序
  87. // #ifdef MP-WEIXIN
  88. //console.log('走的这里', item);
  89. wx.openLocation({
  90. latitude: +latitude, // 纬度
  91. longitude: +longitude, // 经度
  92. name: name, // 地址名称
  93. address: address, // 详细地址
  94. success: function (r) {
  95. console.log(r);
  96. },
  97. fail: function (res) {
  98. console.log('拉起失败啦', res);
  99. }
  100. });
  101. // #endif
  102. },
  103. openVideo(camera_index_code) {
  104. console.log(camera_index_code);
  105. var t = Date.parse(new Date()) / 1000;
  106. //md5
  107. var key = md5.md5(t + '@feichenghuli');
  108. this.webViedoUrl = encodeURIComponent('https://wenwu.16fw.cn/hik_monitor/mobile_monitor.html?t=' + t.toString() + '&key=' + key + '&index_code=' + camera_index_code);
  109. console.log(this.webViedoUrl);
  110. this.$common.navigateTo('/index_fenbao/GuanLi/cr-video?url=' + this.webViedoUrl);
  111. return;
  112. uni.request({
  113. url: 'https://huli-app.wenlvti.net/api/sports/admin/getPreviewUrl',
  114. data: {
  115. camera_index_code: camera_index_code
  116. },
  117. header: {
  118. 'content-type': 'application/x-www-form-urlencoded'
  119. },
  120. method: 'POST',
  121. success: function (res) {
  122. console.log(res);
  123. that.videoUrl = res.data.data.url;
  124. let url = that.videoUrl;
  125. console.log(url);
  126. url = url.replace('http://192.168.10.10:83', 'https://wenwu.16fw.cn/m3u8');
  127. that.videoUrl = url;
  128. console.log(that.videoUrl);
  129. that.showVideo = true;
  130. },
  131. fail: function (err) {}
  132. });
  133. }
  134. }
  135. };
  136. </script>
  137. <style>
  138. .box .info {
  139. display: flex;
  140. justify-content: space-between;
  141. flex-wrap: wrap;
  142. margin: 20rpx;
  143. margin-top: 8px;
  144. }
  145. .box .info > view {
  146. margin-top: 10px;
  147. font-size: 14px;
  148. margin-left: 4px;
  149. color: #940000;
  150. }
  151. .box .u-info {
  152. margin: 20rpx;
  153. }
  154. .box .text {
  155. margin: 20rpx;
  156. }
  157. .box {
  158. height: auto;
  159. width: 100%;
  160. background-image: url('https://huli-app.wenlvti.net/app_static/wuyuan/static/shouhu/wyj-feiyi3-001.png');
  161. background-size: 100% 100%;
  162. background-attachment: fixed;
  163. border-radius: 16px 16px 0 0;
  164. position: relative;
  165. top: -20px;
  166. padding-top: 10rpx;
  167. }
  168. .head {
  169. height: 6px;
  170. width: 60px;
  171. background-color: darkgray;
  172. text-align: center;
  173. margin: 0 auto;
  174. margin-top: 10px;
  175. border-radius: 4px;
  176. }
  177. .body {
  178. background-image: url('https://huli-app.wenlvti.net/app_static/wuyuan/static/wenwu/wyj-jiemian1-BJ.png');
  179. background-size: 100% 100%;
  180. background-attachment: fixed;
  181. padding-bottom: 50rpx;
  182. height: auto;
  183. }
  184. .boxs > view {
  185. overflow: hidden;
  186. width: 355px;
  187. height: 160px;
  188. border-radius: 5px;
  189. margin-bottom: 30px;
  190. }
  191. .text-img-img {
  192. display: flex;
  193. overflow: none;
  194. overflow-x: scroll;
  195. margin-top: 5rpx;
  196. }
  197. .text-img-img > view {
  198. color: #940000;
  199. margin-right: 10px;
  200. }
  201. .text-img-info {
  202. color: #940000;
  203. display: flex;
  204. justify-content: space-between;
  205. }
  206. .text-img {
  207. margin: 14px 10px;
  208. }
  209. .guidance {
  210. background-color: #f8f8f8;
  211. width: 100%;
  212. height: 100rpx;
  213. line-height: 1.5;
  214. }
  215. .guidICON {
  216. margin-top: 3rpx;
  217. }
  218. .gui-card-list {
  219. width: 95%;
  220. display: flex;
  221. flex-wrap: wrap;
  222. justify-content: space-between;
  223. margin: auto;
  224. margin-top: 20rpx;
  225. }
  226. .justify-between {
  227. width: 95%;
  228. display: flex;
  229. flex-wrap: wrap;
  230. justify-content: space-between;
  231. }
  232. .gui-card-item {
  233. margin-bottom: 30rpx;
  234. }
  235. </style>