index.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <template>
  2. <view>
  3. <view class="status_bar"></view>
  4. <view class="" style="position: relative;top: 64px;">
  5. <view style="position: fixed;z-index: 100;">
  6. <uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="防治系统" right-icon="search" @clickRight="clickRight"
  7. size="16"></uni-nav-bar>
  8. </view>
  9. <image :src="'http://static.yfpyx.com/bigdata_app'+'/image/prevention/1.png'" mode="" class="image"></image>
  10. <view class="prevents">
  11. <view class="prevents_item" v-for="item,index in eqlistdata" :key="index" @click="eqdetails(item)">
  12. <image :src="item.is_online==1?'http://static.yfpyx.com/bigdata_app/image/prevention/6.png':'http://static.yfpyx.com/bigdata_app/image/prevention/7.png'"
  13. mode="" class="prevents_item_img"></image>
  14. <view class="prevents_item_top">
  15. <p>设备 ID:{{item.imei}}</p>
  16. <p :class="item.is_online==1?'green':'red'" v-text="item.is_online==1?'在线':'离线'"></p>
  17. </view>
  18. <view class="prevents_item_bot">
  19. 最新上报时间:{{item.addtime|timeFormat()}}
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. <view class="top" v-if="isTop" @click="top">
  25. <image :src="'http://static.yfpyx.com/bigdata_app'+'/image/6209a98f0cb3b5086f2ca36152c9269.png'" mode=""></image>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. export default {
  31. data() {
  32. return {
  33. page: 1,
  34. size: 10,
  35. eqlistdata: [],
  36. isTop:false
  37. }
  38. },
  39. methods: {
  40. async eqlist() { //设备列表
  41. const res = await this.$myRequest({
  42. url: '/api/api_gateway?method=forecast.worm_lamp.lamp_list',
  43. data: {
  44. device_type_id: 2,
  45. page: this.page,
  46. size: this.size,
  47. }
  48. })
  49. this.eqlistdata = this.eqlistdata.concat(res.data)
  50. console.log(this.eqlistdata)
  51. },
  52. clickLeft() {
  53. uni.switchTab({
  54. url: "../index/index"
  55. })
  56. },
  57. clickRight() {
  58. uni.navigateTo({
  59. url: "./search"
  60. })
  61. },
  62. eqdetails(data) {
  63. uni.navigateTo({
  64. url: "./equipmentdetails?shebei=" + JSON.stringify(data)
  65. })
  66. },
  67. top() {
  68. uni.pageScrollTo({
  69. scrollTop: 0,
  70. duration: 500
  71. })
  72. }
  73. },
  74. onLoad() {
  75. this.eqlist()
  76. },
  77. onReachBottom() {
  78. this.page++
  79. this.eqlist()
  80. },
  81. onPageScroll(e) { //nvue暂不支持滚动监听,可用bindingx代替
  82. if (e.scrollTop > 200) { //距离大于200时显示
  83. this.isTop = true
  84. } else { //距离小于200时隐藏
  85. this.isTop = false
  86. }
  87. },
  88. }
  89. </script>
  90. <style lang="scss">
  91. /deep/.uni-icons {
  92. font-size: 40rpx !important;
  93. }
  94. .image {
  95. position: fixed;
  96. top: 108px;
  97. width: 100%;
  98. height: 160rpx;
  99. z-index: 555;
  100. }
  101. .prevents {
  102. width: 100%;
  103. position: absolute;
  104. top: 140px;
  105. .prevents_item {
  106. width: 95%;
  107. margin: 0 auto 30rpx;
  108. border-radius: 10rpx;
  109. box-shadow: 0 0 10rpx #bcb9ca;
  110. padding: 20rpx 40rpx 20rpx 80rpx;
  111. position: relative;
  112. box-sizing: border-box;
  113. .prevents_item_img {
  114. width: 30rpx;
  115. height: 50rpx;
  116. position: absolute;
  117. top: -4rpx;
  118. left: 30rpx;
  119. }
  120. .prevents_item_top {
  121. display: flex;
  122. justify-content: space-between;
  123. height: 60rpx;
  124. border-bottom: 2rpx solid #F4F4F4;
  125. line-height: 60rpx;
  126. font-size: 26rpx;
  127. .red {
  128. color: #ff0000;
  129. }
  130. .green {
  131. color: #7DBB91;
  132. }
  133. }
  134. .prevents_item_bot {
  135. margin-top: 20rpx;
  136. font-size: 26rpx;
  137. color: #BDBDBD;
  138. }
  139. }
  140. }
  141. .top {
  142. position: fixed;
  143. right: 30px;
  144. bottom: 100px;
  145. z-index: 100;
  146. image{
  147. width: 100rpx;
  148. height: 100rpx;
  149. }
  150. }
  151. </style>