index.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <template>
  2. <view class="">
  3. <view class="status_bar"></view>
  4. <view class="" style="position: relative;top: 40px;">
  5. <view style="position: fixed;z-index: 100;">
  6. <uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="监控系统"></uni-nav-bar>
  7. <view class="" style="margin-top: -10rpx;">
  8. <image :src="$imageURL+'/bigdata_app'+'/image/monitor/banner.png'" mode="widthFix"></image>
  9. </view>
  10. </view>
  11. <view class="contenttf" v-if="contenttf">
  12. 暂无数据
  13. </view>
  14. <view class="content" v-else>
  15. <template v-for="(item,index) in listArr">
  16. <equipItem @click.native="itemClick(item)" v-bind:item="item" :key="index">
  17. <view class="content_title">
  18. <view class="" style="font-size:28rpx;color: #999;">
  19. 设备ID:{{item.device_id}}
  20. </view>
  21. <!-- @click.stop="modification(item)" -->
  22. <view class="sim" v-if="item.sim" @click.stop="siminfo(item.sim)">
  23. SIM卡
  24. </view>
  25. </view>
  26. <view class="type-name">
  27. <u-icon name="jiankong" custom-prefix="custom-icon" :class="item.is_online?'icon':'noicon'"></u-icon>
  28. <text>
  29. 监控
  30. </text>
  31. </view>
  32. </equipItem>
  33. </template>
  34. </view>
  35. </view>
  36. <view class="top" v-if="isTop" @click="top">
  37. <image :src="$imageURL+'/bigdata_app'+'/image/6209a98f0cb3b5086f2ca36152c9269.png'" mode=""></image>
  38. </view>
  39. </view>
  40. </template>
  41. <script>
  42. import equipItem from "../../components/equip-item/equip-item"
  43. export default {
  44. data() {
  45. return {
  46. listArr: [],
  47. page: 1,
  48. accessToken: '',
  49. counts: '',
  50. isTop:false,
  51. contenttf:false
  52. }
  53. },
  54. onLoad() {
  55. this.getEquipList()
  56. },
  57. onPullDownRefresh() {
  58. this.page = 1
  59. this.listArr = []
  60. this.getEquipList()
  61. setTimeout(() => {
  62. uni.stopPullDownRefresh()
  63. }, 1000)
  64. },
  65. onReachBottom() {
  66. this.page++
  67. if (this.counts == this.listArr.length) {
  68. return false
  69. }
  70. this.getEquipList()
  71. },
  72. onPageScroll(e) { //nvue暂不支持滚动监听,可用bindingx代替
  73. if (e.scrollTop > 200) { //距离大于200时显示
  74. this.isTop = true
  75. } else { //距离小于200时隐藏
  76. this.isTop = false
  77. }
  78. },
  79. methods: {
  80. async getEquipList() {
  81. const res = await this.$myRequest({
  82. url: '/api/api_gateway?method=camera.camera_manage.list_camera',
  83. data: {
  84. page: this.page,
  85. }
  86. })
  87. console.log(res)
  88. if(res.counts==0){
  89. this.contenttf = true
  90. }else{
  91. this.contenttf = false
  92. }
  93. let data = res.data
  94. let arr = data.map(item => {
  95. item.imei=item.device_id
  96. item.is_online=item.status
  97. return {
  98. ...item,
  99. device_status: item.status
  100. }
  101. })
  102. console.log(res)
  103. console.log(this.listArr)
  104. this.listArr = [...this.listArr, ...arr]
  105. this.accessToken = res.accessToken
  106. this.counts = res.counts
  107. },
  108. clickLeft() {
  109. uni.switchTab({
  110. url: "../index/index"
  111. })
  112. },
  113. itemClick(item) {
  114. // uni.navigateTo({
  115. // url:"/pages/monitor/detail?device_id="+item.device_id+"&accessToken="+this.accessToken
  116. // })
  117. // uni.setStorage({
  118. // key: 'obj',
  119. // data: JSON.stringify({
  120. // device_id: item.device_id,
  121. // accessToken: this.accessToken
  122. // })
  123. // })
  124. uni.navigateTo({
  125. url: "/pages/webview/webview?device_id=" + item.device_id + "&accessToken=" + this.accessToken
  126. })
  127. },
  128. top() {
  129. uni.pageScrollTo({
  130. scrollTop: 0,
  131. duration: 500
  132. })
  133. },
  134. siminfo(sim){
  135. uni.navigateTo({
  136. url: "./sim?simid="+sim
  137. })
  138. }
  139. },
  140. components: {
  141. equipItem
  142. }
  143. }
  144. </script>
  145. <style lang="scss">
  146. image {
  147. width: 100%;
  148. }
  149. .type-name {
  150. color: #999;
  151. display: flex;
  152. justify-content: flex-start;
  153. font-size: 12px;
  154. .icon{
  155. font-size: 32rpx;
  156. color: #18B566;
  157. }
  158. .noicon{
  159. font-size: 32rpx;
  160. color: #f00;
  161. }
  162. text {
  163. margin-left: 10px;
  164. }
  165. }
  166. .contenttf{
  167. position: absolute;
  168. top: 170px;
  169. width: 95%;
  170. left: 2.5%;
  171. text-align: center;
  172. font-size: 20px;
  173. }
  174. .content{
  175. position: absolute;
  176. top: 130px;
  177. width: 95%;
  178. left: 2.5%;
  179. .content_title {
  180. display: flex;
  181. justify-content: space-between;
  182. .sim {
  183. width: 126rpx;
  184. color: #42b983;
  185. height: 40rpx;
  186. text-align: center;
  187. border: 1rpx solid #42b983;
  188. border-radius: 25rpx;
  189. font-size: 24rpx;
  190. line-height: 35rpx;
  191. position: absolute;
  192. top: 100rpx;
  193. right: 20rpx;
  194. }
  195. }
  196. }
  197. .top {
  198. position: fixed;
  199. right: 30px;
  200. bottom: 100px;
  201. z-index: 100;
  202. image{
  203. width: 100rpx;
  204. height: 100rpx;
  205. }
  206. }
  207. </style>