index.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <template>
  2. <view class="status">
  3. <!-- header -->
  4. <cu-custom bgColor="bg-gradual-blue" isBack><view slot="content">设备状态</view></cu-custom>
  5. <!-- section -->
  6. <view v-for="(item, index) in value.value" :key="index" class="bg-white padding-top-sm radius margin-lr margin-top">
  7. <view class="padding-sm">
  8. <view class="padding-bottom-sm text-black text-bold ">车辆状态:即将上线</view>
  9. <view class="padding-bottom-sm text-black text-bold ">电源是否欠压:即将上线</view>
  10. <view class="padding-bottom-sm text-black text-bold ">GPS位置信息:即将上线</view>
  11. <view class="padding-bottom-sm text-black text-bold ">视频信息:即将上线</view>
  12. <view class="padding-bottom-sm text-black text-bold ">疲劳驾驶:即将上线</view>
  13. <view class="padding-bottom-sm text-black text-bold ">驾驶辅助(ADAS):即将上线</view>
  14. <view class="padding-bottom-sm text-black text-bold ">预警信息(DMS):即将上线</view>
  15. <view class="padding-bottom-sm text-black text-bold ">压胎信息:即将上线</view>
  16. <view class="padding-bottom-sm text-black text-bold ">油耗信息:即将上线</view>
  17. </view>
  18. </view>
  19. <van-empty v-if="value.value.length == 0 && value.no_more" description="暂无设备" />
  20. <view v-else :class="!value.no_more && value.pageCount <= value.totalPage ? 'cu-load bg-grey loading margin-top' : 'cu-load bg-grey over margin-top'"></view>
  21. </view>
  22. </template>
  23. <script>
  24. export default {
  25. data() {
  26. return {
  27. value: {
  28. no_more: false, //没有更多
  29. pageCount: 1,
  30. totalPage: 1,
  31. value: []
  32. }
  33. };
  34. },
  35. onLoad() {
  36. this.request()
  37. },
  38. // 页面上拉触底事件
  39. onReachBottom: function() {
  40. this.request();
  41. },
  42. methods: {
  43. async request() {
  44. var { pageCount, totalPage, no_more, value } = JSON.parse(JSON.stringify(this.value));
  45. if(pageCount>totalPage) return false;
  46. var res = await this.$global.request({
  47. url: '/customer/vehicle/',
  48. method: 'get',
  49. header: {
  50. 'Content-Type': 'application/x-www-form-urlencoded',
  51. Authorization: uni.getStorageSync('token')
  52. },
  53. data: { page: pageCount, limit: 20 }
  54. });
  55. pageCount++;
  56. totalPage=res.totalPage;
  57. if(pageCount>totalPage) no_more=true;
  58. value=value.concat(res.data);
  59. this.value={pageCount, totalPage, no_more, value};
  60. }
  61. }
  62. };
  63. </script>
  64. <style lang="scss" scoped></style>