researchTheme.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  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
  12. class="text-box text_oneLine"
  13. @click="scrollGo(item.IndustrialSubjectId)"
  14. v-for="item in themeList.ListSubject"
  15. :key="item.IndustrialSubjectId"
  16. >
  17. {{ item.SubjectName }}
  18. </text>
  19. </view>
  20. </view>
  21. <view class="all-theme" @click="goThemeAll"> 全部主题>> </view>
  22. <view class="content-item" :id="'tabItem-' + item.IndustrialSubjectId" v-for="item in themeList.List" :key="item.ArticleId">
  23. <view class="item-user" v-if="item.NickName" @click="authorDetails(item)">
  24. <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/user_report.png"></image>
  25. <text> {{ item.NickName }}</text>
  26. </view>
  27. <view class="item-title">
  28. <text style="display: inline" @click="goDetail(item)">
  29. {{ item.Title }}
  30. </text>
  31. <text class="item-industry" v-if="item.SubjectName">&nbsp;&nbsp;&nbsp;#{{ item.SubjectName }}</text>
  32. </view>
  33. <view class="item-more">
  34. <text>{{ item.PublishDate }}</text>
  35. <view class="pv-ollect">
  36. <view>
  37. <image class="pv" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/examine_icon.png"></image>
  38. {{ item.Pv }}
  39. </view>
  40. <view @click="collectClick(item)">
  41. <image v-if="item.IsCollect" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/collect_act.png"></image>
  42. <image v-else src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/collect_ico.png"></image>
  43. {{ item.CollectNum }}人收藏
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <u-modal
  49. v-model="goFollowShow"
  50. :content-style="{ fontSize: '32rpx' }"
  51. @confirm="goFollowShowBtn"
  52. :show-cancel-button="isCancelBtn"
  53. :confirm-text="confirmText"
  54. @cancel="isCancelBtn = false"
  55. :show-title="false"
  56. :cancel-style="{ borderRight: '1rpx solid #EBEBEB' }"
  57. :confirm-style="{ fontWeight: '700' }"
  58. >
  59. <view class="slot-content">
  60. <rich-text :nodes="accounts"></rich-text>
  61. </view>
  62. </u-modal>
  63. </view>
  64. </template>
  65. <script>
  66. import { Reports, Research, Report } from "@/config/api.js";
  67. export default {
  68. data() {
  69. return {
  70. themeList: [],
  71. isFollw: false,
  72. goFollowShow: false,
  73. confirmText: "知道了",
  74. isCancelBtn: false,
  75. accounts: "",
  76. };
  77. },
  78. methods: {
  79. // 跳转主题
  80. goThemeAll() {
  81. uni.navigateTo({ url: "/pages-purchaser/researchTheme/researchTheme" });
  82. },
  83. async researchThemeDetail(id, source, PageRouter) {
  84. const res = await Research.researchThemeDetail({ IndustrialManagementId: id, Source: source ? 2 : 1, PageRouter });
  85. if (res.Ret === 200) {
  86. this.themeList = res.Data || {};
  87. this.isFollw = res.Data.IsFollw;
  88. }
  89. },
  90. //关注
  91. async isAttention(item) {
  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. const res = await Report.collectRpt({ ArticleId: item.ArticleId, PageRouter: this.$store.state.pageRouterReport });
  126. if (res.Ret === 200) {
  127. item.IsCollect = !item.IsCollect;
  128. item.IsCollect
  129. ? (item.CollectNum += 1) &&
  130. uni.showToast({
  131. title: "收藏成功",
  132. icon: "none",
  133. duration: 2000,
  134. })
  135. : (item.CollectNum -= 1);
  136. !item.IsCollect &&
  137. uni.showToast({
  138. title: "已取消收藏",
  139. icon: "none",
  140. duration: 2000,
  141. });
  142. }
  143. },
  144. //去往文章详情页面
  145. goDetail(item) {
  146. this.$store.dispatch("checkHandle", "/pageMy/reportDetail/reportDetail?id=" + item.ArticleId);
  147. },
  148. //去往作者详情
  149. authorDetails(item) {
  150. uni.navigateTo({
  151. url: "/reportPages/authorPages/authorPages?id=" + item.DepartmentId,
  152. });
  153. },
  154. //点击后滚动
  155. scrollGo(item) {
  156. uni.pageScrollTo({
  157. duration: 300,
  158. selector: "#" + "tabItem-" + item,
  159. });
  160. },
  161. },
  162. onLoad(options) {
  163. let source = options.source || "";
  164. let pageRouter = options.pageRouter || "";
  165. this.researchThemeDetail(options.id, source, pageRouter);
  166. },
  167. onShow() {
  168. this.$store.commit("setRouterReport", "主题详情");
  169. },
  170. };
  171. </script>
  172. <style lang="scss" scoped>
  173. .theme-content {
  174. padding: 20rpx;
  175. background-color: #f7f7f7;
  176. .box-content-top {
  177. position: relative;
  178. background-color: #fff;
  179. padding: 30rpx;
  180. border-radius: 8rpx;
  181. }
  182. .content-top {
  183. width: 100%;
  184. padding: 0 20rpx;
  185. position: relative;
  186. color: #000;
  187. height: 48rpx;
  188. .follw {
  189. position: absolute;
  190. right: 30rpx;
  191. top: 50%;
  192. transform: translateY(-50%);
  193. }
  194. .attention {
  195. flex-shrink: 0;
  196. padding: 0 28rpx;
  197. line-height: 46rpx;
  198. height: 48rpx;
  199. border-radius: 37rpx 37rpx 37rpx 37rpx;
  200. color: #fff;
  201. font-weight: 400;
  202. font-size: 24rpx;
  203. background-color: #999;
  204. }
  205. .cancel-attention {
  206. background: #3385ff;
  207. color: #fff;
  208. height: 48rpx;
  209. line-height: 40rpx;
  210. }
  211. }
  212. .read-more {
  213. display: flex;
  214. flex-wrap: wrap;
  215. .text-box {
  216. margin-top: 30rpx;
  217. margin-right: 20rpx;
  218. font-size: 28rpx;
  219. color: #408fff;
  220. width: 201rpx;
  221. height: 46rpx;
  222. line-height: 46rpx;
  223. text-align: center !important;
  224. background: url(~@/static/img/report_bg.png) no-repeat;
  225. background-size: 100% 100%;
  226. text-indent: 0em;
  227. }
  228. }
  229. .all-theme {
  230. color: #3385ff;
  231. width: 100%;
  232. text-align: center;
  233. padding-bottom: 20rpx;
  234. border-bottom: 2rpx solid #ececec;
  235. margin: 20rpx 0;
  236. }
  237. .content-item {
  238. background-color: #fff;
  239. padding: 30rpx 20rpx 0;
  240. .item-title {
  241. font-weight: 500;
  242. .item-industry {
  243. margin-left: 10rpx;
  244. color: #3385ff;
  245. display: inline-block;
  246. }
  247. }
  248. .item-user {
  249. display: flex;
  250. align-items: center;
  251. color: #999999;
  252. font-size: 28rpx;
  253. margin-bottom: 20rpx;
  254. image {
  255. width: 23rpx;
  256. height: 26rpx;
  257. margin-right: 20rpx;
  258. }
  259. }
  260. .item-more {
  261. display: flex;
  262. justify-content: space-between;
  263. color: #cecece;
  264. margin: 20rpx 0 0;
  265. padding-bottom: 30rpx;
  266. border-bottom: 1rpx solid #ececec;
  267. .pv-ollect {
  268. display: flex;
  269. align-items: center;
  270. width: 40%;
  271. justify-content: space-between;
  272. image {
  273. width: 22rpx;
  274. height: 21rpx;
  275. margin-right: 10rpx;
  276. }
  277. .pv {
  278. height: 16rpx;
  279. }
  280. }
  281. }
  282. }
  283. }
  284. </style>