internalTesting.vue 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <template>
  2. <view class="container intemal-container">
  3. <view class="global_card_content content-ul" v-for="item in collectList" :key="item.ProductInteriorId" @click="goDetail(item)">
  4. <view class="li-title global_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: $uni-bg-color;
  72. .content-ul {
  73. border-top: 4rpx solid #376cbb;
  74. padding: 20rpx;
  75. margin-bottom: 20rpx;
  76. background-color: #fff;
  77. .li-tiem {
  78. padding-top: 17rpx;
  79. font-size: 22rpx;
  80. line-height: 39rpx;
  81. color: #999;
  82. }
  83. }
  84. }
  85. </style>