purchaser.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621
  1. <template>
  2. <view class="container resear-container">
  3. <view class="nav-bar-wrap" :style="{ height: navBarStyle.height, paddingTop: navBarStyle.paddingTop, paddingBottom: navBarStyle.paddingBottom }">
  4. <view class="content" @click="goSearch">
  5. <icon type="search" size="15" class="search_ico" />
  6. <text class="sea_ipt"> {{ searchPlaceholderList.YanXuanSearch || "" }}</text>
  7. </view>
  8. </view>
  9. <view class="notice-content" v-if="wholeShowListData.YanXuan_Explain">
  10. <view class="notice">
  11. <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/placard_icon.png"></image>
  12. <view class="notice-bar">
  13. <van-notice-bar color="#3385FF" background="#DFECFF" text="买方研选内容试行阶段,限时免费。也欢迎您向我们提宝贵建议。" />
  14. </view>
  15. </view>
  16. </view>
  17. <view class="theme">
  18. <view class="theme-top">
  19. <text class="title"> 近期更新主题: </text>
  20. <view class="" @click="goRecent">
  21. 更多
  22. <u-icon name="arrow-right" color="#BDBDBD" size="28"></u-icon>
  23. </view>
  24. </view>
  25. <view class="theme-content">
  26. <view class="theme-ul" v-for="item in themeNewList" :key="item.IndustrialManagementId">
  27. <text class="text_oneLine" @click="themeDetails(item, '近期主题更新')"> # {{ item.IndustryName }}</text>
  28. <image v-if="item.IsHot" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/hot_report.png"></image>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="announcement">
  33. <view class="tab-cont">
  34. <scroll-view scroll-x="true" @scroll="scrollMove" :scroll-left="scrollLeft" scroll-with-animation class="scroll-tab" :scroll-into-view="'_' + tabIndex">
  35. <block v-for="(item, index) in tabBars" :key="index">
  36. <view class="scroll-tab-item" :class="{ active: tagActive == item.name }" @click.stop="typeChange(item)">
  37. {{ item.titel }}
  38. <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/border_act.png" mode="" class="border_act" v-if="tagActive == item.name"></image>
  39. </view>
  40. </block>
  41. </scroll-view>
  42. </view>
  43. <view class="content-ul" v-if="collectionList.length && tagActive == '用户'">
  44. <view class="user-li" v-for="(item, index) in collectionList" :key="item.ArticleId">
  45. <view class="li-item">
  46. <text class="li-serial" :style="{ background: serialBackground(index) }">
  47. {{ index + 1 }}
  48. </text>
  49. <view>
  50. <text @click="goDetail(item)" style="display: inline">{{ item.Title }}</text>
  51. <text class="li-industry" @click="themeDetails(item, '月度收藏榜')"> # {{ item.IndustryName }} </text>
  52. </view>
  53. </view>
  54. <view class="li-item li-bottom" style="color: #999999">
  55. <view class="li-user text_oneLine" @click="authorDetails(item)">
  56. <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/user_report.png"></image>
  57. {{ item.NickName }}
  58. </view>
  59. <view class="li-item user-img">
  60. <view class="img-box">
  61. <image class="user-pv" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/examine_icon.png"></image>
  62. <text>
  63. {{ item.Pv }}
  64. </text>
  65. </view>
  66. <view class="img-box" @click="collectClick(item)">
  67. <image v-if="item.IsCollect" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/collect_act.png"></image>
  68. <image v-else src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/collect_ico.png"></image>
  69. <text class=""> {{ item.CollectNum }}人收藏 </text>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. <view class="content-ul" v-if="hotList.length && tagActive == '主题'">
  76. <view class="hot-li" v-for="(item, index) in hotList" :key="item.IndustrialManagementId">
  77. <view class="li-item hot-item">
  78. <view style="display: flex" class="text_oneLine hot-new" @click="themeDetails(item, '主题热度榜')">
  79. <text class="li-serial serial-number" :style="{ background: serialBackground(index) }">
  80. {{ index + 1 }}
  81. </text>
  82. <text class="text_oneLine" style="display: inline"> # {{ item.IndustryName }} </text>
  83. <image class="new-img" v-if="item.IsNew" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/new_report.png"></image>
  84. </view>
  85. <text :class="item.IsFollw ? 'cancel-attention' : 'attention'" @click="isAttention(item, '主题')">{{ item.IsFollw ? "取消关注" : "+ 关注" }}</text>
  86. </view>
  87. <view class="li-item read-more" @click="themeDetails(item, '主题热度榜')">
  88. <text class="text-box text_oneLine" v-for="val in item.IndustrialSubjectList" :key="val.IndustrialSubjectId">
  89. {{ val.SubjectName }}
  90. </text>
  91. </view>
  92. </view>
  93. </view>
  94. <view class="content-ul" v-if="kolList.length && tagActive == '专家'">
  95. <view class="kol-li" v-for="(item, index) in kolList" :key="item.DepartmentId">
  96. <text class="li-serial serial-number" :style="{ background: serialBackground(index) }">
  97. {{ index + 1 }}
  98. </text>
  99. <image @click="authorDetails(item)" :src="item.ImgUrl" v-if="item.ImgUrl"></image>
  100. <view class="li-item kol-item">
  101. <view class="item-top">
  102. <text @click="authorDetails(item)">
  103. {{ item.NickName }}
  104. </text>
  105. <text :class="item.IsFollw ? 'cancel-attention' : 'attention'" @click="isAttention(item, '专家')">{{ item.IsFollw ? "取消关注" : "+ 关注" }}</text>
  106. </view>
  107. <text @click="themeDetails(val, 'KOL榜')" class="kol-text text_oneLine" v-for="val in item.List" :key="val.IndustrialManagementId"> # {{ val.IndustryName }} </text>
  108. </view>
  109. </view>
  110. </view>
  111. </view>
  112. <view class="content-bottom">最新榜单您已掌握,明天再刷刷看~</view>
  113. <freeCharge class="free-charge" :isShowFreeBtn="isShowFree" />
  114. <u-modal
  115. v-model="goFollowShow"
  116. :content-style="{ fontSize: '32rpx' }"
  117. @confirm="goFollowShowBtn"
  118. :show-cancel-button="isCancelBtn"
  119. :confirm-text="confirmText"
  120. @cancel="isCancelBtn = false"
  121. :show-title="false"
  122. :cancel-style="{ borderRight: '1rpx solid #EBEBEB' }"
  123. :confirm-style="{ fontWeight: '700' }"
  124. >
  125. <view class="slot-content">
  126. <rich-text :nodes="accounts"></rich-text>
  127. </view>
  128. </u-modal>
  129. </view>
  130. </template>
  131. <script>
  132. import { Reports, Research, Report } from "@/config/api.js";
  133. import freeCharge from "@/components/freeCharge";
  134. import { Throttle } from "@/config/util.js";
  135. export default {
  136. components: { freeCharge },
  137. data() {
  138. return {
  139. themeNewList: [],
  140. tagActive: "用户",
  141. collectionList: [], //用户收藏
  142. hotList: [],
  143. kolList: [],
  144. tabBars: [
  145. { titel: "月度收藏榜", name: "用户" },
  146. { titel: "主题热度榜", name: "主题" },
  147. { titel: "KOL榜", name: "专家" },
  148. ],
  149. confirmText: "知道了",
  150. accounts: "",
  151. isCancelBtn: false,
  152. goFollowShow: false,
  153. };
  154. },
  155. mounted() {
  156. // 处理数据 列表同步详情
  157. uni.$on("updateFllowTheme", (data) => {
  158. this.hotList.forEach((item) => {
  159. if (item.IndustrialManagementId == data.id) {
  160. item.IsFollw = data.isFollw;
  161. }
  162. });
  163. });
  164. // 处理数据 列表同步详情
  165. uni.$on("updateFllowAuthor", (data) => {
  166. this.kolList.forEach((item) => {
  167. if (item.DepartmentId == data.id) {
  168. item.IsFollw = data.isFollw;
  169. }
  170. });
  171. });
  172. },
  173. watch: {
  174. tagActive: {
  175. handler(val) {
  176. val == "用户" ? this.researchCollectionList() : val == "主题" ? this.researchHotList() : this.researchKolList();
  177. },
  178. immediate: true,
  179. },
  180. },
  181. methods: {
  182. //获取胶囊位置
  183. initNavBar() {
  184. let menuButtonInfo = uni.getMenuButtonBoundingClientRect();
  185. this.navBarStyle = {
  186. height: menuButtonInfo.height + menuButtonInfo.top + 20 + "px",
  187. paddingTop: menuButtonInfo.top + "px",
  188. paddingBottom: "4px",
  189. };
  190. },
  191. //近期更新主题
  192. async researchNewList() {
  193. const res = await Research.researchNewList({ ChartPermissionId: 31 });
  194. if (res.Ret === 200) {
  195. this.themeNewList = res.Data.List || [];
  196. }
  197. },
  198. //用户收藏榜
  199. async researchCollectionList() {
  200. const res = await Research.researchCollectionList({ ChartPermissionId: 31 });
  201. if (res.Ret === 200) {
  202. this.collectionList = res.Data.List || [];
  203. }
  204. },
  205. //主题热度/近期更新更多
  206. async researchHotList() {
  207. const res = await Research.researchHotList({ ChartPermissionId: 31, ThemeType: 1 });
  208. if (res.Ret === 200) {
  209. this.hotList = res.Data.List || [];
  210. }
  211. },
  212. //KOL榜列表接口
  213. async researchKolList() {
  214. const res = await Research.researchKolList({ ChartPermissionId: 31 });
  215. if (res.Ret === 200) {
  216. this.kolList = res.Data.List || [];
  217. }
  218. },
  219. //tabs切换
  220. typeChange(item) {
  221. this.tagActive = item.name;
  222. },
  223. //关注
  224. async isAttention(item, val) {
  225. const res =
  226. val === "主题"
  227. ? await Reports.reportFllow({ IndustrialManagementId: item.IndustrialManagementId, PageRouter: this.$store.state.pageRouterReport })
  228. : await Reports.reportFllowDepartment({ DepartmentId: item.DepartmentId });
  229. if (res.Ret === 200) {
  230. item.IsFollw = !item.IsFollw;
  231. if (res.Data.Status == 1) {
  232. this.goFollowShow = true;
  233. this.confirmText = res.Data.GoFollow ? "去关注" : "知道了";
  234. if (res.Data.GoFollow) {
  235. this.accounts = `${val == "主题" ? "产业" : "作者"}关注成功 <br> 想要及时获取该${val === "主题" ? "产业内容的更新推送" : "作者的报告更新提示"},请关注【查研观向小助手】公众号`;
  236. this.isCancelBtn = true;
  237. } else {
  238. this.accounts = `${val == "主题" ? "产业" : "作者"}` + `关注成功<br>请关注【查研观向小助手】公众号,及时获取${val === "主题" ? "产业" : "作者"}报告更新提醒`;
  239. }
  240. } else {
  241. uni.showToast({
  242. title: "已取消关注",
  243. icon: "none",
  244. duration: 2000,
  245. });
  246. }
  247. }
  248. },
  249. //去关注
  250. goFollowShowBtn() {
  251. if (this.confirmText == "去关注") {
  252. uni.navigateTo({
  253. url: "/activityPages/accountsOfficial/accountsOfficial",
  254. });
  255. }
  256. this.goFollowShow = false;
  257. },
  258. //去往更多主题
  259. goRecent() {
  260. uni.navigateTo({
  261. url: "/reportPages/recentPages/recentPages?id=31",
  262. });
  263. },
  264. //收藏
  265. async collectClick(item) {
  266. const res = await Report.collectRpt({ ArticleId: item.ArticleId });
  267. if (res.Ret === 200) {
  268. item.IsCollect = !item.IsCollect;
  269. item.IsCollect
  270. ? (item.CollectNum += 1) &&
  271. uni.showToast({
  272. title: "收藏成功",
  273. icon: "none",
  274. duration: 2000,
  275. })
  276. : (item.CollectNum -= 1);
  277. !item.IsCollect &&
  278. uni.showToast({
  279. title: "已取消收藏",
  280. icon: "none",
  281. duration: 2000,
  282. });
  283. }
  284. },
  285. //去往作者详情
  286. authorDetails(item) {
  287. uni.navigateTo({
  288. url: "/reportPages/authorPages/authorPages?id=" + item.DepartmentId,
  289. });
  290. },
  291. //去往文章详情页面
  292. goDetail(item) {
  293. this.$store.dispatch("checkHandle", "/pageMy/reportDetail/reportDetail?id=" + item.ArticleId);
  294. },
  295. //去往主题详情
  296. themeDetails(item, source) {
  297. this.$store.dispatch("checkHandle", "/reportPages/researchTheme/researchTheme?id=" + item.IndustrialManagementId + "&pageRouter=" + source);
  298. },
  299. //计算遍历的颜色
  300. serialBackground(index) {
  301. index += 1;
  302. return index == 1 ? "#D7584F" : index == 2 ? "#E98033" : index == 3 ? "#FDD367" : "#D3D3D3";
  303. },
  304. /* 搜索 */
  305. async goSearch() {
  306. await this.$store.dispatch("checkHandle", "/pages-search/indedxSearch/indedxSearch?id=研选" + "&source=买方研选页面");
  307. },
  308. },
  309. onLoad() {
  310. this.researchNewList();
  311. this.initNavBar();
  312. },
  313. onShow() {
  314. this.$store.commit("setRouterReport", "买方研选");
  315. this.getRecordTracking("买方研选");
  316. },
  317. /* 下拉刷新 */
  318. onPullDownRefresh: Throttle(function () {
  319. wx.stopPullDownRefresh();
  320. }),
  321. /**
  322. * 用户点击分享
  323. */
  324. onShareAppMessage: function (res) {
  325. return {
  326. title: this.isHorzMobile ? "好友向您推荐此内容,上传名片享查研观向免费月卡!" : "买方研选",
  327. path: "pages/purchaser/purchaser",
  328. success: (res) => {},
  329. fail: (err) => {},
  330. };
  331. },
  332. };
  333. </script>
  334. <style lang="scss">
  335. .nav-bar-wrap {
  336. background-color: #fff;
  337. color: #fff;
  338. position: sticky;
  339. top: 0;
  340. left: 0;
  341. width: 100%;
  342. z-index: 999;
  343. padding-left: 30rpx;
  344. .content {
  345. position: relative;
  346. display: flex;
  347. align-items: center;
  348. width: 70%;
  349. height: 63rpx;
  350. font-size: 30rpx;
  351. color: #8d8d8d;
  352. background-color: #f3f3f3;
  353. padding-left: 33rpx;
  354. border-radius: 70rpx;
  355. // border: 1rpx solid #e5e5e5;
  356. .sea_ipt {
  357. padding-left: 15rpx;
  358. }
  359. }
  360. }
  361. </style>
  362. <style lang="scss">
  363. .resear-container {
  364. background-color: #f7f7f7;
  365. .notice-content {
  366. position: sticky;
  367. left: 0;
  368. top: 200rpx;
  369. z-index: 99;
  370. width: 100%;
  371. background-color: #fff;
  372. padding-bottom: 20rpx;
  373. }
  374. .notice {
  375. height: 56rpx;
  376. overflow: hidden;
  377. background-color: #dfecff;
  378. display: flex;
  379. align-items: center;
  380. padding-left: 30rpx;
  381. image {
  382. width: 30rpx;
  383. height: 30rpx;
  384. }
  385. .notice-bar {
  386. flex: 1;
  387. }
  388. .van-notice-bar {
  389. height: 56rpx;
  390. }
  391. }
  392. .theme {
  393. margin-top: 4rpx;
  394. background-color: #fff;
  395. padding: 0 30rpx 15rpx;
  396. margin-bottom: 8rpx;
  397. .theme-top {
  398. display: flex;
  399. color: #999999;
  400. align-items: center;
  401. font-size: 28rpx;
  402. height: 95rpx;
  403. justify-content: space-between;
  404. .title {
  405. color: #333;
  406. font-size: 32rpx;
  407. font-weight: 500;
  408. }
  409. }
  410. .theme-content {
  411. display: flex;
  412. flex-wrap: wrap;
  413. .theme-ul {
  414. width: 50%;
  415. display: flex;
  416. align-items: center;
  417. padding-right: 15rpx;
  418. line-height: 59rpx;
  419. image {
  420. width: 26rpx;
  421. height: 28rpx;
  422. margin-left: 8rpx;
  423. flex-shrink: 0;
  424. }
  425. }
  426. }
  427. }
  428. .content-ul {
  429. margin: 20rpx 0 0;
  430. border-top: 1px solid #f6f6f6;
  431. .user-li,
  432. .hot-li,
  433. .kol-li {
  434. padding: 30rpx 0 20rpx;
  435. border-bottom: 1px solid #f6f6f6;
  436. }
  437. .user-img {
  438. width: 40%;
  439. justify-content: space-between;
  440. .img-box {
  441. display: flex;
  442. align-items: center;
  443. }
  444. .user-pv {
  445. width: 21rpx;
  446. height: 16rpx;
  447. }
  448. }
  449. .kol-li {
  450. display: flex;
  451. align-items: center;
  452. padding-bottom: 30rpx;
  453. image {
  454. width: 120rpx;
  455. height: 120rpx;
  456. border-radius: 8rpx;
  457. margin: 0 20rpx 0 15rpx;
  458. overflow: hidden;
  459. flex-shrink: 0;
  460. }
  461. }
  462. .kol-item {
  463. display: flex;
  464. flex-wrap: wrap;
  465. width: 480rpx;
  466. height: 120rpx;
  467. align-items: baseline;
  468. margin-bottom: 20rpx;
  469. .item-top {
  470. width: 100%;
  471. display: flex;
  472. align-items: center;
  473. justify-content: space-between;
  474. font-size: 29rpx;
  475. font-weight: 700;
  476. }
  477. .kol-text {
  478. width: 50%;
  479. margin-top: 10rpx;
  480. flex-shrink: 0;
  481. }
  482. }
  483. .li-serial {
  484. width: 26rpx;
  485. height: 26rpx;
  486. line-height: 26rpx;
  487. color: #fff;
  488. font-size: 20rpx;
  489. text-align: center;
  490. border-radius: 4rpx 4rpx 4rpx 4rpx;
  491. margin: 7rpx 10rpx 0 20rpx;
  492. flex-shrink: 0;
  493. }
  494. .serial-number {
  495. margin-top: 0 !important;
  496. }
  497. .li-item {
  498. display: flex;
  499. .li-industry {
  500. color: #3385ff;
  501. margin-left: 20rpx;
  502. display: inline-block;
  503. }
  504. .li-user {
  505. margin-left: 46rpx;
  506. }
  507. .li-title {
  508. display: flex;
  509. }
  510. }
  511. .li-bottom {
  512. display: flex;
  513. justify-content: space-between;
  514. align-items: center;
  515. margin-top: 30rpx;
  516. width: 100%;
  517. image {
  518. width: 23rpx;
  519. height: 26rpx;
  520. margin-right: 10rpx;
  521. }
  522. }
  523. .read-more {
  524. margin-left: 30rpx;
  525. margin-top: 20rpx;
  526. display: flex;
  527. flex-wrap: wrap;
  528. .text-box {
  529. margin-bottom: 27rpx;
  530. margin-right: 40rpx;
  531. padding: 0;
  532. font-size: 24rpx;
  533. color: #408fff;
  534. width: 170rpx;
  535. height: 46rpx;
  536. line-height: 46rpx;
  537. text-align: center !important;
  538. background: url(~@/static/img/report_bg.png) no-repeat;
  539. background-size: 100% 100%;
  540. text-indent: 0em;
  541. }
  542. }
  543. .attention {
  544. flex-shrink: 0;
  545. padding: 5rpx 28rpx;
  546. border-radius: 37rpx 37rpx 37rpx 37rpx;
  547. color: #fff;
  548. background: #3385ff;
  549. font-weight: 400;
  550. font-size: 24rpx;
  551. }
  552. .hot-item {
  553. justify-content: space-between;
  554. align-items: center;
  555. .hot-new {
  556. align-items: center;
  557. flex: 1;
  558. padding-right: 20rpx;
  559. }
  560. .new-img {
  561. width: 60rpx;
  562. height: 30rpx;
  563. margin-left: 15rpx;
  564. flex-shrink: 0;
  565. }
  566. }
  567. }
  568. .announcement {
  569. background: #fff;
  570. padding: 0 30rpx;
  571. .tab-cont {
  572. height: 115rpx;
  573. background-color: #fff;
  574. font-size: 32rpx;
  575. .scroll-tab {
  576. position: relative;
  577. width: 100%;
  578. white-space: nowrap;
  579. display: flex;
  580. justify-content: space-around;
  581. }
  582. .scroll-tab-item {
  583. text-align: center;
  584. display: inline-block;
  585. padding: 32rpx 8rpx 30rpx 8rpx;
  586. border-bottom: 8rpx solid transparent;
  587. margin-right: 60rpx;
  588. position: relative;
  589. color: #999999;
  590. font-size: 32rpx;
  591. &:last-child {
  592. margin-right: 0;
  593. }
  594. &.active {
  595. border-bottom: none;
  596. color: #333;
  597. font-weight: 500;
  598. }
  599. .border_act {
  600. width: 80%;
  601. height: 8rpx;
  602. position: absolute;
  603. bottom: 0;
  604. left: 50%;
  605. transform: translateX(-50%);
  606. }
  607. }
  608. }
  609. }
  610. .content-bottom {
  611. background-color: #fff;
  612. text-align: center;
  613. line-height: 100rpx;
  614. color: #c4c4c4;
  615. font-size: 20rpx;
  616. }
  617. }
  618. </style>