index.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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>
  25. </template>
  26. <script>
  27. export default {
  28. data() {
  29. return {
  30. page: 1,
  31. size: 10,
  32. eqlistdata: [],
  33. }
  34. },
  35. methods: {
  36. async eqlist() { //设备列表
  37. const res = await this.$myRequest({
  38. url: '/api/api_gateway?method=weather.weather.qxz_page',
  39. data: {
  40. page: this.page,
  41. }
  42. })
  43. this.eqlistdata = this.eqlistdata.concat(res.ids)
  44. console.log(res.ids)
  45. },
  46. clickRight() {
  47. uni.navigateTo({
  48. url: "./search"
  49. })
  50. },
  51. clickLeft() {
  52. uni.switchTab({
  53. url: "../index/index"
  54. })
  55. },
  56. eqdetails(data) {
  57. uni.navigateTo({
  58. url: "./equipment?shebei=" + JSON.stringify(data)
  59. })
  60. }
  61. },
  62. onLoad() {
  63. this.eqlist()
  64. },
  65. onReachBottom() {
  66. this.page++
  67. this.eqlist()
  68. }
  69. }
  70. </script>
  71. <style lang="scss">
  72. /deep/.uni-icons {
  73. font-size: 40rpx !important;
  74. }
  75. .image {
  76. position: fixed;
  77. top: 83px;
  78. width: 100%;
  79. height: 160rpx;
  80. z-index: 555;
  81. }
  82. .prevents {
  83. width: 100%;
  84. position: absolute;
  85. top: 244rpx;
  86. .prevents_item {
  87. width: 95%;
  88. margin: 0 auto 30rpx;
  89. border-radius: 10rpx;
  90. box-shadow: 0 0 10rpx #bcb9ca;
  91. padding: 20rpx 40rpx 20rpx 80rpx;
  92. box-sizing: border-box;
  93. position: relative;
  94. .prevents_item_img {
  95. width: 30rpx;
  96. height: 50rpx;
  97. position: absolute;
  98. top: -4rpx;
  99. left: 30rpx;
  100. }
  101. .prevents_item_top {
  102. display: flex;
  103. justify-content: space-between;
  104. height: 60rpx;
  105. border-bottom: 2rpx solid #F4F4F4;
  106. line-height: 60rpx;
  107. font-size: 26rpx;
  108. .red {
  109. color: #ff0000;
  110. }
  111. .green {
  112. color: #7DBB91;
  113. }
  114. }
  115. .prevents_item_bot {
  116. margin-top: 20rpx;
  117. font-size: 26rpx;
  118. color: #BDBDBD;
  119. }
  120. }
  121. }
  122. </style>