index.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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/environment/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.is_online==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.equip_id}}</p>
  12. <p :class="item.is_online==1?'green':'red'" v-text="item.is_online==1?'在线':'离线'"></p>
  13. </view>
  14. <view class="prevents_item_bot">
  15. 最新上报时间:{{item.uptime|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=weather.weather.qxz_page',
  34. data: {
  35. page:this.page,
  36. }
  37. })
  38. this.eqlistdata=this.eqlistdata.concat(res.ids)
  39. console.log(res.ids)
  40. },
  41. clickRight(){
  42. uni.navigateTo({
  43. url:"./search"
  44. })
  45. },
  46. clickLeft(){
  47. uni.switchTab({
  48. url:"../index/index"
  49. })
  50. },
  51. eqdetails(data){
  52. uni.navigateTo({
  53. url:"./equipment?shebei="+JSON.stringify(data)
  54. })
  55. }
  56. },
  57. onLoad(){
  58. this.eqlist()
  59. },
  60. onReachBottom() {
  61. this.page++
  62. this.eqlist()
  63. }
  64. }
  65. </script>
  66. <style lang="scss">
  67. /deep/.uni-icons{
  68. font-size: 40rpx !important;
  69. }
  70. .image{
  71. position: fixed;
  72. top: 43px;
  73. width: 100%;
  74. height: 140rpx;
  75. z-index: 555;
  76. }
  77. .prevents{
  78. width: 100%;
  79. position: absolute;
  80. top: 244rpx;
  81. .prevents_item{
  82. width: 95%;
  83. margin: 0 auto 30rpx;
  84. border-radius: 10rpx;
  85. box-shadow: 0 0 10rpx #bcb9ca;
  86. padding: 20rpx 40rpx 20rpx 80rpx;
  87. box-sizing: border-box;
  88. position: relative;
  89. .prevents_item_img{
  90. width: 30rpx;
  91. height: 50rpx;
  92. position: absolute;
  93. top: -4rpx;
  94. left: 30rpx;
  95. }
  96. .prevents_item_top{
  97. display: flex;
  98. justify-content: space-between;
  99. height: 60rpx;
  100. border-bottom: 2rpx solid #F4F4F4;
  101. line-height: 60rpx;
  102. font-size: 26rpx;
  103. .red{
  104. color: #ff0000;
  105. }
  106. .green{
  107. color: #7DBB91;
  108. }
  109. }
  110. .prevents_item_bot{
  111. margin-top: 20rpx;
  112. font-size: 26rpx;
  113. color: #BDBDBD;
  114. }
  115. }
  116. }
  117. </style>