deviceList.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <template>
  2. <view class="container">
  3. <view class="list-item">
  4. <view class="item" v-for="item in chargeList" :key="item.id">
  5. <view class="item-header">
  6. <view class="item-title">
  7. {{i18('设备编号')}}:{{ item.imei }}
  8. </view>
  9. <view class="item-status">
  10. <uni-tag type="success" :text="i18('在线中')" v-if="item.status === 1"></uni-tag>
  11. <uni-tag type="default" :text="i18('已离线')" v-if="item.status === 2"></uni-tag>
  12. </view>
  13. </view>
  14. <view class="item-body">
  15. <view style="font-size: 12px; margin: 5px 0;position: relative">
  16. {{i18('创建时间')}}:{{ item.createTime }}
  17. <view class="item-detail-btn" @click="detail(item)">
  18. {{i18('设备控制')}}
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. import { deviceList } from '@/api/device/device.js';
  28. import i18 from '@/utils/i18.js'
  29. export default {
  30. data() {
  31. return {
  32. startText:"more",
  33. search:{
  34. pageNum:1,
  35. pageSize:6,
  36. reasonable:true,
  37. },
  38. contentText: {
  39. contentdown: i18('点击查看更多'),
  40. contentrefresh: i18('加载中'),
  41. contentnomore: i18('没有更多'),
  42. },
  43. chargeList: [],
  44. };
  45. },
  46. onShow(){
  47. uni.setNavigationBarTitle({
  48. title: this.$t('page.deviceList')
  49. })
  50. },
  51. methods: {
  52. i18(text){
  53. return i18(text)
  54. },
  55. getMore(){
  56. this.search.pageNum++;
  57. this.deviceList();
  58. },
  59. async deviceList() {
  60. deviceList().then(res=>{
  61. this.startText = "more"
  62. this.chargeList = res.data;
  63. if(this.chargeList.length == 1){
  64. this.detail(this.chargeList[0])
  65. }
  66. })
  67. },
  68. detail(item){
  69. let qrcode = item.qrcode;
  70. let imei = item.imei;
  71. let ccid = item.ccid;
  72. uni.navigateTo({
  73. url: '/pages/weitiandi/device/status?qrcode='+qrcode+'&id='+imei+'&ccid='+ccid
  74. });
  75. },
  76. },
  77. created() {
  78. this.deviceList();
  79. },
  80. };
  81. </script>
  82. <style>
  83. .container {
  84. background: rgb(249, 252, 255);
  85. inset: 0;
  86. position: absolute;
  87. }
  88. .list-item {
  89. margin: 0vw;
  90. }
  91. .item {
  92. box-shadow: 0px 5px 27px 0px rgba(195, 195, 195, 0.4);
  93. border-radius: 4px;
  94. background: #FFFFFF;
  95. margin: 4vw;
  96. padding: 4vw;
  97. }
  98. .item-title {
  99. display: inline-block;
  100. float: left;
  101. }
  102. .item-status {
  103. display: inline-block;
  104. float: right;
  105. }
  106. .item-header {
  107. border-bottom: 1px solid lightgray;
  108. height: 4vh;
  109. font-size: 12px;
  110. }
  111. .item-body {
  112. padding-top: 4vw;
  113. line-height: 3vh;
  114. }
  115. .item-time {
  116. color: #545454;
  117. font-size: 12px;
  118. margin-bottom: 4px
  119. }
  120. .item-detail-btn{
  121. position: absolute;
  122. right: 0px;
  123. top:0px;
  124. text-decoration: underline;
  125. }
  126. </style>