index.vue 4.1 KB

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