researchTheme.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  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. <Loading />
  64. </view>
  65. </template>
  66. <script>
  67. import { Reports, Research, Report } from "@/config/api.js";
  68. export default {
  69. data() {
  70. return {
  71. themeList: [],
  72. isFollw: false,
  73. goFollowShow: false,
  74. confirmText: "知道了",
  75. isCancelBtn: false,
  76. accounts: "",
  77. };
  78. },
  79. methods: {
  80. // 跳转主题
  81. goThemeAll() {
  82. uni.navigateTo({ url: "/pages-purchaser/researchTheme/researchTheme" });
  83. },
  84. async researchThemeDetail(id, source, PageRouter) {
  85. const res = await Research.researchThemeDetail({ IndustrialManagementId: id, Source: source ? 2 : 1, PageRouter });
  86. if (res.Ret === 200) {
  87. this.themeList = res.Data || {};
  88. this.isFollw = res.Data.IsFollw;
  89. }
  90. },
  91. //关注
  92. async isAttention(item) {
  93. await this.$store.dispatch("showLoginModal");
  94. const res = await Reports.reportFllow({ IndustrialManagementId: this.themeList.IndustrialManagementId, PageRouter: "主题详情" });
  95. if (res.Ret === 200) {
  96. this.isFollw = !this.isFollw;
  97. if (res.Data.Status == 1) {
  98. this.goFollowShow = true;
  99. this.confirmText = res.Data.GoFollow ? "去关注" : "知道了";
  100. if (res.Data.GoFollow) {
  101. this.accounts = `主题关注成功 <br> 想要及时获取该主题内容的更新推送,请关注【查研观向小助手】公众号`;
  102. this.isCancelBtn = true;
  103. } else {
  104. this.accounts = "主题关注成功<br>请关注【查研观向小助手】公众号,及时获取产业报告更新提醒";
  105. }
  106. } else {
  107. uni.showToast({
  108. title: "已取消关注",
  109. icon: "none",
  110. duration: 2000,
  111. });
  112. }
  113. uni.$emit("updateFllowTheme", { isFollw: this.isFollw, id: this.themeList.IndustrialManagementId });
  114. }
  115. },
  116. //点击了去关注
  117. goFollowShowBtn() {
  118. if (this.confirmText == "去关注") {
  119. uni.navigateTo({
  120. url: "/activityPages/accountsOfficial/accountsOfficial",
  121. });
  122. }
  123. this.goFollowShow = false;
  124. },
  125. //收藏
  126. async collectClick(item) {
  127. await this.$store.dispatch("showLoginModal");
  128. const res = await Report.collectRpt({ ArticleId: item.ArticleId, PageRouter: this.$store.state.pageRouterReport });
  129. if (res.Ret === 200) {
  130. item.IsCollect = !item.IsCollect;
  131. item.IsCollect
  132. ? (item.CollectNum += 1) &&
  133. uni.showToast({
  134. title: "收藏成功",
  135. icon: "none",
  136. duration: 2000,
  137. })
  138. : (item.CollectNum -= 1);
  139. !item.IsCollect &&
  140. uni.showToast({
  141. title: "已取消收藏",
  142. icon: "none",
  143. duration: 2000,
  144. });
  145. }
  146. },
  147. //去往文章详情页面
  148. goDetail(item) {
  149. uni.navigateTo({ url: "/pageMy/reportDetail/reportDetail?id=" + item.ArticleId });
  150. },
  151. //去往作者详情
  152. authorDetails(item) {
  153. uni.navigateTo({
  154. url: "/reportPages/authorPages/authorPages?id=" + item.DepartmentId,
  155. });
  156. },
  157. //点击后滚动
  158. scrollGo(item) {
  159. uni.pageScrollTo({
  160. duration: 300,
  161. selector: "#" + "tabItem-" + item,
  162. });
  163. },
  164. },
  165. onLoad(options) {
  166. let source = options.source || "";
  167. let pageRouter = options.pageRouter || "";
  168. this.researchThemeDetail(options.id, source, pageRouter);
  169. },
  170. onShow() {
  171. this.$store.commit("setRouterReport", "主题详情");
  172. },
  173. };
  174. </script>
  175. <style lang="scss" scoped>
  176. .theme-content {
  177. padding: 20rpx;
  178. background-color: #f7f7f7;
  179. .box-content-top {
  180. position: relative;
  181. background-color: #fff;
  182. padding: 30rpx;
  183. border-radius: 8rpx;
  184. }
  185. .content-top {
  186. width: 100%;
  187. padding: 0 20rpx;
  188. position: relative;
  189. color: #000;
  190. height: 48rpx;
  191. .follw {
  192. position: absolute;
  193. right: 30rpx;
  194. top: 50%;
  195. transform: translateY(-50%);
  196. }
  197. .attention {
  198. flex-shrink: 0;
  199. padding: 0 28rpx;
  200. line-height: 46rpx;
  201. height: 48rpx;
  202. border-radius: 37rpx 37rpx 37rpx 37rpx;
  203. color: #fff;
  204. font-weight: 400;
  205. font-size: 24rpx;
  206. background-color: #999;
  207. }
  208. .cancel-attention {
  209. background: #3385ff;
  210. color: #fff;
  211. height: 48rpx;
  212. line-height: 40rpx;
  213. }
  214. }
  215. .read-more {
  216. display: flex;
  217. flex-wrap: wrap;
  218. .text-box {
  219. margin-top: 30rpx;
  220. margin-right: 20rpx;
  221. font-size: 28rpx;
  222. color: #408fff;
  223. width: 197rpx;
  224. height: 46rpx;
  225. line-height: 46rpx;
  226. text-align: center !important;
  227. background: url(~@/static/img/report_bg.png) no-repeat;
  228. background-size: 100% 100%;
  229. text-indent: 0em;
  230. }
  231. }
  232. .all-theme {
  233. color: #3385ff;
  234. width: 100%;
  235. text-align: center;
  236. padding-bottom: 20rpx;
  237. border-bottom: 2rpx solid #ececec;
  238. margin: 20rpx 0;
  239. }
  240. .content-item {
  241. background-color: #fff;
  242. padding: 30rpx 20rpx 0;
  243. .item-title {
  244. font-weight: 500;
  245. .item-industry {
  246. margin-left: 10rpx;
  247. color: #3385ff;
  248. display: inline-block;
  249. }
  250. }
  251. .item-user {
  252. display: flex;
  253. align-items: center;
  254. color: #999999;
  255. font-size: 28rpx;
  256. margin-bottom: 20rpx;
  257. image {
  258. width: 23rpx;
  259. height: 26rpx;
  260. margin-right: 20rpx;
  261. }
  262. }
  263. .item-more {
  264. display: flex;
  265. justify-content: space-between;
  266. color: #cecece;
  267. margin: 20rpx 0 0;
  268. padding-bottom: 30rpx;
  269. border-bottom: 1rpx solid #ececec;
  270. .pv-ollect {
  271. display: flex;
  272. align-items: center;
  273. width: 40%;
  274. justify-content: space-between;
  275. image {
  276. width: 22rpx;
  277. height: 21rpx;
  278. margin-right: 10rpx;
  279. }
  280. .pv {
  281. height: 16rpx;
  282. }
  283. }
  284. }
  285. }
  286. }
  287. </style>