researchTheme.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  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" v-if="item.NickName" @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, source) {
  72. const res = await Research.researchThemeDetail({ IndustrialManagementId: id, Source: source ? 2 : 1 });
  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. uni.$emit("updateFllowTheme", { isFollw: this.isFollw, id: this.themeList.IndustrialManagementId });
  100. }
  101. },
  102. //点击了去关注
  103. goFollowShowBtn() {
  104. if (this.confirmText == "去关注") {
  105. uni.navigateTo({
  106. url: "/activityPages/accountsOfficial/accountsOfficial",
  107. });
  108. }
  109. this.goFollowShow = false;
  110. },
  111. //收藏
  112. async collectClick(item) {
  113. const res = await Report.collectRpt({ ArticleId: item.ArticleId });
  114. if (res.Ret === 200) {
  115. item.IsCollect = !item.IsCollect;
  116. item.IsCollect
  117. ? (item.CollectNum += 1) &&
  118. uni.showToast({
  119. title: "收藏成功",
  120. icon: "none",
  121. duration: 2000,
  122. })
  123. : (item.CollectNum -= 1);
  124. !item.IsCollect &&
  125. uni.showToast({
  126. title: "已取消收藏",
  127. icon: "none",
  128. duration: 2000,
  129. });
  130. }
  131. },
  132. //去往文章详情页面
  133. goDetail(item) {
  134. this.$store.dispatch("checkHandle", "/pageMy/reportDetail/reportDetail?id=" + item.ArticleId);
  135. },
  136. //去往作者详情
  137. authorDetails(item) {
  138. uni.navigateTo({
  139. url: "/reportPages/authorPages/authorPages?id=" + item.DepartmentId,
  140. });
  141. },
  142. //点击后滚动
  143. scrollGo(item) {
  144. uni.pageScrollTo({
  145. duration: 300,
  146. selector: "#" + "tabItem-" + item,
  147. });
  148. },
  149. },
  150. onLoad(options) {
  151. let source = options.source || "";
  152. this.researchThemeDetail(options.id, source);
  153. },
  154. };
  155. </script>
  156. <style lang="scss" scoped>
  157. .theme-content {
  158. padding: 20rpx;
  159. .content-top {
  160. height: 88rpx;
  161. width: 100%;
  162. padding: 0 20rpx;
  163. background-color: #f2f2f2;
  164. text-align: center;
  165. line-height: 88rpx;
  166. position: relative;
  167. color: #000;
  168. padding-right: 160rpx;
  169. .follw {
  170. position: absolute;
  171. right: 30rpx;
  172. top: 50%;
  173. transform: translateY(-50%);
  174. }
  175. .attention {
  176. flex-shrink: 0;
  177. padding: 0 28rpx;
  178. line-height: 46rpx;
  179. height: 48rpx;
  180. border-radius: 37rpx 37rpx 37rpx 37rpx;
  181. color: #fff;
  182. font-weight: 400;
  183. font-size: 24rpx;
  184. background-color: #999;
  185. }
  186. .cancel-attention {
  187. background: #3385ff;
  188. color: #fff;
  189. height: 48rpx;
  190. line-height: 40rpx;
  191. }
  192. }
  193. .read-more {
  194. margin-top: 40rpx;
  195. display: flex;
  196. flex-wrap: wrap;
  197. padding-bottom: 10rpx;
  198. border-bottom: 1px solid #ececec;
  199. .text-box {
  200. margin-bottom: 27rpx;
  201. margin-right: 20rpx;
  202. padding: 0 7rpx;
  203. font-size: 24rpx;
  204. color: #408fff;
  205. width: 217rpx;
  206. height: 46rpx;
  207. line-height: 46rpx;
  208. text-align: center !important;
  209. background: url(~@/static/img/report_bg.png) no-repeat;
  210. background-size: 100% 100%;
  211. text-indent: 0em;
  212. }
  213. }
  214. .content-item {
  215. background-color: #fff;
  216. padding: 30rpx 20rpx 0;
  217. .item-title {
  218. font-weight: 500;
  219. .item-industry {
  220. margin-left: 10rpx;
  221. color: #3385ff;
  222. display: inline-block;
  223. }
  224. }
  225. .item-user {
  226. display: flex;
  227. align-items: center;
  228. color: #999999;
  229. font-size: 28rpx;
  230. margin-bottom: 20rpx;
  231. image {
  232. width: 23rpx;
  233. height: 26rpx;
  234. margin-right: 20rpx;
  235. }
  236. }
  237. .item-more {
  238. display: flex;
  239. justify-content: space-between;
  240. color: #cecece;
  241. margin: 20rpx 0 0;
  242. padding-bottom: 30rpx;
  243. border-bottom: 1rpx solid #ececec;
  244. .pv-ollect {
  245. display: flex;
  246. align-items: center;
  247. width: 40%;
  248. justify-content: space-between;
  249. image {
  250. width: 22rpx;
  251. height: 21rpx;
  252. margin-right: 10rpx;
  253. }
  254. .pv {
  255. height: 16rpx;
  256. }
  257. }
  258. }
  259. }
  260. }
  261. </style>