index.vue 3.5 KB

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