index.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <template>
  2. <view>
  3. <view style="position: fixed;z-index: 100;">
  4. <uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="防治系统" right-icon="search" @clickRight="clickRight" size="16"></uni-nav-bar>
  5. </view>
  6. <image src="../../static/image/prevention/1.png" mode="" class="image"></image>
  7. <view class="prevents">
  8. <view class="prevents_item" v-for="item,index in eqlistdata" :key="index" @click="eqdetails(item)">
  9. <image :src="item.device_status==1?'../../static/image/prevention/6.png':'../../static/image/prevention/7.png'" mode="" class="prevents_item_img"></image>
  10. <view class="prevents_item_top">
  11. <p>设备 ID:{{item.device_id}}</p>
  12. <p :class="item.device_status==1?'green':'red'" v-text="item.device_status==1?'在线':'离线'"></p>
  13. </view>
  14. <view class="prevents_item_bot">
  15. 最新上报时间:{{item.status_time|timeFormat()}}
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. export default {
  23. data() {
  24. return {
  25. page:1,
  26. size:10,
  27. eqlistdata:[],
  28. }
  29. },
  30. methods: {
  31. async eqlist() { //设备列表
  32. const res = await this.$myRequest({
  33. url: '/api/api_gateway?method=forecast.worm_lamp.lamp_list',
  34. data: {
  35. device_type_id: 2,
  36. page:this.page,
  37. size:this.size,
  38. }
  39. })
  40. this.eqlistdata=this.eqlistdata.concat(res.data)
  41. console.log(this.eqlistdata)
  42. },
  43. clickLeft(){
  44. uni.switchTab({
  45. url:"../index/index"
  46. })
  47. },
  48. clickRight(){
  49. uni.navigateTo({
  50. url:"./search"
  51. })
  52. },
  53. eqdetails(data){
  54. uni.navigateTo({
  55. url:"./equipmentdetails?shebei="+JSON.stringify(data)
  56. })
  57. }
  58. },
  59. onLoad(){
  60. this.eqlist()
  61. },
  62. onReachBottom() {
  63. this.page++
  64. this.eqlist()
  65. }
  66. }
  67. </script>
  68. <style lang="scss">
  69. /deep/.uni-icons{
  70. font-size: 40rpx !important;
  71. }
  72. .image{
  73. position: fixed;
  74. top: 44px;
  75. width: 100%;
  76. height: 140rpx;
  77. z-index: 555;
  78. }
  79. .prevents{
  80. width: 100%;
  81. position: absolute;
  82. top: 244rpx;
  83. .prevents_item{
  84. width: 95%;
  85. margin: 0 auto 30rpx;
  86. border-radius: 10rpx;
  87. box-shadow: 0 0 10rpx #bcb9ca;
  88. padding: 20rpx 40rpx 20rpx 80rpx;
  89. position: relative;
  90. box-sizing: border-box;
  91. .prevents_item_img{
  92. width: 30rpx;
  93. height: 50rpx;
  94. position: absolute;
  95. top: -4rpx;
  96. left: 30rpx;
  97. }
  98. .prevents_item_top{
  99. display: flex;
  100. justify-content: space-between;
  101. height: 60rpx;
  102. border-bottom: 2rpx solid #F4F4F4;
  103. line-height: 60rpx;
  104. font-size: 26rpx;
  105. .red{
  106. color: #ff0000;
  107. }
  108. .green{
  109. color: #7DBB91;
  110. }
  111. }
  112. .prevents_item_bot{
  113. margin-top: 20rpx;
  114. font-size: 26rpx;
  115. color: #BDBDBD;
  116. }
  117. }
  118. }
  119. </style>