index.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <template>
  2. <view>
  3. <view style="position: fixed;z-index: 100;width: 100%;">
  4. <uni-nav-bar right-icon="search" title="设备列表" @clickRight="clickRight"></uni-nav-bar>
  5. </view>
  6. <view class="utabs">
  7. <u-tabs :list="list" :is-scroll="true" :current="current" @change="change" item-width="140" font-size="24" gutter="20"
  8. bar-width="60" active-color="#42b983"></u-tabs>
  9. </view>
  10. <view class="list">
  11. <view class="list_item" v-for="(item,index) in eqlistdata" :key="index">
  12. <view class="list_item_top">
  13. <p class="p1">
  14. <image :src="images[current].path" mode=""></image>
  15. {{item.device_name}}
  16. </p>
  17. <p :class="[item.device_status?'p2':'p_out']">{{item.device_status?"在线":"离线"}}</p>
  18. </view>
  19. <view class="list_item_text">
  20. <p>设备ID:{{item.device_id}}</p>
  21. <p>适配用户:无</p>
  22. <p>添加设备时间:{{item.status_time|timeFormat()}}</p>
  23. </view>
  24. <view class="list_item_btn" @click="modification(item)">
  25. 修改名称
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. export default {
  33. data() {
  34. return {
  35. list: [{
  36. name: "杀虫灯"
  37. }, {
  38. name: "测报灯"
  39. }, {
  40. name: "智能性诱"
  41. }, {
  42. name: "环境检测"
  43. }, {
  44. name: "监控设备"
  45. }, {
  46. name: "孢子仪"
  47. }],
  48. current: 0,
  49. page:1,
  50. size:10,
  51. images: [{
  52. path: "../../static/image/fourMoodBase/杀虫灯.png",
  53. id: 2
  54. },
  55. {
  56. path: "../../static/image/fourMoodBase/测报灯.png",
  57. id: 3
  58. }, {
  59. path: "../../static/image/fourMoodBase/性诱测报.png",
  60. id: 4
  61. }, {
  62. path: "../../static/image/fourMoodBase/环境监测.png",
  63. id: 5
  64. }, {
  65. path: "../../static/image/fourMoodBase/监控.png",
  66. id: 6
  67. }, {
  68. path: "../../static/image/fourMoodBase/孢子仪.png",
  69. id: 7
  70. }
  71. ],
  72. eqlistdata:[]
  73. }
  74. },
  75. methods: {
  76. async eqlist() { //设备列表
  77. const res = await this.$myRequest({
  78. url: '/api/api_gateway?method=forecast.worm_lamp.lamp_list',
  79. data: {
  80. device_type_id: this.current+2,
  81. page:this.page,
  82. size:this.size,
  83. }
  84. })
  85. this.eqlistdata=this.eqlistdata.concat(res.data)
  86. console.log(this.eqlistdata)
  87. },
  88. change(index) { //头部导航栏的点击
  89. console.log(index)
  90. this.page=1
  91. this.eqlistdata=[]
  92. this.current = index
  93. this.eqlist()
  94. },
  95. clickRight(){//搜索
  96. uni.navigateTo({
  97. url:"./search"
  98. })
  99. },
  100. modification(item){
  101. uni.navigateTo({
  102. url:"./modification?data="+JSON.stringify(item)
  103. })
  104. }
  105. },
  106. onLoad(){
  107. this.eqlist()
  108. },
  109. onReachBottom() {
  110. this.page++
  111. this.eqlist()
  112. }
  113. }
  114. </script>
  115. <style lang="scss">
  116. /deep/.uni-icons{
  117. font-size: 40rpx !important;
  118. }
  119. .utabs {
  120. width: 95%;
  121. position: fixed;
  122. top: 44px;
  123. z-index: 100;
  124. }
  125. .list{
  126. width: 100%;
  127. background-color: #FDFDFD;
  128. position: absolute;
  129. top: 180rpx;
  130. margin-bottom: 100rpx;
  131. .list_item{
  132. width: 95%;
  133. margin: 20rpx auto;
  134. padding: 10rpx 20rpx;
  135. position: relative;
  136. background-color: #FFFFFF;
  137. box-shadow: 0 0 10rpx #bcb9ca;
  138. .list_item_top{
  139. display: flex;
  140. justify-content: space-between;
  141. .p1{
  142. height: 60rpx;
  143. line-height: 60rpx;
  144. font-size: 28rpx;
  145. image{
  146. width: 40rpx;
  147. height: 40rpx;
  148. vertical-align:text-top;
  149. margin-right: 20rpx;
  150. }
  151. }
  152. .p2{
  153. height: 60rpx;
  154. line-height: 60rpx;
  155. font-size: 28rpx;
  156. color: #42b983;
  157. }
  158. .p_out{
  159. height: 60rpx;
  160. line-height: 60rpx;
  161. font-size: 28rpx;
  162. color: red;
  163. }
  164. }
  165. .list_item_text{
  166. margin-top: 20rpx;
  167. p{
  168. font-size: 24rpx;
  169. color: #636363;
  170. margin-top: 10rpx;
  171. }
  172. p:first-child{
  173. font-size: 28rpx;
  174. font-weight: 700;
  175. }
  176. }
  177. .list_item_btn{
  178. width: 126rpx;
  179. color: #42b983;
  180. height: 40rpx;
  181. text-align: center;
  182. border: 1rpx solid #42b983;
  183. border-radius: 25rpx;
  184. font-size: 24rpx;
  185. line-height: 35rpx;
  186. position: absolute;
  187. top: 136rpx;
  188. right: 20rpx;
  189. }
  190. }
  191. }
  192. </style>