internalTesting.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <view class="container intemal-container">
  3. <view class="content-ul" v-for="item in collectList" :key="item.ProductInteriorId" @click="goDetail(item)">
  4. <view class="li-title">{{ item.Title }}</view>
  5. <view class="li-tiem">{{ item.PublishTime }}</view>
  6. </view>
  7. <u-loadmore :status="status" icon-type="flower" :load-text="loadText" margin-top="20" v-if="page_no > 1" />
  8. <Loading />
  9. </view>
  10. </template>
  11. <script>
  12. import { Reports } from "@/config/api.js";
  13. export default {
  14. data() {
  15. return {
  16. page_no: 1,
  17. pageSize: 10,
  18. status: "loadmore",
  19. refresh: false, //正在下拉
  20. loadText: {
  21. loadmore: "上拉加载更多",
  22. loading: "加载中",
  23. nomore: "已经到底了",
  24. },
  25. collectList: [],
  26. };
  27. },
  28. methods: {
  29. // 获取列表数据
  30. async getList() {
  31. const res = await Reports.getProductInteriorList({
  32. PageSize: this.pageSize,
  33. CurrentIndex: this.page_no,
  34. });
  35. if (res.Ret === 200) {
  36. this.status = res.Data.Paging.IsEnd ? "nomore" : "loadmore";
  37. this.collectList = this.page_no == 1 ? res.Data.List || [] : this.collectList.concat(res.Data.List);
  38. if (this.refresh) {
  39. wx.stopPullDownRefresh();
  40. }
  41. }
  42. },
  43. // 去往详情
  44. goDetail(item) {
  45. uni.navigateTo({
  46. url: "/reportPages/internalDetials/internalDetials?id=" + item.ProductInteriorId,
  47. });
  48. },
  49. },
  50. onLoad() {
  51. this.getList();
  52. },
  53. // 下拉刷新
  54. onPullDownRefresh() {
  55. this.page_no = 1;
  56. this.refresh = true;
  57. this.getList();
  58. },
  59. // 下滑触底
  60. onReachBottom() {
  61. if (this.status == "nomore") return;
  62. this.page_no++;
  63. this.getList();
  64. this.status = "loading";
  65. },
  66. };
  67. </script>
  68. <style lang="scss" scoped>
  69. .intemal-container {
  70. padding: 30rpx;
  71. background-color: #f7f7f7;
  72. .content-ul {
  73. padding: 20rpx 30rpx 20rpx 50rpx;
  74. margin-bottom: 20rpx;
  75. background-color: #fff;
  76. .li-title {
  77. font-weight: 500;
  78. font-size: 30rpx;
  79. line-height: 42rpx;
  80. color: #333333;
  81. padding-bottom: 17rpx;
  82. border-bottom: 1rpx dashed #ececec;
  83. }
  84. .li-tiem {
  85. padding-top: 17rpx;
  86. text-align: right;
  87. font-size: 28rpx;
  88. line-height: 39rpx;
  89. color: #666666;
  90. }
  91. }
  92. }
  93. </style>