index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  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/environment/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'" mode=""
  13. class="prevents_item_img"></image>
  14. <view class="prevents_item_top">
  15. <p>设备名称:{{item.equip_name==""?"无":item.equip_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.equip_id}}</p>
  20. <p>最新上报时间:{{item.uptime|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=weather.weather.qxz_page',
  62. data: {
  63. page: this.page,
  64. device_status:this.device_status,
  65. page_size:10
  66. }
  67. })
  68. this.eqlistdata = this.eqlistdata.concat(res.ids)
  69. console.log(res.ids)
  70. },
  71. clickRight() {
  72. uni.navigateTo({
  73. url: "./search"
  74. })
  75. },
  76. clickLeft() {
  77. uni.switchTab({
  78. url: "../index/index"
  79. })
  80. },
  81. eqdetails(data) {
  82. uni.navigateTo({
  83. url: "./equipment?shebei=" + JSON.stringify(data)
  84. })
  85. },
  86. filtrate(){
  87. this.filtrateTF = !this.filtrateTF
  88. },
  89. top() {
  90. uni.pageScrollTo({
  91. scrollTop: 0,
  92. duration: 500
  93. })
  94. },
  95. online(){
  96. this.eqlistdata=[]
  97. this.page = 1
  98. this.device_status = 1
  99. this.eqlist()
  100. this.filtrateTF = !this.filtrateTF
  101. },
  102. offline(){
  103. this.eqlistdata=[]
  104. this.page = 1
  105. this.device_status = 0
  106. this.eqlist()
  107. this.filtrateTF = !this.filtrateTF
  108. },
  109. complete(){
  110. this.eqlistdata=[]
  111. this.page = 1
  112. this.device_status = ""
  113. this.eqlist()
  114. this.filtrateTF = !this.filtrateTF
  115. }
  116. },
  117. onLoad() {
  118. this.eqlist()
  119. },
  120. onReachBottom() {
  121. this.page++
  122. this.eqlist()
  123. },
  124. onPageScroll(e) { //nvue暂不支持滚动监听,可用bindingx代替
  125. if (e.scrollTop > 200) { //距离大于200时显示
  126. this.isTop = true
  127. } else { //距离小于200时隐藏
  128. this.isTop = false
  129. }
  130. },
  131. }
  132. </script>
  133. <style lang="scss">
  134. /deep/.uni-icons {
  135. font-size: 40rpx !important;
  136. }
  137. .image {
  138. position: fixed;
  139. top: 83px;
  140. width: 100%;
  141. height: 160rpx;
  142. z-index: 555;
  143. }
  144. .prevents {
  145. width: 100%;
  146. position: absolute;
  147. top: 140px;
  148. .prevents_item {
  149. width: 95%;
  150. margin: 0 auto 30rpx;
  151. border-radius: 10rpx;
  152. box-shadow: 0 0 10rpx #bcb9ca;
  153. padding: 20rpx 40rpx 20rpx 80rpx;
  154. box-sizing: border-box;
  155. position: relative;
  156. .prevents_item_img {
  157. width: 30rpx;
  158. height: 50rpx;
  159. position: absolute;
  160. top: -4rpx;
  161. left: 30rpx;
  162. }
  163. .prevents_item_top {
  164. display: flex;
  165. justify-content: space-between;
  166. height: 60rpx;
  167. border-bottom: 2rpx solid #F4F4F4;
  168. line-height: 60rpx;
  169. font-size: 26rpx;
  170. .red {
  171. color: #ff0000;
  172. }
  173. .green {
  174. color: #7DBB91;
  175. }
  176. }
  177. .prevents_item_bot {
  178. margin-top: 20rpx;
  179. font-size: 26rpx;
  180. color: #BDBDBD;
  181. }
  182. }
  183. }
  184. .top {
  185. position: fixed;
  186. right: 10px;
  187. bottom: 40px;
  188. z-index: 100;
  189. image {
  190. width: 100rpx;
  191. height: 100rpx;
  192. }
  193. .backtop{
  194. display: flex;
  195. justify-content: flex-end;
  196. margin-bottom: 10rpx;
  197. }
  198. .more{
  199. display: flex;
  200. }
  201. .box{
  202. width: 80rpx;
  203. height: 80rpx;
  204. background-color: rgba(161,161,161,0.45);
  205. border-radius: 50%;
  206. text-align: center;
  207. line-height: 80rpx;
  208. box-sizing: border-box;
  209. margin: 14rpx 10rpx 0 0;
  210. color: #fff;
  211. }
  212. }
  213. </style>