researchList.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482
  1. <template>
  2. <view class="container research-list-container">
  3. <view class="top-content">
  4. <view class="global_one_tabs">
  5. <view v-for="(item, index) in researchTabBars" :key="index" :class="['item', tagActive == item.name && 'tabs-active']" @click="typeChange(item)">
  6. {{ item.titel }}
  7. </view>
  8. </view>
  9. </view>
  10. <view class="content-ul" v-if="tagActive == '用户'">
  11. <view class="global_card_content user-li" v-for="(item, index) in collectionList" :key="item.ArticleId">
  12. <view class="li-item">
  13. <view class="li-serial" :style="{ background: serialBackground(index) }">
  14. {{ index + 1 }}
  15. </view>
  16. <view>
  17. <text class="global_title" @click="goDetail(item)" :style="{ display: 'inline', marginLeft: item.Title.substr(0, 1) != '【' ? '14rpx' : 0 }">{{ item.Title }}</text>
  18. <text class="li-industry" @click="themeDetails(key, '月度收藏榜')" v-for="key in item.List" :key="key.IndustrialManagementId"> # {{ key.IndustryName }} </text>
  19. </view>
  20. </view>
  21. <view class="li-bottom" style="color: #999999">
  22. <viwe class="time-user">
  23. <view class="time">
  24. {{ item.PublishDate }}
  25. </view>
  26. <view class="li-user" @click="authorDetails(item)">
  27. <image class="user_report-img" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/new_cygx/user_report.png"></image>
  28. <text class="text_oneLine"> {{ item.NickName }}</text>
  29. </view>
  30. </viwe>
  31. <view class="user-img">
  32. <view class="img-box">
  33. <image class="user-pv" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/new_cygx/examine_icon.png"></image>
  34. <text>
  35. {{ item.Pv }}
  36. </text>
  37. </view>
  38. <view class="img-box" @click="collectClick(item)">
  39. <image v-if="item.IsCollect" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/new_cygx/collect_act.png"></image>
  40. <image v-else src="https://hzchart.oss-cn-shanghai.aliyuncs.com/new_cygx/collect_ico.png"></image>
  41. <text class=""> {{ item.CollectNum }} </text>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. <view class="content-ul" v-if="hotList.length && tagActive == '主题'">
  48. <view class="global_card_content hot-li" v-for="(item, index) in hotList" :key="item.IndustrialManagementId">
  49. <view class="li-item hot-item">
  50. <view style="display: flex" class="text_oneLine hot-new" @click="themeDetails(item, '主题热度榜')">
  51. <view class="li-serial serial-number" :style="{ background: serialBackground(index) }">
  52. {{ index + 1 }}
  53. </view>
  54. <text class="global_title text_oneLine" style="display: inline"> # {{ item.IndustryName }} </text>
  55. <image class="new-img" v-if="item.IsNew" src="https://hzstatic.hzinsights.com/cygx/icon/new_report.png"></image>
  56. </view>
  57. <view :class="['follw', 'global_content_center', item.IsFollw && 'cancel-follw']" @click="isAttention(item, '主题')">
  58. {{ item.IsFollw ? "取消关注" : "+ 关注" }}
  59. </view>
  60. </view>
  61. <view class="li-item read-more" @click="themeDetails(item, '主题热度榜')">
  62. <text class="text-box text_oneLine" v-for="val in item.IndustrialSubjectList" :key="val.IndustrialSubjectId">
  63. {{ val.SubjectName }}
  64. </text>
  65. </view>
  66. </view>
  67. <view class="content-button" @click="goThemeAuthor('主题')">查看全部主题>></view>
  68. </view>
  69. <view class="content-ul" v-if="kolList.length && tagActive == '专家'">
  70. <view class="global_card_content kol-li" v-for="(item, index) in kolList" :key="item.DepartmentId">
  71. <view class="li-serial serial-number" :style="{ background: serialBackground(index) }">
  72. {{ index + 1 }}
  73. </view>
  74. <image @click="authorDetails(item)" :src="item.ImgUrl" v-if="item.ImgUrl"></image>
  75. <view class="li-item kol-item">
  76. <view class="item-top">
  77. <text @click="authorDetails(item)">
  78. {{ item.NickName }}
  79. </text>
  80. <view :class="['follw', 'global_content_center', item.IsFollw && 'cancel-follw']" @click="isAttention(item, '专家')">
  81. {{ item.IsFollw ? "取消关注" : "+ 关注" }}
  82. </view>
  83. </view>
  84. <text @click="themeDetails(val, 'KOL榜')" class="kol-text text_oneLine" v-for="val in item.List" :key="val.IndustrialManagementId"> # {{ val.IndustryName }} </text>
  85. </view>
  86. </view>
  87. <view class="content-button" @click="goThemeAuthor('作者')">查看全部作者>></view>
  88. </view>
  89. <u-modal
  90. v-model="goFollowShow"
  91. :content-style="{ fontSize: '32rpx' }"
  92. @confirm="goFollowShowBtn"
  93. :show-cancel-button="isCancelBtn"
  94. :confirm-text="confirmText"
  95. @cancel="isCancelBtn = false"
  96. :show-title="false"
  97. :cancel-style="{ borderRight: '1rpx solid #EBEBEB' }"
  98. :confirm-style="{ fontWeight: '700' }"
  99. >
  100. <view class="slot-content">
  101. <rich-text :nodes="accounts"></rich-text>
  102. </view>
  103. </u-modal>
  104. <Loading />
  105. </view>
  106. </template>
  107. <script>
  108. import { Reports, Research } from "@/config/api.js";
  109. import purchaserReportListMixins from "../components/purchaser-report-list-mixins.js";
  110. export default {
  111. data() {
  112. return {
  113. accounts: "",
  114. tagActive: "用户",
  115. collectionList: [], //用户收藏
  116. hotList: [],
  117. kolList: [],
  118. researchTabBars: [
  119. { titel: "月度收藏榜", name: "用户" },
  120. { titel: "主题热度榜", name: "主题" },
  121. { titel: "KOL榜", name: "专家" },
  122. ],
  123. confirmText: "知道了",
  124. isCancelBtn: false,
  125. goFollowShow: false,
  126. };
  127. },
  128. // purchaserReportListMixins 混入了 收藏、作者详情、文章详情、主题详情-method
  129. mixins: [purchaserReportListMixins],
  130. watch: {
  131. tagActive: {
  132. handler(val) {
  133. val == "用户" ? this.researchCollectionList() : val == "主题" ? this.researchHotList() : this.researchKolList();
  134. },
  135. immediate: true,
  136. },
  137. },
  138. mounted() {
  139. // 处理数据 列表同步详情
  140. uni.$on("updateFllowTheme", (data) => {
  141. this.hotList.forEach((item) => {
  142. if (item.IndustrialManagementId == data.id) {
  143. item.IsFollw = data.isFollw;
  144. }
  145. });
  146. });
  147. // 处理数据 列表同步详情
  148. uni.$on("updateFllowAuthor", (data) => {
  149. this.kolList.forEach((item) => {
  150. if (item.DepartmentId == data.id) {
  151. item.IsFollw = data.isFollw;
  152. }
  153. });
  154. });
  155. },
  156. methods: {
  157. //tabs切换
  158. typeChange(item) {
  159. this.tagActive = item.name;
  160. },
  161. //计算遍历的颜色
  162. serialBackground(index) {
  163. index += 1;
  164. return index == 1 ? "#D7584F" : index == 2 ? "#E98033" : index == 3 ? "#FDD367" : "#D3D3D3";
  165. },
  166. //用户收藏榜
  167. async researchCollectionList() {
  168. const res = await Research.researchCollectionList({ ChartPermissionId: 31 });
  169. if (res.Ret === 200) {
  170. this.collectionList = res.Data.List || [];
  171. }
  172. },
  173. //主题热度/近期更新更多
  174. async researchHotList() {
  175. const res = await Research.researchHotList({ ChartPermissionId: 31, ThemeType: 1 });
  176. if (res.Ret === 200) {
  177. this.hotList = res.Data.List || [];
  178. }
  179. },
  180. //KOL榜列表接口
  181. async researchKolList() {
  182. const res = await Research.researchKolList({ ChartPermissionId: 31 });
  183. if (res.Ret === 200) {
  184. this.kolList = res.Data.List || [];
  185. }
  186. },
  187. //关注
  188. async isAttention(item, val) {
  189. await this.$store.dispatch("showLoginModal");
  190. const res =
  191. val === "主题"
  192. ? await Reports.reportFllow({ IndustrialManagementId: item.IndustrialManagementId, PageRouter: this.$store.state.pageRouterReport })
  193. : await Reports.reportFllowDepartment({ DepartmentId: item.DepartmentId, PageRouter: this.$store.state.pageRouterReport });
  194. if (res.Ret === 200) {
  195. item.IsFollw = !item.IsFollw;
  196. if (res.Data.Status == 1) {
  197. this.goFollowShow = true;
  198. this.confirmText = res.Data.GoFollow ? "去关注" : "知道了";
  199. if (res.Data.GoFollow) {
  200. this.accounts = `${val == "主题" ? "产业" : "作者"}关注成功 <br> 想要及时获取该${val === "主题" ? "产业内容的更新推送" : "作者的报告更新提示"},请关注【查研观向小助手】公众号`;
  201. this.isCancelBtn = true;
  202. } else {
  203. this.accounts = `${val == "主题" ? "产业" : "作者"}` + `关注成功<br>请关注【查研观向小助手】公众号,及时获取${val === "主题" ? "产业" : "作者"}报告更新提醒`;
  204. }
  205. } else {
  206. uni.showToast({
  207. title: "已取消关注",
  208. icon: "none",
  209. duration: 2000,
  210. });
  211. }
  212. }
  213. },
  214. //去关注
  215. goFollowShowBtn() {
  216. if (this.confirmText == "去关注") {
  217. uni.navigateTo({
  218. url: "/activityPages/accountsOfficial/accountsOfficial",
  219. });
  220. }
  221. this.goFollowShow = false;
  222. },
  223. // 跳转主题 of 作者
  224. goThemeAuthor(type) {
  225. type === "主题" ? uni.navigateTo({ url: "/pages-purchaser/researchTheme/researchTheme" }) : uni.navigateTo({ url: "/pages-purchaser/researchAuthor/researchAuthor" });
  226. },
  227. loadShare(option) {
  228. this.tagActive = option.tagActive || "用户";
  229. },
  230. },
  231. /** 用户点击分享 */
  232. onShareAppMessage: function (res) {
  233. return {
  234. title: "研选榜单",
  235. path: "/pages-purchaser/researchList/researchList?tagActive=" + this.tagActive,
  236. };
  237. },
  238. onLoad(option) {
  239. this.loadShare(option);
  240. },
  241. };
  242. </script>
  243. <style lang="scss" scoped>
  244. .research-list-container {
  245. background-color: $uni-bg-color;
  246. padding: 100rpx 30rpx 30rpx;
  247. .top-content {
  248. width: 100%;
  249. position: fixed;
  250. top: 0;
  251. left: 0;
  252. z-index: 99;
  253. background-color: #fff;
  254. padding-bottom: 10rpx;
  255. .item {
  256. flex: 1 !important;
  257. }
  258. }
  259. .content-ul {
  260. margin: 20rpx 0 0;
  261. border-top: 1px solid #f6f6f6;
  262. .user-li,
  263. .kol-li,
  264. .hot-li {
  265. margin-bottom: 20rpx;
  266. background-color: #fff;
  267. }
  268. .li-serial {
  269. width: 26rpx;
  270. height: 26rpx;
  271. line-height: 26rpx;
  272. color: #fff;
  273. font-size: 20rpx;
  274. text-align: center;
  275. border-radius: 4rpx 4rpx 4rpx 4rpx;
  276. margin: 7rpx 10rpx 0 20rpx;
  277. flex-shrink: 0;
  278. }
  279. .serial-number {
  280. margin-top: 0 !important;
  281. }
  282. .li-item {
  283. display: flex;
  284. .li-industry {
  285. color: $uni-color-new;
  286. margin-left: 20rpx;
  287. display: inline-block;
  288. font-size: 32rpx;
  289. font-weight: 600;
  290. }
  291. .li-title {
  292. display: flex;
  293. }
  294. }
  295. .kol-item {
  296. display: flex;
  297. flex-wrap: wrap;
  298. width: 480rpx;
  299. height: 120rpx;
  300. align-items: baseline;
  301. margin-bottom: 20rpx;
  302. .item-top {
  303. width: 100%;
  304. display: flex;
  305. align-items: center;
  306. justify-content: space-between;
  307. font-size: 29rpx;
  308. font-weight: 700;
  309. }
  310. .kol-text {
  311. width: 50%;
  312. margin-top: 10rpx;
  313. flex-shrink: 0;
  314. font-size: 24rpx;
  315. font-weight: 400;
  316. color: #333;
  317. }
  318. }
  319. .li-bottom {
  320. display: flex;
  321. justify-content: space-between;
  322. align-items: center;
  323. margin-top: 30rpx;
  324. width: 100%;
  325. font-size: 24rpx;
  326. .user-img {
  327. display: flex;
  328. align-items: center;
  329. justify-content: flex-end;
  330. width: 39%;
  331. image {
  332. width: 26rpx;
  333. height: 26rpx;
  334. margin-right: 10rpx;
  335. }
  336. view {
  337. display: flex;
  338. align-items: center;
  339. flex-shrink: 0;
  340. margin-left: 20rpx;
  341. }
  342. .user-pv {
  343. width: 30rpx;
  344. height: 30rpx;
  345. }
  346. }
  347. .time-user {
  348. display: flex;
  349. align-items: center;
  350. flex: 1;
  351. .time {
  352. width: 200rpx;
  353. }
  354. view {
  355. display: flex;
  356. align-items: center;
  357. flex-shrink: 0;
  358. }
  359. image {
  360. width: 24rpx;
  361. height: 24rpx;
  362. margin-right: 10rpx;
  363. }
  364. }
  365. }
  366. .read-more {
  367. margin-top: 10rpx;
  368. display: flex;
  369. flex-wrap: wrap;
  370. .industry-video-item {
  371. height: 106rpx;
  372. width: 150rpx;
  373. margin: 0 10rpx 10rpx 0;
  374. border-radius: 8rpx;
  375. background-size: cover;
  376. background-position: center;
  377. background-repeat: no-repeat;
  378. font-weight: 500;
  379. font-size: 24rpx;
  380. color: white;
  381. line-height: 45rpx;
  382. padding: 20rpx;
  383. position: relative;
  384. overflow: hidden;
  385. .industry-video-icon {
  386. height: 0rpx;
  387. width: 0rpx;
  388. border-style: solid;
  389. border-color: #376cbb #376cbb transparent transparent;
  390. border-width: 28rpx;
  391. position: absolute;
  392. right: 0;
  393. top: 0;
  394. image {
  395. position: absolute;
  396. right: -24rpx;
  397. bottom: 0;
  398. height: 20rpx;
  399. width: 20rpx;
  400. }
  401. }
  402. }
  403. .text-box {
  404. padding: 0;
  405. margin: 0 10rpx 10rpx 0;
  406. font-size: 24rpx;
  407. color: $uni-color-new;
  408. width: 150rpx;
  409. height: 48rpx;
  410. text-indent: 0em;
  411. line-height: 48rpx;
  412. text-align: center;
  413. background-color: #f8f8fa;
  414. border-radius: 200rpx;
  415. }
  416. }
  417. .hot-item {
  418. justify-content: space-between;
  419. align-items: center;
  420. .hot-new {
  421. align-items: center;
  422. flex: 1;
  423. padding-right: 20rpx;
  424. }
  425. .new-img {
  426. width: 26rpx;
  427. height: 28rpx;
  428. margin-left: 15rpx;
  429. flex-shrink: 0;
  430. }
  431. }
  432. }
  433. .kol-li {
  434. display: flex;
  435. align-items: center;
  436. padding-bottom: 30rpx;
  437. image {
  438. width: 120rpx;
  439. height: 120rpx;
  440. border-radius: 8rpx;
  441. margin: 0 20rpx 0 15rpx;
  442. overflow: hidden;
  443. flex-shrink: 0;
  444. }
  445. }
  446. .content-bottom {
  447. background-color: $uni-bg-color;
  448. text-align: center;
  449. line-height: 100rpx;
  450. color: #c4c4c4;
  451. font-size: 20rpx;
  452. }
  453. .industry-color {
  454. font-size: 26rpx;
  455. padding: 0rpx 20rpx;
  456. border-radius: 4rpx;
  457. margin-left: 20rpx;
  458. }
  459. .follw {
  460. color: #fff;
  461. border-radius: 4rpx;
  462. font-size: 24rpx;
  463. width: 110rpx;
  464. height: 42rpx;
  465. background-color: $uni-color-new;
  466. }
  467. .cancel-follw {
  468. background-color: #e5efff;
  469. color: $uni-color-new;
  470. }
  471. }
  472. </style>