index.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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/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?'../../static/image/prevention/6.png':'../../static/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>
  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=forecast.worm_lamp.lamp_list',
  39. data: {
  40. device_type_id: 2,
  41. page: this.page,
  42. size: this.size,
  43. }
  44. })
  45. this.eqlistdata = this.eqlistdata.concat(res.data)
  46. console.log(this.eqlistdata)
  47. },
  48. clickLeft() {
  49. uni.switchTab({
  50. url: "../index/index"
  51. })
  52. },
  53. clickRight() {
  54. uni.navigateTo({
  55. url: "./search"
  56. })
  57. },
  58. eqdetails(data) {
  59. uni.navigateTo({
  60. url: "./equipmentdetails?shebei=" + JSON.stringify(data)
  61. })
  62. }
  63. },
  64. onLoad() {
  65. this.eqlist()
  66. },
  67. onReachBottom() {
  68. this.page++
  69. this.eqlist()
  70. }
  71. }
  72. </script>
  73. <style lang="scss">
  74. /deep/.uni-icons {
  75. font-size: 40rpx !important;
  76. }
  77. .image {
  78. position: fixed;
  79. top: 88px;
  80. width: 100%;
  81. height: 160rpx;
  82. z-index: 555;
  83. }
  84. .prevents {
  85. width: 100%;
  86. position: absolute;
  87. top: 254rpx;
  88. .prevents_item {
  89. width: 95%;
  90. margin: 0 auto 30rpx;
  91. border-radius: 10rpx;
  92. box-shadow: 0 0 10rpx #bcb9ca;
  93. padding: 20rpx 40rpx 20rpx 80rpx;
  94. position: relative;
  95. box-sizing: border-box;
  96. .prevents_item_img {
  97. width: 30rpx;
  98. height: 50rpx;
  99. position: absolute;
  100. top: -4rpx;
  101. left: 30rpx;
  102. }
  103. .prevents_item_top {
  104. display: flex;
  105. justify-content: space-between;
  106. height: 60rpx;
  107. border-bottom: 2rpx solid #F4F4F4;
  108. line-height: 60rpx;
  109. font-size: 26rpx;
  110. .red {
  111. color: #ff0000;
  112. }
  113. .green {
  114. color: #7DBB91;
  115. }
  116. }
  117. .prevents_item_bot {
  118. margin-top: 20rpx;
  119. font-size: 26rpx;
  120. color: #BDBDBD;
  121. }
  122. }
  123. }
  124. </style>