deviceList.vue 3.2 KB

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