index.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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="../../static/image/environment/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?'../../static/image/prevention/6.png':'../../static/image/prevention/7.png'" mode=""
  13. class="prevents_item_img"></image>
  14. <view class="prevents_item_top">
  15. <p>设备 ID:{{item.equip_id}}</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.uptime|timeFormat()}}
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. <view class="top" v-if="isTop" @click="top">
  25. <image src="../../static/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=weather.weather.qxz_page',
  43. data: {
  44. page: this.page,
  45. }
  46. })
  47. this.eqlistdata = this.eqlistdata.concat(res.ids)
  48. console.log(res.ids)
  49. },
  50. clickRight() {
  51. uni.navigateTo({
  52. url: "./search"
  53. })
  54. },
  55. clickLeft() {
  56. uni.switchTab({
  57. url: "../index/index"
  58. })
  59. },
  60. eqdetails(data) {
  61. uni.navigateTo({
  62. url: "./equipment?shebei=" + JSON.stringify(data)
  63. })
  64. },
  65. top() {
  66. uni.pageScrollTo({
  67. scrollTop: 0,
  68. duration: 500
  69. })
  70. }
  71. },
  72. onLoad() {
  73. this.eqlist()
  74. },
  75. onReachBottom() {
  76. this.page++
  77. this.eqlist()
  78. },
  79. onPageScroll(e) { //nvue暂不支持滚动监听,可用bindingx代替
  80. if (e.scrollTop > 200) { //距离大于200时显示
  81. this.isTop = true
  82. } else { //距离小于200时隐藏
  83. this.isTop = false
  84. }
  85. },
  86. }
  87. </script>
  88. <style lang="scss">
  89. /deep/.uni-icons {
  90. font-size: 40rpx !important;
  91. }
  92. .image {
  93. position: fixed;
  94. top: 83px;
  95. width: 100%;
  96. height: 160rpx;
  97. z-index: 555;
  98. }
  99. .prevents {
  100. width: 100%;
  101. position: absolute;
  102. top: 140px;
  103. .prevents_item {
  104. width: 95%;
  105. margin: 0 auto 30rpx;
  106. border-radius: 10rpx;
  107. box-shadow: 0 0 10rpx #bcb9ca;
  108. padding: 20rpx 40rpx 20rpx 80rpx;
  109. box-sizing: border-box;
  110. position: relative;
  111. .prevents_item_img {
  112. width: 30rpx;
  113. height: 50rpx;
  114. position: absolute;
  115. top: -4rpx;
  116. left: 30rpx;
  117. }
  118. .prevents_item_top {
  119. display: flex;
  120. justify-content: space-between;
  121. height: 60rpx;
  122. border-bottom: 2rpx solid #F4F4F4;
  123. line-height: 60rpx;
  124. font-size: 26rpx;
  125. .red {
  126. color: #ff0000;
  127. }
  128. .green {
  129. color: #7DBB91;
  130. }
  131. }
  132. .prevents_item_bot {
  133. margin-top: 20rpx;
  134. font-size: 26rpx;
  135. color: #BDBDBD;
  136. }
  137. }
  138. }
  139. .top {
  140. position: fixed;
  141. right: 30px;
  142. bottom: 100px;
  143. z-index: 100;
  144. image{
  145. width: 100rpx;
  146. height: 100rpx;
  147. }
  148. }
  149. </style>