researchChoose.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512
  1. <template>
  2. <view class="container resear-container">
  3. <view class="theme">
  4. <view class="theme-top">
  5. <text class="title"> 近期更新主题: </text>
  6. <view class="" @click="goRecent">
  7. 更多
  8. <u-icon name="arrow-right" color="#BDBDBD" size="28"></u-icon>
  9. </view>
  10. </view>
  11. <view class="theme-content">
  12. <view class="theme-ul" v-for="item in themeNewList" :key="item.IndustrialManagementId">
  13. <text class="text_oneLine" @click="themeDetails(item)"> # {{ item.IndustryName }}</text>
  14. <image v-if="item.IsHot" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/host_report.png"></image>
  15. </view>
  16. </view>
  17. </view>
  18. <view class="announcement">
  19. <view class="tab-cont">
  20. <scroll-view scroll-x="true" @scroll="scrollMove" :scroll-left="scrollLeft" scroll-with-animation class="scroll-tab" :scroll-into-view="'_' + tabIndex">
  21. <block v-for="(item, index) in tabBars" :key="index">
  22. <view class="scroll-tab-item" :class="{ active: tagActive == item.name }" @click.stop="typeChange(item)">
  23. {{ item.titel }}
  24. <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/border_act.png" mode="" class="border_act" v-if="tagActive == item.name"></image>
  25. </view>
  26. </block>
  27. </scroll-view>
  28. </view>
  29. <view class="content-ul" v-if="collectionList.length && tagActive == '用户'">
  30. <view class="user-li" v-for="(item, index) in collectionList" :key="item.ArticleId">
  31. <view class="li-item">
  32. <text class="li-serial" :style="{ background: serialBackground(index) }">
  33. {{ index + 1 }}
  34. </text>
  35. <view>
  36. <text @click="goDetail(item)" style="display: inline">{{ item.Title }}</text>
  37. <text class="li-industry" @click="themeDetails(item)"> # {{ item.IndustryName }} </text>
  38. </view>
  39. </view>
  40. <view class="li-item li-bottom" style="color: #999999">
  41. <view class="li-user text_oneLine" @click="authorDetails(item)">
  42. <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/user_report.png"></image>
  43. {{ item.NickName }}
  44. </view>
  45. <view class="li-item user-img">
  46. <view class="img-box">
  47. <image class="user-pv" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/examine_icon.png"></image>
  48. <text>
  49. {{ item.Pv }}
  50. </text>
  51. </view>
  52. <view class="img-box" @click="collectClick(item)">
  53. <image v-if="item.IsCollect" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/collect_act.png"></image>
  54. <image v-else src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/collect_ico.png"></image>
  55. <text class=""> {{ item.CollectNum }}人收藏 </text>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. <view class="content-ul" v-if="hotList.length && tagActive == '主题'">
  62. <view class="hot-li" v-for="(item, index) in hotList" :key="item.IndustrialManagementId">
  63. <view class="li-item hot-item">
  64. <view style="display: flex" class="text_oneLine hot-new" @click="themeDetails(item)">
  65. <text class="li-serial serial-number" :style="{ background: serialBackground(index) }">
  66. {{ index + 1 }}
  67. </text>
  68. <text class="text_oneLine" style="display: inline"> # {{ item.IndustryName }} </text>
  69. <image class="new-img" v-if="item.IsNew" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/new_icon.png"></image>
  70. </view>
  71. <text :class="item.IsFollw ? 'cancel-attention' : 'attention'" @click="isAttention(item, '主题')">{{ item.IsFollw ? "取消关注" : "+ 关注" }}</text>
  72. </view>
  73. <view class="li-item read-more" @click="themeDetails(item)">
  74. <text class="text-box text_oneLine" v-for="val in item.IndustrialSubjectList" :key="val.IndustrialSubjectId">
  75. {{ val.SubjectName }}
  76. </text>
  77. </view>
  78. </view>
  79. </view>
  80. <view class="content-ul" v-if="kolList.length && tagActive == '专家'">
  81. <view class="kol-li" v-for="(item, index) in kolList" :key="item.DepartmentId">
  82. <text class="li-serial serial-number" :style="{ background: serialBackground(index) }">
  83. {{ index + 1 }}
  84. </text>
  85. <image @click="authorDetails(item)" :src="item.ImgUrl" v-if="item.ImgUrl"></image>
  86. <view class="li-item kol-item">
  87. <view class="item-top">
  88. <text @click="authorDetails(item)">
  89. {{ item.NickName }}
  90. </text>
  91. <text :class="item.IsFollw ? 'cancel-attention' : 'attention'" @click="isAttention(item, '专家')">{{ item.IsFollw ? "取消关注" : "+ 关注" }}</text>
  92. </view>
  93. <text @click="themeDetails(val)" class="kol-text text_oneLine" v-for="val in item.List" :key="val.IndustrialManagementId"> # {{ val.IndustryName }} </text>
  94. </view>
  95. </view>
  96. </view>
  97. </view>
  98. <view class="content-bottom">最新榜单您已掌握,明天再刷刷看~</view>
  99. </view>
  100. </template>
  101. <script>
  102. import { Reports, Research, Report } from "@/config/api.js";
  103. import { Throttle } from "@/config/util.js";
  104. export default {
  105. props: {
  106. strategyIndex: {
  107. type: Number,
  108. required: true,
  109. },
  110. tabAct: {
  111. type: Number,
  112. required: true,
  113. },
  114. isNum: {
  115. type: Number,
  116. required: true,
  117. },
  118. pageNumFather: {
  119. type: Number,
  120. default: "",
  121. required: true,
  122. },
  123. },
  124. data() {
  125. return {
  126. themeNewList: [],
  127. tagActive: "用户",
  128. collectionList: [], //用户收藏
  129. hotList: [],
  130. kolList: [],
  131. tabBars: [
  132. { titel: "用户收藏榜", name: "用户" },
  133. { titel: "主题热度榜", name: "主题" },
  134. { titel: "KOL榜", name: "专家" },
  135. ],
  136. };
  137. },
  138. watch: {
  139. strategyIndex: {
  140. handler(val) {
  141. if (val == 5) {
  142. this.researchNewList();
  143. }
  144. },
  145. immediate: true,
  146. },
  147. isNum: {
  148. handler(val) {
  149. if (val > 1 && this.strategyIndex) {
  150. if (this.status === "nomore") return;
  151. this.status = "loading";
  152. this.page_no++;
  153. this.industryListByDepartment();
  154. }
  155. },
  156. },
  157. pageNumFather: {
  158. handler(val) {
  159. if (val == 1) {
  160. this.page_no = 1;
  161. (this.dataList = []), (this.listNew = []);
  162. this.industryListByDepartment();
  163. this.$parent.pageNumFather = "";
  164. }
  165. },
  166. },
  167. tagActive: {
  168. handler(val) {
  169. val == "用户" ? this.researchCollectionList() : val == "主题" ? this.researchHotList() : this.researchKolList();
  170. },
  171. immediate: true,
  172. },
  173. },
  174. methods: {
  175. //近期更新主题
  176. async researchNewList() {
  177. const res = await Research.researchNewList({ ChartPermissionId: this.tabAct });
  178. if (res.Ret === 200) {
  179. this.themeNewList = res.Data.List || [];
  180. }
  181. },
  182. //用户收藏榜
  183. async researchCollectionList() {
  184. const res = await Research.researchCollectionList({ ChartPermissionId: this.tabAct });
  185. if (res.Ret === 200) {
  186. this.collectionList = res.Data.List || [];
  187. }
  188. },
  189. //主题热度/近期更新更多
  190. async researchHotList() {
  191. const res = await Research.researchHotList({ ChartPermissionId: this.tabAct, ThemeType: 1 });
  192. if (res.Ret === 200) {
  193. this.hotList = res.Data.List || [];
  194. }
  195. },
  196. //KOL榜列表接口
  197. async researchKolList() {
  198. const res = await Research.researchKolList({ ChartPermissionId: this.tabAct });
  199. if (res.Ret === 200) {
  200. this.kolList = res.Data.List || [];
  201. }
  202. },
  203. //tabs切换
  204. typeChange(item) {
  205. this.tagActive = item.name;
  206. },
  207. //关注
  208. async isAttention(item, val) {
  209. const res = val === "主题" ? await Reports.reportFllow({ IndustrialManagementId: item.IndustrialManagementId }) : await Reports.reportFllowDepartment({ DepartmentId: item.DepartmentId });
  210. if (res.Ret === 200) {
  211. item.IsFollw = !item.IsFollw;
  212. if (res.Data.Status == 1) {
  213. this.$parent.goFollowShow = true;
  214. this.$parent.confirmText = res.Data.GoFollow ? "去关注" : "知道了";
  215. if (res.Data.GoFollow) {
  216. this.$parent.accounts = `${val == "主题" ? "产业" : "作者"}关注成功 <br> 想要及时获取该${val === "主题" ? "产业内容的更新推送" : "作者的报告更新提示"},请关注【查研观向小助手】公众号`;
  217. this.$parent.isCancelBtn = true;
  218. } else {
  219. this.$parent.accounts = `${val == "主题" ? "产业" : "作者"}` + `关注成功<br>请关注【查研观向小助手】公众号,及时获取${val === "主题" ? "产业" : "作者"}报告更新提醒`;
  220. }
  221. } else {
  222. uni.showToast({
  223. title: "已取消关注",
  224. icon: "none",
  225. duration: 2000,
  226. });
  227. }
  228. }
  229. },
  230. //去往更多主题
  231. goRecent() {
  232. uni.navigateTo({
  233. url: "/reportPages/recentPages/recentPages?id=" + this.tabAct,
  234. });
  235. },
  236. //收藏
  237. async collectClick(item) {
  238. const res = await Report.collectRpt({ ArticleId: item.ArticleId });
  239. if (res.Ret === 200) {
  240. item.IsCollect = !item.IsCollect;
  241. item.IsCollect
  242. ? (item.CollectNum += 1) &&
  243. uni.showToast({
  244. title: "收藏成功",
  245. icon: "none",
  246. duration: 2000,
  247. })
  248. : (item.CollectNum -= 1);
  249. !item.IsCollect &&
  250. uni.showToast({
  251. title: "已取消收藏",
  252. icon: "none",
  253. duration: 2000,
  254. });
  255. }
  256. },
  257. //去往作者详情
  258. authorDetails(item) {
  259. uni.navigateTo({
  260. url: "/reportPages/authorPages/authorPages?id=" + item.DepartmentId,
  261. });
  262. },
  263. //去往文章详情页面
  264. goDetail(item) {
  265. this.$store.dispatch("checkHandle", "/pageMy/reportDetail/reportDetail?id=" + item.ArticleId);
  266. },
  267. //去往主题详情
  268. themeDetails(item) {
  269. this.$store.dispatch("checkHandle", "/reportPages/researchTheme/researchTheme?id=" + item.IndustrialManagementId);
  270. },
  271. //计算遍历的颜色
  272. serialBackground(index) {
  273. index += 1;
  274. return index == 1 ? "#D7584F" : index == 2 ? "#E98033" : index == 3 ? "#FDD367" : "#D3D3D3";
  275. },
  276. },
  277. };
  278. </script>
  279. <style lang="scss">
  280. .resear-container {
  281. padding: 220rpx 0 0;
  282. background-color: #f7f7f7;
  283. .theme {
  284. background-color: #fff;
  285. padding: 0 30rpx 15rpx;
  286. margin-bottom: 8rpx;
  287. .theme-top {
  288. display: flex;
  289. color: #999999;
  290. align-items: center;
  291. font-size: 28rpx;
  292. height: 95rpx;
  293. justify-content: space-between;
  294. .title {
  295. color: #333;
  296. font-size: 32rpx;
  297. font-weight: 500;
  298. }
  299. }
  300. .theme-content {
  301. display: flex;
  302. flex-wrap: wrap;
  303. .theme-ul {
  304. width: 50%;
  305. display: flex;
  306. align-items: center;
  307. padding-right: 15rpx;
  308. line-height: 59rpx;
  309. image {
  310. width: 26rpx;
  311. height: 28rpx;
  312. margin-left: 8rpx;
  313. flex-shrink: 0;
  314. }
  315. }
  316. }
  317. }
  318. .content-ul {
  319. margin: 20rpx 0 0;
  320. border-top: 1px solid #f6f6f6;
  321. .user-li,
  322. .hot-li,
  323. .kol-li {
  324. padding: 30rpx 0 20rpx;
  325. border-bottom: 1px solid #f6f6f6;
  326. }
  327. .user-img {
  328. width: 40%;
  329. justify-content: space-between;
  330. .img-box {
  331. display: flex;
  332. align-items: center;
  333. }
  334. .user-pv {
  335. width: 21rpx;
  336. height: 16rpx;
  337. }
  338. }
  339. .kol-li {
  340. display: flex;
  341. align-items: center;
  342. padding-bottom: 30rpx;
  343. image {
  344. width: 120rpx;
  345. height: 120rpx;
  346. border-radius: 8rpx;
  347. margin: 0 20rpx 0 15rpx;
  348. overflow: hidden;
  349. flex-shrink: 0;
  350. }
  351. }
  352. .kol-item {
  353. display: flex;
  354. flex-wrap: wrap;
  355. width: 480rpx;
  356. height: 120rpx;
  357. align-items: baseline;
  358. margin-bottom: 20rpx;
  359. .item-top {
  360. width: 100%;
  361. display: flex;
  362. align-items: center;
  363. justify-content: space-between;
  364. font-size: 29rpx;
  365. font-weight: 700;
  366. }
  367. .kol-text {
  368. width: 50%;
  369. margin-top: 10rpx;
  370. flex-shrink: 0;
  371. }
  372. }
  373. .li-serial {
  374. width: 26rpx;
  375. height: 26rpx;
  376. line-height: 26rpx;
  377. color: #fff;
  378. font-size: 20rpx;
  379. text-align: center;
  380. border-radius: 4rpx 4rpx 4rpx 4rpx;
  381. margin: 7rpx 10rpx 0 20rpx;
  382. flex-shrink: 0;
  383. }
  384. .serial-number {
  385. margin-top: 0 !important;
  386. }
  387. .li-item {
  388. display: flex;
  389. .li-industry {
  390. color: #3385ff;
  391. margin-left: 20rpx;
  392. display: inline-block;
  393. }
  394. .li-user {
  395. margin-left: 46rpx;
  396. }
  397. .li-title {
  398. display: flex;
  399. }
  400. }
  401. .li-bottom {
  402. display: flex;
  403. justify-content: space-between;
  404. align-items: center;
  405. margin-top: 30rpx;
  406. width: 100%;
  407. image {
  408. width: 23rpx;
  409. height: 26rpx;
  410. margin-right: 10rpx;
  411. }
  412. }
  413. .read-more {
  414. margin-left: 30rpx;
  415. margin-top: 20rpx;
  416. display: flex;
  417. flex-wrap: wrap;
  418. .text-box {
  419. margin-bottom: 27rpx;
  420. margin-right: 40rpx;
  421. padding: 0;
  422. font-size: 24rpx;
  423. color: #408fff;
  424. width: 170rpx;
  425. height: 46rpx;
  426. line-height: 46rpx;
  427. text-align: center !important;
  428. background: url(~@/static/img/report_bg.png) no-repeat;
  429. background-size: 100% 100%;
  430. text-indent: 0em;
  431. }
  432. }
  433. .attention {
  434. flex-shrink: 0;
  435. padding: 5rpx 28rpx;
  436. border-radius: 37rpx 37rpx 37rpx 37rpx;
  437. color: #fff;
  438. background: #3385ff;
  439. font-weight: 400;
  440. font-size: 24rpx;
  441. }
  442. .hot-item {
  443. justify-content: space-between;
  444. align-items: center;
  445. .hot-new {
  446. align-items: center;
  447. flex: 1;
  448. padding-right: 20rpx;
  449. }
  450. .new-img {
  451. width: 26rpx;
  452. height: 28rpx;
  453. margin-left: 15rpx;
  454. flex-shrink: 0;
  455. }
  456. }
  457. }
  458. .announcement {
  459. background: #fff;
  460. padding: 0 30rpx;
  461. .tab-cont {
  462. height: 115rpx;
  463. background-color: #fff;
  464. font-size: 32rpx;
  465. .scroll-tab {
  466. position: relative;
  467. width: 100%;
  468. white-space: nowrap;
  469. display: flex;
  470. justify-content: space-around;
  471. }
  472. .scroll-tab-item {
  473. text-align: center;
  474. display: inline-block;
  475. padding: 32rpx 8rpx 30rpx 8rpx;
  476. border-bottom: 8rpx solid transparent;
  477. margin-right: 60rpx;
  478. position: relative;
  479. color: #999999;
  480. font-size: 32rpx;
  481. &:last-child {
  482. margin-right: 0;
  483. }
  484. &.active {
  485. border-bottom: none;
  486. color: #333;
  487. font-weight: 500;
  488. }
  489. .border_act {
  490. width: 80%;
  491. height: 8rpx;
  492. position: absolute;
  493. bottom: 0;
  494. left: 50%;
  495. transform: translateX(-50%);
  496. }
  497. }
  498. }
  499. }
  500. .content-bottom {
  501. background-color: #fff;
  502. text-align: center;
  503. line-height: 100rpx;
  504. color: #c4c4c4;
  505. font-size: 20rpx;
  506. }
  507. }
  508. </style>