index.vue 4.2 KB

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