browseHistory.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <template>
  2. <view class="container browseHistory-container">
  3. <view class="history-ul" v-if="haveData">
  4. <view class="global_card_content content-item" v-for="item in historyList" :key="item.ArticleId">
  5. <blok v-if="item.NickName">
  6. <view class="item-user" v-if="item.Source == 2">
  7. <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/user_report.png"></image>
  8. <text> {{ item.NickName }}</text>
  9. </view>
  10. </blok>
  11. <view class="item-title global_title">
  12. <text style="display: inline" @click="goDetailReport(item)">
  13. {{ item.Title }}
  14. </text>
  15. <text @click="themeDetails(item, val)" class="item-industry" v-for="val in item.List" :key="val.IndustrialManagementId"> # {{ val.IndustryName }} </text>
  16. </view>
  17. <view class="item-more">
  18. <text>{{ item.PublishDate }}</text>
  19. <view class="global_pv-ollect" v-if="item.Source == 2">
  20. <view>
  21. <image class="pv" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/new_cygx/examine_icon.png"></image>
  22. {{ item.Pv }}
  23. </view>
  24. <view @click="collectClick(item)">
  25. <image v-if="item.IsCollect" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/collect_act.png"></image>
  26. <image v-else src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/collect_ico.png"></image>
  27. {{ item.CollectNum }}人收藏
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. <u-loadmore :status="status" icon-type="flower" :load-text="loadText" margin-top="10" margin-bottom="10" v-if="totalPage > 1" />
  33. </view>
  34. <view class="nodata" v-else>
  35. <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/act_search.png" mode="" class="nodata_ico"></image>
  36. <text>暂时没有浏览历史</text>
  37. </view>
  38. <freeCharge class="free-charge" :isShowFreeBtn="isShowFree" />
  39. <Loading />
  40. </view>
  41. </template>
  42. <script>
  43. import { Mine, Report } from "@/config/api.js";
  44. import { Throttle } from "@/config/util.js";
  45. import freeCharge from "@/components/freeCharge";
  46. export default {
  47. data() {
  48. return {
  49. status: "loadmore",
  50. totalPage: "",
  51. page_no: 1,
  52. pageSize: 10,
  53. haveData: null,
  54. refresh: false, //正在下拉
  55. historyList: [],
  56. loadText: {
  57. loadmore: "上拉加载更多",
  58. loading: "加载中",
  59. nomore: "已经到底了",
  60. },
  61. };
  62. },
  63. onLoad() {
  64. this.gethistoryList();
  65. },
  66. onShow() {
  67. this.$store.commit("setRouterReport", "足迹");
  68. },
  69. components: {
  70. freeCharge,
  71. },
  72. methods: {
  73. /* 获取列表 */
  74. gethistoryList() {
  75. Mine.getHistory({
  76. PageSize: this.pageSize,
  77. CurrentIndex: this.page_no,
  78. }).then((res) => {
  79. if (res.Ret === 200) {
  80. this.status = this.page_no < res.Data.Paging.Pages ? "loadmore" : "nomore";
  81. this.totalPage = res.Data.Paging.Pages; //总页数
  82. if (this.page_no === 1) {
  83. this.historyList = res.Data.List || [];
  84. this.haveData = this.historyList.length ? true : false;
  85. if (this.refresh) {
  86. uni.stopPullDownRefresh();
  87. this.refresh = false;
  88. }
  89. } else {
  90. this.historyList = this.historyList.concat(res.Data.List);
  91. }
  92. }
  93. });
  94. },
  95. // 去往文章详情页面
  96. goDetailReport(item) {
  97. uni.navigateTo({ url: "/pageMy/reportDetail/reportDetail?id=" + item.ArticleId });
  98. },
  99. // 去往主题详情
  100. themeDetails(item, val) {
  101. if (item.Source === 1) {
  102. //非严选
  103. uni.navigateTo({ url: "/reportPages/IndustryReport/IndustryReport?id=" + val.IndustrialManagementId });
  104. } else {
  105. //严选
  106. uni.navigateTo({ url: "/reportPages/researchTheme/researchTheme?id=" + val.IndustrialManagementId + "&pageRouter=足迹" });
  107. }
  108. },
  109. // 收藏
  110. async collectClick(item) {
  111. const res = await Report.collectRpt({ ArticleId: item.ArticleId, PageRouter: this.$store.state.pageRouterReport });
  112. if (res.Ret === 200) {
  113. item.IsCollect = !item.IsCollect;
  114. item.IsCollect
  115. ? (item.CollectNum += 1) &&
  116. uni.showToast({
  117. title: "收藏成功",
  118. icon: "none",
  119. duration: 2000,
  120. })
  121. : (item.CollectNum -= 1);
  122. !item.IsCollect &&
  123. uni.showToast({
  124. title: "已取消收藏",
  125. icon: "none",
  126. duration: 2000,
  127. });
  128. }
  129. },
  130. },
  131. /* 触底 */
  132. onReachBottom: Throttle(function () {
  133. if (this.status === "nomore") return;
  134. this.status = "loading";
  135. this.page_no++;
  136. this.gethistoryList();
  137. }),
  138. /* 下拉刷新 */
  139. onPullDownRefresh: Throttle(function () {
  140. this.page_no = 1;
  141. this.refresh = true;
  142. this.gethistoryList();
  143. }),
  144. };
  145. </script>
  146. <style lang="scss" scoped>
  147. .browseHistory-container {
  148. background-color: $uni-bg-color;
  149. .history-ul {
  150. padding: 4rpx 30rpx;
  151. .content-item {
  152. background-color: #fff;
  153. margin-top: 20rpx;
  154. padding: 35rpx 20rpx 0;
  155. border-top: 4rpx solid #376cbb;
  156. .item-title {
  157. font-weight: 500;
  158. .item-industry {
  159. font-size: 28rpx;
  160. margin-left: 10rpx;
  161. color: $uni-color-new;
  162. display: inline-block;
  163. }
  164. }
  165. .item-user {
  166. display: flex;
  167. align-items: center;
  168. color: #999999;
  169. font-size: 28rpx;
  170. margin-bottom: 20rpx;
  171. image {
  172. width: 23rpx;
  173. height: 26rpx;
  174. margin-right: 20rpx;
  175. }
  176. }
  177. .item-more {
  178. display: flex;
  179. justify-content: space-between;
  180. color: #cecece;
  181. margin: 20rpx 0 0;
  182. padding-bottom: 30rpx;
  183. }
  184. }
  185. }
  186. }
  187. </style>