recentPages.vue 6.1 KB

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