recentPages.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <template>
  2. <view class="container recent-content">
  3. <view class="hot-li" v-for="(item, index) in hotList" :key="item.IndustrialManagementId">
  4. <view class="li-item hot-item">
  5. <view style="display: flex" class="text_oneLine hot-new" @click="themeDetails(item)">
  6. <text class="li-serial" :style="{ background: serialBackground(index) }">
  7. {{ index + 1 }}
  8. </text>
  9. <text class="text_oneLine" style="display: inline"> # {{ item.IndustryName }} </text>
  10. <image class="new-img" v-if="item.IsHot" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/hot_report.png"></image>
  11. </view>
  12. <text :class="item.IsFollw ? 'cancel-attention' : 'attention'" @click="isAttention(item)">{{ item.IsFollw ? "取消关注" : "+ 关注" }}</text>
  13. </view>
  14. <view class="li-item read-more" @click="themeDetails(item)">
  15. <text class="text-box text_oneLine" v-for="val in item.IndustrialSubjectList" :key="val.IndustrialSubjectId">
  16. {{ val.SubjectName }}
  17. </text>
  18. </view>
  19. </view>
  20. <u-loadmore :status="status" icon-type="flower" :load-text="loadText" margin-top="20" v-if="page_no > 1" />
  21. <u-modal
  22. v-model="goFollowShow"
  23. :content-style="{ fontSize: '32rpx' }"
  24. @confirm="goFollowShowBtn"
  25. :show-cancel-button="isCancelBtn"
  26. :confirm-text="confirmText"
  27. @cancel="isCancelBtn = false"
  28. :show-title="false"
  29. :cancel-style="{ borderRight: '1rpx solid #EBEBEB' }"
  30. :confirm-style="{ fontWeight: '700' }"
  31. >
  32. <view class="slot-content">
  33. <rich-text :nodes="accounts"></rich-text>
  34. </view>
  35. </u-modal>
  36. <Loading />
  37. </view>
  38. </template>
  39. <script>
  40. import { Reports, Research } from "@/config/api.js";
  41. import { Throttle } from "@/config/util.js";
  42. export default {
  43. data() {
  44. return {
  45. hotList: [],
  46. goFollowShow: false,
  47. confirmText: "知道了",
  48. isCancelBtn: false,
  49. accounts: "",
  50. page_no: 1,
  51. pageSize: 20,
  52. permissionId: "",
  53. status: "loadmore",
  54. loadText: {
  55. loadmore: "上拉加载更多",
  56. loading: "加载中",
  57. nomore: "已经到底了",
  58. },
  59. refresh: false, //正在下拉
  60. };
  61. },
  62. methods: {
  63. //主题热度/近期更新更多
  64. async researchHotList() {
  65. const res = await Research.researchHotList({
  66. ChartPermissionId: this.permissionId,
  67. ThemeType: 2,
  68. PageSize: this.pageSize,
  69. CurrentIndex: this.page_no,
  70. });
  71. if (res.Ret === 200) {
  72. this.status = this.page_no < res.Data.Paging.Pages ? "loadmore" : "nomore";
  73. if (this.page_no === 1) {
  74. this.hotList = res.Data.List || [];
  75. if (this.refresh) {
  76. uni.stopPullDownRefresh();
  77. this.refresh = false;
  78. }
  79. } else {
  80. this.hotList = this.hotList.concat(res.Data.List);
  81. }
  82. }
  83. },
  84. //关注
  85. async isAttention(item) {
  86. const res = await Reports.reportFllow({ IndustrialManagementId: item.IndustrialManagementId, PageRouter: "近期更新主题" });
  87. if (res.Ret === 200) {
  88. item.IsFollw = !item.IsFollw;
  89. if (res.Data.Status == 1) {
  90. this.goFollowShow = true;
  91. this.confirmText = res.Data.GoFollow ? "去关注" : "知道了";
  92. if (res.Data.GoFollow) {
  93. this.accounts = `产业关注成功 <br> 想要及时获取该产业内容的更新推送,请关注【查研观向小助手】公众号`;
  94. this.isCancelBtn = true;
  95. } else {
  96. this.accounts = "产业关注成功<br>请关注【查研观向小助手】公众号,及时获取产业报告更新提醒";
  97. }
  98. } else {
  99. uni.showToast({
  100. title: "已取消关注",
  101. icon: "none",
  102. duration: 2000,
  103. });
  104. }
  105. }
  106. },
  107. //点击了去关注
  108. goFollowShowBtn() {
  109. if (this.confirmText == "去关注") {
  110. uni.navigateTo({
  111. url: "/activityPages/accountsOfficial/accountsOfficial",
  112. });
  113. }
  114. this.goFollowShow = false;
  115. },
  116. //计算遍历的颜色
  117. serialBackground(index) {
  118. index += 1;
  119. return index == 1 ? "#D7584F" : index == 2 ? "#E98033" : index == 3 ? "#FDD367" : "#D3D3D3";
  120. },
  121. //去往主题详情
  122. themeDetails(item) {
  123. uni.navigateTo({ url: "/reportPages/researchTheme/researchTheme?id=" + item.IndustrialManagementId + "&pageRouter=近期主题更新" });
  124. },
  125. },
  126. onLoad(options) {
  127. this.permissionId = options.id;
  128. this.researchHotList();
  129. },
  130. /* 触底 */
  131. onReachBottom: Throttle(function () {
  132. if (this.status === "nomore") return;
  133. this.status = "loading";
  134. this.page_no++;
  135. this.researchHotList();
  136. }),
  137. /* 下拉刷新 */
  138. onPullDownRefresh: Throttle(function () {
  139. this.page_no = 1;
  140. this.refresh = true;
  141. this.researchHotList();
  142. }),
  143. };
  144. </script>
  145. <style lang="scss" scoped>
  146. .recent-content {
  147. padding: 30rpx 30rpx 50rpx;
  148. .hot-li {
  149. padding: 30rpx 0 20rpx;
  150. border-bottom: 1px solid #f6f6f6;
  151. }
  152. .hot-item {
  153. display: flex;
  154. justify-content: space-between;
  155. align-items: center;
  156. .hot-new {
  157. align-items: center;
  158. flex: 1;
  159. padding-right: 20rpx;
  160. }
  161. .new-img {
  162. width: 26rpx;
  163. height: 28rpx;
  164. margin-left: 15rpx;
  165. flex-shrink: 0;
  166. }
  167. }
  168. .li-serial {
  169. padding: 0 8rpx;
  170. height: 26rpx;
  171. line-height: 26rpx;
  172. color: #fff;
  173. font-size: 20rpx;
  174. text-align: center;
  175. border-radius: 4rpx 4rpx 4rpx 4rpx;
  176. margin: 0rpx 10rpx 0 20rpx;
  177. flex-shrink: 0;
  178. }
  179. .attention {
  180. flex-shrink: 0;
  181. padding: 5rpx 28rpx;
  182. border-radius: 37rpx 37rpx 37rpx 37rpx;
  183. color: #fff;
  184. background: #376cbb;
  185. font-weight: 400;
  186. font-size: 24rpx;
  187. }
  188. .read-more {
  189. margin-left: 30rpx;
  190. margin-top: 20rpx;
  191. display: flex;
  192. flex-wrap: wrap;
  193. .text-box {
  194. margin-bottom: 27rpx;
  195. margin-right: 40rpx;
  196. padding: 0 7rpx;
  197. font-size: 24rpx;
  198. color: #408fff;
  199. width: 170rpx;
  200. height: 46rpx;
  201. line-height: 46rpx;
  202. text-align: center !important;
  203. background: url(~@/static/img/report_bg.png) no-repeat;
  204. background-size: 100% 100%;
  205. text-indent: 0em;
  206. }
  207. }
  208. }
  209. </style>