columnAuthor.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <template>
  2. <view class="container author-column-pages">
  3. <view class="item-ul">
  4. <view class="item-li" v-for="item in specialList" :key="item.Id" @click="goDetailPages(item)">
  5. <view class="item-title"> {{ item.SpecialName }}</view>
  6. <view class="item-name-time">
  7. <view class="name">
  8. <image :src="item.HeadImg"></image>
  9. <text> {{ item.NickName }}</text>
  10. </view>
  11. </view>
  12. <view class="item-content"> 专栏介绍: {{ item.Introduction }} </view>
  13. <view class="item-new" v-if="item.YanxuanSpecialCenter">
  14. <view class="item-new-time">
  15. <text>最近更新</text>
  16. <text>{{ item.YanxuanSpecialCenter.PublishTime }}</text>
  17. </view>
  18. <view class="item-new-title text_twoLine"> {{ item.YanxuanSpecialCenter.Title }} </view>
  19. </view>
  20. </view>
  21. <u-loadmore :status="status" icon-type="flower" :load-text="loadText" margin-top="20" v-if="page_no > 1" />
  22. </view>
  23. <Loading />
  24. </view>
  25. </template>
  26. <script>
  27. import { purchaserApi } from "@/config/api";
  28. export default {
  29. data() {
  30. return {
  31. specialList: [], // 专栏列表
  32. isAuthor: false, // 是否是作者
  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. async getColumnList() {
  46. const res = await purchaserApi.yanxuanSpecialAuthorList({
  47. PageSize: this.pageSize,
  48. CurrentIndex: this.page_no,
  49. });
  50. if (res.Ret === 200) {
  51. this.status = res.Data.Paging.IsEnd ? "nomore" : "loadmore";
  52. this.specialList = this.page_no == 1 ? res.Data.List || [] : this.specialList.concat(res.Data.List);
  53. this.isAuthor = res.Data.IsAuthor;
  54. if (this.refresh) {
  55. uni.stopPullDownRefresh();
  56. this.refresh = false;
  57. }
  58. }
  59. },
  60. // 去往专栏详情
  61. goDetailPages(item) {
  62. uni.navigateTo({ url: "/pages-purchaser/columnDetail/columnDetail?id=" + item.UserId });
  63. },
  64. },
  65. onLoad() {
  66. this.getColumnList();
  67. },
  68. /** 用户点击分享 */
  69. onShareAppMessage: function (res) {
  70. return {
  71. title: "专栏作者",
  72. path: "/pages-purchaser/columnAuthor/columnAuthor",
  73. };
  74. },
  75. /* 下拉刷新 */
  76. onPullDownRefresh() {
  77. this.page_no = 1;
  78. this.refresh = true;
  79. this.getColumnList();
  80. },
  81. // 下滑触底
  82. onReachBottom() {
  83. if (this.status == "nomore") return;
  84. this.page_no++;
  85. this.getColumnList();
  86. this.status = "loading";
  87. },
  88. };
  89. </script>
  90. <style lang="scss" scope>
  91. .author-column-pages {
  92. background-color: $uni-bg-color;
  93. .item-ul {
  94. padding: 30rpx;
  95. .item-li {
  96. padding: 0 30rpx 30rpx;
  97. background-color: white;
  98. border-radius: 16rpx;
  99. border-top: 10rpx solid #8fa4c4;
  100. margin-bottom: 20rpx;
  101. .item-title {
  102. margin-top: 20rpx;
  103. font-size: 34rpx;
  104. font-weight: 500;
  105. }
  106. .item-name-time {
  107. display: flex;
  108. justify-content: space-between;
  109. align-items: center;
  110. height: 80rpx;
  111. font-size: 28rpx;
  112. color: #999;
  113. .name {
  114. display: flex;
  115. align-items: center;
  116. image {
  117. width: 48rpx;
  118. height: 48rpx;
  119. border-radius: 50%;
  120. margin-right: 10rpx;
  121. }
  122. }
  123. }
  124. .item-content {
  125. text-overflow: -o-ellipsis-lastline;
  126. overflow: hidden;
  127. text-overflow: ellipsis;
  128. display: -webkit-box;
  129. -webkit-line-clamp: 4;
  130. line-clamp: 4;
  131. -webkit-box-orient: vertical;
  132. }
  133. .item-new {
  134. margin-top: 20rpx;
  135. padding-top: 15rpx;
  136. border-top: 1rpx solid #dcdfe6;
  137. line-height: 34rpx;
  138. .item-new-time {
  139. display: flex;
  140. align-items: center;
  141. justify-content: space-between;
  142. font-size: 24rpx;
  143. color: #999;
  144. margin-bottom: 18rpx;
  145. }
  146. .item-new-title {
  147. font-size: 24rpx;
  148. color: #333;
  149. }
  150. }
  151. }
  152. }
  153. }
  154. </style>