specialColumn.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template>
  2. <view class="container special-column">
  3. <view class="top-content">
  4. <view class="global_card_content column-author" @click="goColumnAuthor">
  5. <text>专栏作者</text>
  6. <van-icon name="arrow" color="#999999" size="16" />
  7. </view>
  8. <view class="global_card_content column-my" @click="goColumnMy" v-if="isAuthor">
  9. <text>我的专栏</text>
  10. <view class="is-info">
  11. <view v-if="!isImproveInformation">待完善信息</view>
  12. <van-icon name="arrow" color="#999999" size="16" />
  13. </view>
  14. </view>
  15. </view>
  16. <view class="column-list-content">
  17. <column-list-content :mySpecialList="mySpecialList" @upDateCollectHandler="upDateCollectHandler" />
  18. <u-loadmore :status="status" icon-type="flower" :load-text="loadText" margin-top="20" v-if="page_no > 1" />
  19. </view>
  20. <Loading />
  21. </view>
  22. </template>
  23. <script>
  24. import ColumnListContent from "../components/columnListContent.vue";
  25. import { purchaserApi } from "@/config/api";
  26. export default {
  27. components: { ColumnListContent },
  28. data() {
  29. return {
  30. mySpecialList: [],
  31. isAuthor: true,
  32. isImproveInformation: true,
  33. refresh: false, //正在下拉
  34. page_no: 1,
  35. pageSize: 10,
  36. status: "loadmore",
  37. loadText: {
  38. loadmore: "上拉加载更多",
  39. loading: "加载中",
  40. nomore: "已经到底了",
  41. },
  42. };
  43. },
  44. methods: {
  45. // 去往专栏作者
  46. goColumnAuthor() {
  47. uni.navigateTo({ url: "/pages-purchaser/columnAuthor/columnAuthor" });
  48. },
  49. // 去往我的专栏
  50. goColumnMy() {
  51. uni.navigateTo({ url: "/pages-purchaser/myColumnDetail/myColumnDetail" });
  52. },
  53. async getYanxuanSpecialList() {
  54. const res = await purchaserApi.yanxuanSpecialList({
  55. PageSize: this.pageSize,
  56. CurrentIndex: this.page_no,
  57. });
  58. if (res.Ret === 200) {
  59. this.status = res.Data.Paging.IsEnd ? "nomore" : "loadmore";
  60. this.isAuthor = res.Data.IsAuthor;
  61. this.isImproveInformation = res.Data.IsImproveInformation;
  62. this.mySpecialList = this.page_no == 1 ? res.Data.List || [] : this.mySpecialList.concat(res.Data.List);
  63. }
  64. },
  65. // 更新收藏
  66. upDateCollectHandler(item) {
  67. this.mySpecialList.forEach((key) => {
  68. if (key.Id === item.Id) {
  69. key.CollectNum = item.IsCollect == 1 ? item.CollectNum - 1 : item.CollectNum + 1;
  70. key.IsCollect = item.IsCollect == 1 ? 0 : 1;
  71. }
  72. });
  73. },
  74. },
  75. onShow() {
  76. this.getYanxuanSpecialList();
  77. },
  78. /** 用户点击分享 */
  79. onShareAppMessage: function (res) {
  80. return {
  81. title: "研选专栏",
  82. path: "/pages-purchaser/specialColumn/specialColumn",
  83. };
  84. },
  85. // 下滑触底
  86. onReachBottom() {
  87. if (this.status == "nomore") return;
  88. this.page_no++;
  89. this.getYanxuanSpecialList();
  90. this.status = "loading";
  91. },
  92. };
  93. </script>
  94. <style lang="scss" scope>
  95. .special-column {
  96. background-color: $uni-bg-color;
  97. padding: 38rpx 35rpx 35rpx;
  98. .top-content {
  99. display: flex;
  100. font-weight: 500;
  101. font-size: 28rpx;
  102. line-height: 40rpx;
  103. color: #333;
  104. margin-bottom: 20rpx;
  105. .column-author,
  106. .column-my {
  107. display: flex;
  108. align-items: center;
  109. justify-content: space-between;
  110. height: 107;
  111. background-color: #fff;
  112. flex: 1;
  113. }
  114. .column-my {
  115. margin-left: 20rpx;
  116. }
  117. .is-info {
  118. display: flex;
  119. align-items: center;
  120. justify-content: flex-end;
  121. view {
  122. color: #999;
  123. font-size: 24rpx;
  124. font-weight: 400;
  125. line-height: 34rpx;
  126. }
  127. }
  128. }
  129. .column-list-content {
  130. border-radius: 16rpx;
  131. background-color: #fff;
  132. /deep/ .column-list-content-detail {
  133. padding: 0 40rpx !important;
  134. border-bottom: 2rpx solid #f0f1f3;
  135. }
  136. }
  137. }
  138. </style>