index.vue 3.5 KB

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