index.vue 4.8 KB

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