researchTheme.vue 8.4 KB

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