index.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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. <<<<<<< HEAD
  56. path: "../../static/image/fourMoodBase/3.png",//
  57. id: 2
  58. },
  59. {
  60. path: "../../static/image/fourMoodBase/1.png",
  61. id: 3
  62. }, {
  63. path: "../../static/image/fourMoodBase/6.png",
  64. id: 4
  65. }, {
  66. path: "../../static/image/fourMoodBase/5.png",
  67. id: 5
  68. }, {
  69. path: "../../static/image/fourMoodBase/2.png",
  70. id: 6
  71. }, {
  72. path: "../../static/image/fourMoodBase/4.png",
  73. =======
  74. path: "../../static/image/fourMoodBase/scd.png",
  75. id: 2
  76. },
  77. {
  78. path: "../../static/image/fourMoodBase/cbd.png",
  79. id: 3
  80. }, {
  81. path: "../../static/image/fourMoodBase/xycb.png",
  82. id: 4
  83. }, {
  84. path: "../../static/image/fourMoodBase/qxz.png",
  85. id: 5
  86. }, {
  87. path: "../../static/image/fourMoodBase/jk.png",
  88. id: 6
  89. }, {
  90. path: "../../static/image/fourMoodBase/bzy.png",
  91. >>>>>>> a42ee056f94476589573c3821db9815e9f9872e2
  92. id: 7
  93. }
  94. ],
  95. eqlistdata:[]
  96. }
  97. },
  98. methods: {
  99. async eqlist() { //设备列表
  100. const res = await this.$myRequest({
  101. url: '/api/api_gateway?method=forecast.worm_lamp.lamp_list',
  102. data: {
  103. device_type_id: this.current+2,
  104. page:this.page,
  105. size:this.size,
  106. }
  107. })
  108. this.eqlistdata=this.eqlistdata.concat(res.data)
  109. console.log(this.eqlistdata)
  110. },
  111. change(index) { //头部导航栏的点击
  112. console.log(index)
  113. this.page=1
  114. this.eqlistdata=[]
  115. this.current = index
  116. this.eqlist()
  117. },
  118. clickRight(){//搜索
  119. uni.navigateTo({
  120. url:"./search"
  121. })
  122. },
  123. modification(item){
  124. uni.navigateTo({
  125. url:"./modification?data="+JSON.stringify(item)
  126. })
  127. }
  128. },
  129. onLoad(){
  130. this.eqlist()
  131. },
  132. onReachBottom() {
  133. this.page++
  134. this.eqlist()
  135. }
  136. }
  137. </script>
  138. <style lang="scss">
  139. /deep/.uni-icons{
  140. font-size: 40rpx !important;
  141. }
  142. .utabs_box{
  143. width: 100%;
  144. position: fixed;
  145. top: 88px;
  146. background-color: #FFFFFF;
  147. z-index: 100;
  148. .utabs {
  149. width: 95%;
  150. margin: 0 auto;
  151. }
  152. }
  153. .list{
  154. width: 100%;
  155. background-color: #FDFDFD;
  156. margin-top: 280rpx;
  157. margin-bottom: 100rpx;
  158. .list_item{
  159. width: 90%;
  160. margin: 20rpx auto;
  161. padding: 20rpx 20rpx;
  162. box-sizing: border-box;
  163. position: relative;
  164. background-color: #FFFFFF;
  165. box-shadow: 0 0 10rpx #bcb9ca;
  166. .list_item_top{
  167. display: flex;
  168. justify-content: space-between;
  169. .p1{
  170. height: 60rpx;
  171. line-height: 60rpx;
  172. font-size: 28rpx;
  173. image{
  174. width: 40rpx;
  175. height: 40rpx;
  176. vertical-align:text-top;
  177. margin-right: 20rpx;
  178. }
  179. }
  180. .p2{
  181. height: 60rpx;
  182. line-height: 60rpx;
  183. font-size: 28rpx;
  184. color: #42b983;
  185. }
  186. .p_out{
  187. height: 60rpx;
  188. line-height: 60rpx;
  189. font-size: 28rpx;
  190. color: red;
  191. }
  192. }
  193. .list_item_text{
  194. margin-top: 20rpx;
  195. p{
  196. font-size: 24rpx;
  197. color: #636363;
  198. margin-top: 10rpx;
  199. }
  200. p:first-child{
  201. font-size: 28rpx;
  202. font-weight: 700;
  203. }
  204. }
  205. .list_item_btn{
  206. width: 126rpx;
  207. color: #42b983;
  208. height: 40rpx;
  209. text-align: center;
  210. border: 1rpx solid #42b983;
  211. border-radius: 25rpx;
  212. font-size: 24rpx;
  213. line-height: 35rpx;
  214. position: absolute;
  215. top: 136rpx;
  216. right: 20rpx;
  217. }
  218. }
  219. }
  220. </style>