index.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <template>
  2. <view>
  3. <view class="status_bar"></view>
  4. <view class="" style="position: relative;top: 20px;">
  5. <view style="position: fixed;z-index: 100;">
  6. <uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回"
  7. size="16">
  8. <view class="bases_search">
  9. <view class="bases_search_text" @click="clickRight">
  10. <u-icon name="search" class="search" @click="search"></u-icon>
  11. <input type="text" v-model="data.search" placeholder="设备ID搜索" @input="searchinput" disabled/>
  12. </view>
  13. </view>
  14. </uni-nav-bar>
  15. </view>
  16. <image :src="'http://static.yfpyx.com/bigdata_app'+'/image/environment/1.png'" mode="" class="image"></image>
  17. <view class="prevents">
  18. <view class="prevents_item" v-for="item,index in eqlistdata" :key="index" @click="eqdetails(item)">
  19. <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=""
  20. class="prevents_item_img"></image>
  21. <view class="prevents_item_top">
  22. <p>设备名称:{{item.equip_name==""?"无":item.equip_name}}</p>
  23. <p :class="item.is_online==1?'green':'red'" v-text="item.is_online==1?'在线':'离线'"></p>
  24. </view>
  25. <view class="prevents_item_bot">
  26. <p>设备 ID:{{item.equip_id}}</p>
  27. <p>最新上报时间:{{item.uptime|timeFormat()}}</p>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="top" v-if="isTop" @click="top">
  33. <image :src="'http://static.yfpyx.com/bigdata_app'+'/image/6209a98f0cb3b5086f2ca36152c9269.png'" mode=""></image>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. export default {
  39. data() {
  40. return {
  41. page: 1,
  42. size: 10,
  43. eqlistdata: [],
  44. isTop:false
  45. }
  46. },
  47. methods: {
  48. async eqlist() { //设备列表
  49. const res = await this.$myRequest({
  50. url: '/api/api_gateway?method=weather.weather.qxz_page',
  51. data: {
  52. page: this.page,
  53. }
  54. })
  55. this.eqlistdata = this.eqlistdata.concat(res.ids)
  56. console.log(res.ids)
  57. },
  58. clickRight() {
  59. uni.navigateTo({
  60. url: "./search"
  61. })
  62. },
  63. clickLeft() {
  64. uni.switchTab({
  65. url: "../index/index"
  66. })
  67. },
  68. eqdetails(data) {
  69. uni.navigateTo({
  70. url: "./equipment?shebei=" + JSON.stringify(data)
  71. })
  72. },
  73. top() {
  74. uni.pageScrollTo({
  75. scrollTop: 0,
  76. duration: 500
  77. })
  78. }
  79. },
  80. onLoad() {
  81. this.eqlist()
  82. },
  83. onReachBottom() {
  84. this.page++
  85. this.eqlist()
  86. },
  87. onPageScroll(e) { //nvue暂不支持滚动监听,可用bindingx代替
  88. if (e.scrollTop > 200) { //距离大于200时显示
  89. this.isTop = true
  90. } else { //距离小于200时隐藏
  91. this.isTop = false
  92. }
  93. },
  94. }
  95. </script>
  96. <style lang="scss">
  97. /deep/.uni-icons {
  98. font-size: 40rpx !important;
  99. }
  100. .image {
  101. position: fixed;
  102. top: 65px;
  103. width: 100%;
  104. height: 160rpx;
  105. z-index: 555;
  106. }
  107. .bases_search {
  108. width: 60%;
  109. background-color: #FFFFFF;
  110. position: absolute;
  111. top: 10rpx;
  112. left: 50%;
  113. margin-left: -33%;
  114. .bases_search_text {
  115. width: 90%;
  116. margin: 0 auto;
  117. background-color: #F8F8F8;
  118. height: 60rpx;
  119. border-radius: 30rpx;
  120. display: flex;
  121. line-height: 60rpx;
  122. .search {
  123. padding: 0 20rpx;
  124. font-size: 34rpx;
  125. }
  126. input {
  127. width: 80%;
  128. margin-top: 10rpx;
  129. font-size: 28rpx;
  130. }
  131. }
  132. }
  133. .prevents {
  134. width: 100%;
  135. position: absolute;
  136. top: 140px;
  137. .prevents_item {
  138. width: 95%;
  139. margin: 0 auto 30rpx;
  140. border-radius: 10rpx;
  141. box-shadow: 0 0 10rpx #bcb9ca;
  142. padding: 20rpx 40rpx 20rpx 80rpx;
  143. box-sizing: border-box;
  144. position: relative;
  145. .prevents_item_img {
  146. width: 30rpx;
  147. height: 50rpx;
  148. position: absolute;
  149. top: -4rpx;
  150. left: 30rpx;
  151. }
  152. .prevents_item_top {
  153. display: flex;
  154. justify-content: space-between;
  155. height: 60rpx;
  156. border-bottom: 2rpx solid #F4F4F4;
  157. line-height: 60rpx;
  158. font-size: 26rpx;
  159. .red {
  160. color: #ff0000;
  161. }
  162. .green {
  163. color: #7DBB91;
  164. }
  165. }
  166. .prevents_item_bot {
  167. margin-top: 20rpx;
  168. font-size: 26rpx;
  169. color: #BDBDBD;
  170. }
  171. }
  172. }
  173. .top {
  174. position: fixed;
  175. right: 30px;
  176. bottom: 100px;
  177. z-index: 100;
  178. image{
  179. width: 100rpx;
  180. height: 100rpx;
  181. }
  182. }
  183. </style>