recentPages.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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/czbk/host_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-modal
  21. v-model="goFollowShow"
  22. :content-style="{ fontSize: '32rpx' }"
  23. @confirm="goFollowShowBtn"
  24. :show-cancel-button="isCancelBtn"
  25. :confirm-text="confirmText"
  26. @cancel="isCancelBtn = false"
  27. :show-title="false"
  28. :cancel-style="{ borderRight: '1rpx solid #EBEBEB' }"
  29. :confirm-style="{ fontWeight: '700' }"
  30. >
  31. <view class="slot-content">
  32. <rich-text :nodes="accounts"></rich-text>
  33. </view>
  34. </u-modal>
  35. </view>
  36. </template>
  37. <script>
  38. import { Reports, Research } from "@/config/api.js";
  39. export default {
  40. data() {
  41. return {
  42. hotList: [],
  43. goFollowShow: false,
  44. confirmText: "知道了",
  45. isCancelBtn: false,
  46. accounts: "",
  47. };
  48. },
  49. methods: {
  50. //主题热度/近期更新更多
  51. async researchHotList(id) {
  52. const res = await Research.researchHotList({ ChartPermissionId: id, ThemeType: 2 });
  53. if (res.Ret === 200) {
  54. this.hotList = res.Data.List || [];
  55. }
  56. },
  57. //关注
  58. async isAttention(item) {
  59. const res = await Reports.reportFllow({ IndustrialManagementId: item.IndustrialManagementId });
  60. if (res.Ret === 200) {
  61. item.IsFollw = !item.IsFollw;
  62. if (res.Data.Status == 1) {
  63. this.goFollowShow = true;
  64. this.confirmText = res.Data.GoFollow ? "去关注" : "知道了";
  65. if (res.Data.GoFollow) {
  66. this.accounts = `产业关注成功 <br> 想要及时获取该产业内容的更新推送,请关注【查研观向小助手】公众号`;
  67. this.isCancelBtn = true;
  68. } else {
  69. this.accounts = "产业关注成功<br>请关注【查研观向小助手】公众号,及时获取产业报告更新提醒";
  70. }
  71. } else {
  72. uni.showToast({
  73. title: "已取消关注",
  74. icon: "none",
  75. duration: 2000,
  76. });
  77. }
  78. }
  79. },
  80. //点击了去关注
  81. goFollowShowBtn() {
  82. if (this.confirmText == "去关注") {
  83. uni.navigateTo({
  84. url: "/activityPages/accountsOfficial/accountsOfficial",
  85. });
  86. }
  87. this.goFollowShow = false;
  88. },
  89. //计算遍历的颜色
  90. serialBackground(index) {
  91. index += 1;
  92. return index == 1 ? "#D7584F" : index == 2 ? "#E98033" : index == 3 ? "#FDD367" : "#D3D3D3";
  93. },
  94. //去往主题详情
  95. themeDetails(item) {
  96. this.$store.dispatch("checkHandle", "/reportPages/researchTheme/researchTheme?id=" + item.IndustrialManagementId);
  97. },
  98. },
  99. onLoad(options) {
  100. this.researchHotList(options.id);
  101. },
  102. };
  103. </script>
  104. <style lang="scss" scoped>
  105. .recent-content {
  106. padding: 30rpx 30rpx 50rpx;
  107. .hot-li {
  108. padding: 30rpx 0 20rpx;
  109. border-bottom: 1px solid #f6f6f6;
  110. }
  111. .hot-item {
  112. display: flex;
  113. justify-content: space-between;
  114. align-items: center;
  115. .hot-new {
  116. align-items: center;
  117. flex: 1;
  118. padding-right: 20rpx;
  119. }
  120. .new-img {
  121. width: 26rpx;
  122. height: 28rpx;
  123. margin-left: 15rpx;
  124. flex-shrink: 0;
  125. }
  126. }
  127. .li-serial {
  128. width: 26rpx;
  129. height: 26rpx;
  130. line-height: 26rpx;
  131. color: #fff;
  132. font-size: 20rpx;
  133. text-align: center;
  134. border-radius: 4rpx 4rpx 4rpx 4rpx;
  135. margin: 0rpx 10rpx 0 20rpx;
  136. flex-shrink: 0;
  137. }
  138. .attention {
  139. flex-shrink: 0;
  140. padding: 5rpx 28rpx;
  141. border-radius: 37rpx 37rpx 37rpx 37rpx;
  142. color: #fff;
  143. background: #3385ff;
  144. font-weight: 400;
  145. font-size: 24rpx;
  146. }
  147. .read-more {
  148. margin-left: 30rpx;
  149. margin-top: 20rpx;
  150. display: flex;
  151. flex-wrap: wrap;
  152. .text-box {
  153. margin-bottom: 27rpx;
  154. margin-right: 40rpx;
  155. padding: 0;
  156. font-size: 24rpx;
  157. color: #408fff;
  158. width: 170rpx;
  159. height: 46rpx;
  160. line-height: 46rpx;
  161. text-align: center !important;
  162. background: url(~@/static/img/report_bg.png) no-repeat;
  163. background-size: 100% 100%;
  164. text-indent: 0em;
  165. }
  166. }
  167. }
  168. </style>