index.vue 3.5 KB

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