researchTheme.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. <template>
  2. <view class="container theme-content">
  3. <view class="content-top">
  4. <text class="text_oneLine"> # {{ themeList.IndustryName }}</text>
  5. <text :class="!isFollw ? 'cancel-attention' : 'attention'" class="follw" @click="isAttention">
  6. {{ isFollw ? "取消关注" : "+ 关注" }}
  7. </text>
  8. </view>
  9. <view class="read-more">
  10. <text class="text-box text_oneLine" @click="scrollGo(item.IndustrialSubjectId)" v-for="item in themeList.ListSubject" :key="item.IndustrialSubjectId">
  11. {{ item.SubjectName }}
  12. </text>
  13. </view>
  14. <view class="content-item" :id="'tabItem-' + item.IndustrialSubjectId" v-for="item in themeList.List" :key="item.ArticleId">
  15. <view class="item-user" @click="authorDetails(item)">
  16. <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/user_report.png"></image>
  17. <text> {{ item.NickName }}</text>
  18. </view>
  19. <view class="item-title">
  20. <text style="display: inline" @click="goDetail(item)">
  21. {{ item.Title }}
  22. </text>
  23. <text class="item-industry" v-if="item.SubjectName">&nbsp;&nbsp;&nbsp;#{{ item.SubjectName }}</text>
  24. </view>
  25. <view class="item-more">
  26. <text>{{ item.PublishDate }}</text>
  27. <view class="pv-ollect">
  28. <view>
  29. <image class="pv" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/examine_icon.png"></image>
  30. {{ item.Pv }}
  31. </view>
  32. <view @click="collectClick(item)">
  33. <image v-if="item.IsCollect" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/collect_act.png"></image>
  34. <image v-else src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/collect_ico.png"></image>
  35. {{ item.CollectNum }}人收藏
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. <u-modal
  41. v-model="goFollowShow"
  42. :content-style="{ fontSize: '32rpx' }"
  43. @confirm="goFollowShowBtn"
  44. :show-cancel-button="isCancelBtn"
  45. :confirm-text="confirmText"
  46. @cancel="isCancelBtn = false"
  47. :show-title="false"
  48. :cancel-style="{ borderRight: '1rpx solid #EBEBEB' }"
  49. :confirm-style="{ fontWeight: '700' }"
  50. >
  51. <view class="slot-content">
  52. <rich-text :nodes="accounts"></rich-text>
  53. </view>
  54. </u-modal>
  55. </view>
  56. </template>
  57. <script>
  58. import { Reports, Research, Report } from "@/config/api.js";
  59. export default {
  60. data() {
  61. return {
  62. themeList: [],
  63. isFollw: false,
  64. goFollowShow: false,
  65. confirmText: "知道了",
  66. isCancelBtn: false,
  67. accounts: "",
  68. };
  69. },
  70. methods: {
  71. async researchThemeDetail(id) {
  72. const res = await Research.researchThemeDetail({ IndustrialManagementId: id });
  73. if (res.Ret === 200) {
  74. this.themeList = res.Data || {};
  75. this.isFollw = res.Data.IsFollw;
  76. }
  77. },
  78. //关注
  79. async isAttention(item) {
  80. const res = await Reports.reportFllow({ IndustrialManagementId: this.themeList.IndustrialManagementId });
  81. if (res.Ret === 200) {
  82. this.isFollw = !this.isFollw;
  83. if (res.Data.Status == 1) {
  84. this.goFollowShow = true;
  85. this.confirmText = res.Data.GoFollow ? "去关注" : "知道了";
  86. if (res.Data.GoFollow) {
  87. this.accounts = `主题关注成功 <br> 想要及时获取该主题内容的更新推送,请关注【查研观向小助手】公众号`;
  88. this.isCancelBtn = true;
  89. } else {
  90. this.accounts = "主题关注成功<br>请关注【查研观向小助手】公众号,及时获取产业报告更新提醒";
  91. }
  92. } else {
  93. uni.showToast({
  94. title: "已取消关注",
  95. icon: "none",
  96. duration: 2000,
  97. });
  98. }
  99. }
  100. },
  101. //点击了去关注
  102. goFollowShowBtn() {
  103. if (this.confirmText == "去关注") {
  104. uni.navigateTo({
  105. url: "/activityPages/accountsOfficial/accountsOfficial",
  106. });
  107. }
  108. this.goFollowShow = false;
  109. },
  110. //收藏
  111. async collectClick(item) {
  112. const res = await Report.collectRpt({ ArticleId: item.ArticleId });
  113. if (res.Ret === 200) {
  114. item.IsCollect = !item.IsCollect;
  115. item.IsCollect
  116. ? (item.CollectNum += 1) &&
  117. uni.showToast({
  118. title: "收藏成功",
  119. icon: "none",
  120. duration: 2000,
  121. })
  122. : (item.CollectNum -= 1);
  123. !item.IsCollect &&
  124. uni.showToast({
  125. title: "已取消收藏",
  126. icon: "none",
  127. duration: 2000,
  128. });
  129. }
  130. },
  131. //去往文章详情页面
  132. goDetail(item) {
  133. this.$store.dispatch("checkHandle", "/pageMy/reportDetail/reportDetail?id=" + item.ArticleId);
  134. },
  135. //去往作者详情
  136. authorDetails(item) {
  137. uni.navigateTo({
  138. url: "/reportPages/authorPages/authorPages?id=" + item.DepartmentId,
  139. });
  140. },
  141. //点击后滚动
  142. scrollGo(item) {
  143. uni.pageScrollTo({
  144. duration: 300,
  145. selector: "#" + "tabItem-" + item,
  146. });
  147. },
  148. },
  149. onLoad(options) {
  150. this.researchThemeDetail(options.id);
  151. },
  152. };
  153. </script>
  154. <style lang="scss" scoped>
  155. .theme-content {
  156. padding: 20rpx;
  157. .content-top {
  158. height: 88rpx;
  159. width: 100%;
  160. padding: 0 20rpx;
  161. background-color: #f2f2f2;
  162. text-align: center;
  163. line-height: 88rpx;
  164. position: relative;
  165. color: #000;
  166. .follw {
  167. position: absolute;
  168. right: 30rpx;
  169. top: 50%;
  170. transform: translateY(-50%);
  171. }
  172. .attention {
  173. flex-shrink: 0;
  174. padding: 0 28rpx;
  175. line-height: 46rpx;
  176. height: 48rpx;
  177. border-radius: 37rpx 37rpx 37rpx 37rpx;
  178. color: #fff;
  179. font-weight: 400;
  180. font-size: 24rpx;
  181. background-color: #999;
  182. }
  183. .cancel-attention {
  184. background: #3385ff;
  185. color: #fff;
  186. height: 48rpx;
  187. line-height: 40rpx;
  188. }
  189. }
  190. .read-more {
  191. margin-top: 40rpx;
  192. display: flex;
  193. flex-wrap: wrap;
  194. padding-bottom: 10rpx;
  195. border-bottom: 1px solid #ececec;
  196. .text-box {
  197. margin-bottom: 27rpx;
  198. margin-right: 20rpx;
  199. padding: 0;
  200. font-size: 24rpx;
  201. color: #408fff;
  202. width: 217rpx;
  203. height: 46rpx;
  204. line-height: 46rpx;
  205. text-align: center !important;
  206. background: url(~@/static/img/report_bg.png) no-repeat;
  207. background-size: 100% 100%;
  208. text-indent: 0em;
  209. }
  210. }
  211. .content-item {
  212. background-color: #fff;
  213. padding: 30rpx 20rpx 0;
  214. .item-title {
  215. font-weight: 500;
  216. .item-industry {
  217. margin-left: 10rpx;
  218. color: #3385ff;
  219. display: inline-block;
  220. }
  221. }
  222. .item-user {
  223. display: flex;
  224. align-items: center;
  225. color: #999999;
  226. font-size: 28rpx;
  227. margin-bottom: 20rpx;
  228. image {
  229. width: 23rpx;
  230. height: 26rpx;
  231. margin-right: 20rpx;
  232. }
  233. }
  234. .item-more {
  235. display: flex;
  236. justify-content: space-between;
  237. color: #cecece;
  238. margin: 20rpx 0 0;
  239. padding-bottom: 30rpx;
  240. border-bottom: 1rpx solid #ececec;
  241. .pv-ollect {
  242. display: flex;
  243. align-items: center;
  244. width: 40%;
  245. justify-content: space-between;
  246. image {
  247. width: 22rpx;
  248. height: 21rpx;
  249. margin-right: 10rpx;
  250. }
  251. .pv {
  252. height: 16rpx;
  253. }
  254. }
  255. }
  256. }
  257. }
  258. </style>