specialColumn.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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. if (this.refresh) {
  64. uni.stopPullDownRefresh();
  65. this.refresh = false;
  66. }
  67. }
  68. },
  69. // 更新收藏
  70. upDateCollectHandler(item) {
  71. this.mySpecialList.forEach((key) => {
  72. if (key.Id === item.Id) {
  73. key.CollectNum = item.IsCollect == 1 ? item.CollectNum - 1 : item.CollectNum + 1;
  74. key.IsCollect = item.IsCollect == 1 ? 0 : 1;
  75. }
  76. });
  77. },
  78. },
  79. onLoad() {
  80. this.getYanxuanSpecialList();
  81. },
  82. /** 用户点击分享 */
  83. onShareAppMessage: function (res) {
  84. return {
  85. title: "研选专栏",
  86. path: "/pages-purchaser/specialColumn/specialColumn",
  87. };
  88. },
  89. /* 下拉刷新 */
  90. onPullDownRefresh() {
  91. this.page_no = 1;
  92. this.refresh = true;
  93. this.getYanxuanSpecialList();
  94. },
  95. // 下滑触底
  96. onReachBottom() {
  97. if (this.status == "nomore") return;
  98. this.page_no++;
  99. this.getYanxuanSpecialList();
  100. this.status = "loading";
  101. },
  102. };
  103. </script>
  104. <style lang="scss" scope>
  105. .special-column {
  106. background-color: $uni-bg-color;
  107. padding: 38rpx 35rpx 35rpx;
  108. .top-content {
  109. display: flex;
  110. font-weight: 500;
  111. font-size: 28rpx;
  112. line-height: 40rpx;
  113. color: #333;
  114. margin-bottom: 20rpx;
  115. .column-author,
  116. .column-my {
  117. display: flex;
  118. align-items: center;
  119. justify-content: space-between;
  120. height: 107;
  121. background-color: #fff;
  122. flex: 1;
  123. }
  124. .column-my {
  125. margin-left: 20rpx;
  126. }
  127. .is-info {
  128. display: flex;
  129. align-items: center;
  130. justify-content: flex-end;
  131. view {
  132. color: #999;
  133. font-size: 24rpx;
  134. font-weight: 400;
  135. line-height: 34rpx;
  136. }
  137. }
  138. }
  139. .column-list-content {
  140. border-radius: 16rpx;
  141. background-color: #fff;
  142. /deep/ .column-list-content-detail {
  143. padding: 0 40rpx !important;
  144. border-bottom: 2rpx solid #f0f1f3;
  145. }
  146. }
  147. }
  148. </style>