index.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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搜索" disabled/>
  12. </view>
  13. </view>
  14. </uni-nav-bar>
  15. </view>
  16. <image :src="'http://static.yfpyx.com/bigdata_app'+'/image/prevention/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'"
  20. mode="" class="prevents_item_img"></image>
  21. <view class="prevents_item_top">
  22. <p>设备名称:{{item.device_name==""?"无":item.device_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.imei}}</p>
  27. <p>最新上报时间:{{item.addtime|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=forecast.worm_lamp.lamp_list',
  51. data: {
  52. device_type_id: 2,
  53. page: this.page,
  54. size: this.size,
  55. }
  56. })
  57. this.eqlistdata = this.eqlistdata.concat(res.data)
  58. console.log(this.eqlistdata)
  59. },
  60. clickLeft() {
  61. uni.switchTab({
  62. url: "../index/index"
  63. })
  64. },
  65. clickRight() {
  66. uni.navigateTo({
  67. url: "./search"
  68. })
  69. },
  70. eqdetails(data) {
  71. uni.navigateTo({
  72. url: "./equipmentdetails?shebei=" + JSON.stringify(data)
  73. })
  74. },
  75. top() {
  76. uni.pageScrollTo({
  77. scrollTop: 0,
  78. duration: 500
  79. })
  80. }
  81. },
  82. onLoad() {
  83. this.eqlist()
  84. },
  85. onReachBottom() {
  86. this.page++
  87. this.eqlist()
  88. },
  89. onPageScroll(e) { //nvue暂不支持滚动监听,可用bindingx代替
  90. if (e.scrollTop > 200) { //距离大于200时显示
  91. this.isTop = true
  92. } else { //距离小于200时隐藏
  93. this.isTop = false
  94. }
  95. },
  96. }
  97. </script>
  98. <style lang="scss">
  99. /deep/.uni-icons {
  100. font-size: 40rpx !important;
  101. }
  102. .image {
  103. position: fixed;
  104. top: 65px;
  105. width: 100%;
  106. height: 160rpx;
  107. z-index: 555;
  108. }
  109. .bases_search {
  110. width: 60%;
  111. background-color: #FFFFFF;
  112. position: absolute;
  113. top: 10rpx;
  114. left: 50%;
  115. margin-left: -33%;
  116. .bases_search_text {
  117. width: 90%;
  118. margin: 0 auto;
  119. background-color: #F8F8F8;
  120. height: 60rpx;
  121. border-radius: 30rpx;
  122. display: flex;
  123. line-height: 60rpx;
  124. .search {
  125. padding: 0 20rpx;
  126. font-size: 34rpx;
  127. }
  128. input {
  129. width: 80%;
  130. margin-top: 10rpx;
  131. font-size: 28rpx;
  132. }
  133. }
  134. }
  135. .prevents {
  136. width: 100%;
  137. position: absolute;
  138. top: 140px;
  139. .prevents_item {
  140. width: 95%;
  141. margin: 0 auto 30rpx;
  142. border-radius: 10rpx;
  143. box-shadow: 0 0 10rpx #bcb9ca;
  144. padding: 20rpx 40rpx 20rpx 80rpx;
  145. position: relative;
  146. box-sizing: border-box;
  147. .prevents_item_img {
  148. width: 30rpx;
  149. height: 50rpx;
  150. position: absolute;
  151. top: -4rpx;
  152. left: 30rpx;
  153. }
  154. .prevents_item_top {
  155. display: flex;
  156. justify-content: space-between;
  157. height: 60rpx;
  158. border-bottom: 2rpx solid #F4F4F4;
  159. line-height: 60rpx;
  160. font-size: 26rpx;
  161. .red {
  162. color: #ff0000;
  163. }
  164. .green {
  165. color: #7DBB91;
  166. }
  167. }
  168. .prevents_item_bot {
  169. margin-top: 20rpx;
  170. font-size: 26rpx;
  171. color: #BDBDBD;
  172. }
  173. }
  174. }
  175. .top {
  176. position: fixed;
  177. right: 30px;
  178. bottom: 100px;
  179. z-index: 100;
  180. image{
  181. width: 100rpx;
  182. height: 100rpx;
  183. }
  184. }
  185. </style>