internalTesting.vue 2.3 KB

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