researchTheme.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <template>
  2. <view class="container theme-content">
  3. <view class="box-content-top">
  4. <view class="content-top">
  5. <text class="text_oneLine"> # {{ themeList.IndustryName }}</text>
  6. <text :class="!isFollw ? 'cancel-attention' : 'attention'" class="follw" @click="isAttention">
  7. {{ isFollw ? "取消关注" : "+ 关注" }}
  8. </text>
  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="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/cygx/czbk/user_report.png"></image>
  20. <text> {{ item.NickName }}</text>
  21. </view>
  22. <view class="item-title">
  23. <text 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="pv-ollect">
  31. <view>
  32. <image class="pv" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/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/cygx/czbk/collect_act.png"></image>
  37. <image v-else src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/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/authorPages/authorPages?id=" + this.authorId + "&source=" + this.sourceShare + "&pageRouter=" + this.pageRouterShare,
  179. };
  180. },
  181. };
  182. </script>
  183. <style lang="scss" scoped>
  184. .theme-content {
  185. padding: 20rpx;
  186. background-color: #f7f7f7;
  187. .box-content-top {
  188. position: relative;
  189. background-color: #fff;
  190. padding: 30rpx;
  191. border-radius: 8rpx;
  192. }
  193. .content-top {
  194. width: 100%;
  195. padding: 0 20rpx;
  196. position: relative;
  197. color: #000;
  198. height: 48rpx;
  199. .follw {
  200. position: absolute;
  201. right: 30rpx;
  202. top: 50%;
  203. transform: translateY(-50%);
  204. }
  205. .attention {
  206. flex-shrink: 0;
  207. padding: 0 28rpx;
  208. line-height: 46rpx;
  209. height: 48rpx;
  210. border-radius: 37rpx 37rpx 37rpx 37rpx;
  211. color: #fff;
  212. font-weight: 400;
  213. font-size: 24rpx;
  214. background-color: #999;
  215. }
  216. .cancel-attention {
  217. background: #3385ff;
  218. color: #fff;
  219. height: 48rpx;
  220. line-height: 40rpx;
  221. }
  222. }
  223. .read-more {
  224. display: flex;
  225. flex-wrap: wrap;
  226. .text-box {
  227. margin-top: 30rpx;
  228. margin-right: 20rpx;
  229. font-size: 28rpx;
  230. color: #408fff;
  231. width: 197rpx;
  232. height: 46rpx;
  233. line-height: 46rpx;
  234. text-align: center !important;
  235. background: url(~@/static/img/report_bg.png) no-repeat;
  236. background-size: 100% 100%;
  237. text-indent: 0em;
  238. }
  239. }
  240. .all-theme {
  241. color: #3385ff;
  242. width: 100%;
  243. text-align: center;
  244. padding-bottom: 20rpx;
  245. border-bottom: 2rpx solid #ececec;
  246. margin: 20rpx 0;
  247. }
  248. .content-item {
  249. background-color: #fff;
  250. padding: 30rpx 20rpx 0;
  251. .item-title {
  252. font-weight: 500;
  253. .item-industry {
  254. margin-left: 10rpx;
  255. color: #3385ff;
  256. display: inline-block;
  257. }
  258. }
  259. .item-user {
  260. display: flex;
  261. align-items: center;
  262. color: #999999;
  263. font-size: 28rpx;
  264. margin-bottom: 20rpx;
  265. image {
  266. width: 23rpx;
  267. height: 26rpx;
  268. margin-right: 20rpx;
  269. }
  270. }
  271. .item-more {
  272. display: flex;
  273. justify-content: space-between;
  274. color: #cecece;
  275. margin: 20rpx 0 0;
  276. padding-bottom: 30rpx;
  277. border-bottom: 1rpx solid #ececec;
  278. .pv-ollect {
  279. display: flex;
  280. align-items: center;
  281. width: 40%;
  282. justify-content: space-between;
  283. image {
  284. width: 22rpx;
  285. height: 21rpx;
  286. margin-right: 10rpx;
  287. }
  288. .pv {
  289. height: 16rpx;
  290. }
  291. }
  292. }
  293. }
  294. }
  295. </style>