index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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="'http://www.hnyfwlw.com:8006/bigdata_app'+'/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?'http://www.hnyfwlw.com:8006/bigdata_app/image/prevention/6.png':'http://www.hnyfwlw.com:8006/bigdata_app/image/prevention/7.png'"
  13. mode="" class="prevents_item_img"></image>
  14. <view class="prevents_item_top">
  15. <p>设备名称:{{item.device_name==""?"无":item.device_name}}</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. <p>设备 ID:{{item.imei}}</p>
  20. <p>最新上报时间:{{item.addtime|timeFormat()}}</p>
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="top">
  26. <view class="backtop" @click="top" v-if="isTop">
  27. <image src="../../static/images/1.png" mode="" class="img0"></image>
  28. </view>
  29. <view class="more">
  30. <view class="box" @click="online" v-show="filtrateTF">
  31. <p>在线</p>
  32. </view>
  33. <view class="box" @click="offline" v-show="filtrateTF">
  34. <p>离线</p>
  35. </view>
  36. <view class="box" @click="complete" v-show="filtrateTF">
  37. <p>全部</p>
  38. </view>
  39. <view @click="filtrate">
  40. <image src="../../static/images/b0bcdb0e3fe8690520f743aa8303bf2.png" mode="" class="img1"></image>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </template>
  46. <script>
  47. export default {
  48. data() {
  49. return {
  50. page: 1,
  51. size: 10,
  52. eqlistdata: [],
  53. isTop:false,
  54. filtrateTF:false,
  55. device_status:""
  56. }
  57. },
  58. methods: {
  59. async eqlist() { //设备列表
  60. const res = await this.$myRequest({
  61. url: '/api/api_gateway?method=forecast.worm_lamp.lamp_list',
  62. data: {
  63. device_type_id: 2,
  64. page: this.page,
  65. size: this.size,
  66. device_status:this.device_status
  67. }
  68. })
  69. this.eqlistdata = this.eqlistdata.concat(res.data)
  70. console.log(this.eqlistdata)
  71. },
  72. clickLeft() {
  73. uni.switchTab({
  74. url: "../index/index"
  75. })
  76. },
  77. clickRight() {
  78. uni.navigateTo({
  79. url: "./search"
  80. })
  81. },
  82. eqdetails(data) {
  83. uni.navigateTo({
  84. url: "./equipmentdetails?shebei=" + JSON.stringify(data)
  85. })
  86. },
  87. filtrate(){
  88. this.filtrateTF = !this.filtrateTF
  89. },
  90. top() {
  91. uni.pageScrollTo({
  92. scrollTop: 0,
  93. duration: 500
  94. })
  95. },
  96. online(){
  97. this.eqlistdata=[]
  98. this.page = 1
  99. this.device_status = 1
  100. this.eqlist()
  101. this.filtrateTF = !this.filtrateTF
  102. },
  103. offline(){
  104. this.eqlistdata=[]
  105. this.page = 1
  106. this.device_status = 0
  107. this.eqlist()
  108. this.filtrateTF = !this.filtrateTF
  109. },
  110. complete(){
  111. this.eqlistdata=[]
  112. this.page = 1
  113. this.device_status = ""
  114. this.eqlist()
  115. this.filtrateTF = !this.filtrateTF
  116. }
  117. },
  118. onLoad() {
  119. this.eqlist()
  120. },
  121. onReachBottom() {
  122. this.page++
  123. this.eqlist()
  124. },
  125. onPageScroll(e) { //nvue暂不支持滚动监听,可用bindingx代替
  126. if (e.scrollTop > 200) { //距离大于200时显示
  127. this.isTop = true
  128. } else { //距离小于200时隐藏
  129. this.isTop = false
  130. }
  131. }
  132. }
  133. </script>
  134. <style lang="scss">
  135. /deep/.uni-icons {
  136. font-size: 40rpx !important;
  137. }
  138. .image {
  139. position: fixed;
  140. top: 88px;
  141. width: 100%;
  142. height: 160rpx;
  143. z-index: 555;
  144. }
  145. .prevents {
  146. width: 100%;
  147. position: absolute;
  148. top: 140px;
  149. .prevents_item {
  150. width: 95%;
  151. margin: 0 auto 30rpx;
  152. border-radius: 10rpx;
  153. box-shadow: 0 0 10rpx #bcb9ca;
  154. padding: 20rpx 40rpx 20rpx 80rpx;
  155. position: relative;
  156. box-sizing: border-box;
  157. .prevents_item_img {
  158. width: 30rpx;
  159. height: 50rpx;
  160. position: absolute;
  161. top: -4rpx;
  162. left: 30rpx;
  163. }
  164. .prevents_item_top {
  165. display: flex;
  166. justify-content: space-between;
  167. height: 60rpx;
  168. border-bottom: 2rpx solid #F4F4F4;
  169. line-height: 60rpx;
  170. font-size: 26rpx;
  171. .red {
  172. color: #ff0000;
  173. }
  174. .green {
  175. color: #7DBB91;
  176. }
  177. }
  178. .prevents_item_bot {
  179. margin-top: 20rpx;
  180. font-size: 26rpx;
  181. color: #BDBDBD;
  182. }
  183. }
  184. }
  185. .top {
  186. position: fixed;
  187. right: 10px;
  188. bottom: 40px;
  189. z-index: 100;
  190. image {
  191. width: 100rpx;
  192. height: 100rpx;
  193. }
  194. .backtop{
  195. display: flex;
  196. justify-content: flex-end;
  197. margin-bottom: 10rpx;
  198. }
  199. .more{
  200. display: flex;
  201. }
  202. .box{
  203. width: 80rpx;
  204. height: 80rpx;
  205. background-color: rgba(161,161,161,0.45);
  206. border-radius: 50%;
  207. text-align: center;
  208. line-height: 80rpx;
  209. box-sizing: border-box;
  210. margin: 14rpx 10rpx 0 0;
  211. color: #fff;
  212. }
  213. }
  214. </style>