researchList.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. <template>
  2. <view class="research-list-container">
  3. <view class="announcement">
  4. <view class="tab-cont">
  5. <scroll-view
  6. scroll-x="true"
  7. scroll-with-animation
  8. class="scroll-tab"
  9. :scroll-into-view="'_' + tabIndex"
  10. >
  11. <block v-for="(item, index) in researchTabBars" :key="index">
  12. <view class="scroll-tab-item" :class="{ active: tagActive == item.name }" @click.stop="typeChange(item)">
  13. {{ item.titel }}
  14. <image
  15. src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/border_act.png"
  16. mode=""
  17. class="border_act"
  18. v-if="tagActive == item.name"
  19. ></image>
  20. </view>
  21. </block>
  22. </scroll-view>
  23. </view>
  24. <view class="content-ul" v-if="tagActive == '用户'">
  25. <view class="user-li" v-for="(item, index) in collectionList" :key="item.ArticleId">
  26. <view class="li-item">
  27. <text class="li-serial" :style="{ background: serialBackground(index) }">
  28. {{ index + 1 }}
  29. </text>
  30. <view>
  31. <text
  32. class="title"
  33. @click="goDetail(item)"
  34. :style="{ display: 'inline', marginLeft: item.Title.substr(0, 1) != '【' ? '14rpx' : 0 }"
  35. >{{ item.Title }}</text
  36. >
  37. <text class="li-industry" @click="themeDetails(key, '月度收藏榜')" v-for="key in item.List" :key="key.IndustrialManagementId">
  38. # {{ key.IndustryName }}
  39. </text>
  40. </view>
  41. </view>
  42. <view class="li-item li-bottom" style="color: #999999">
  43. <viwe class="time-user">
  44. <text>
  45. {{ item.PublishDate }}
  46. </text>
  47. <view class="li-user" @click="authorDetails(item)">
  48. <image class="user_report-img" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/user_report.png"></image>
  49. <text class="text_oneLine"> {{ item.NickName }}</text>
  50. </view>
  51. </viwe>
  52. <view class="li-item user-img">
  53. <view class="img-box">
  54. <image class="user-pv" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/examine_icon.png"></image>
  55. <text>
  56. {{ item.Pv }}
  57. </text>
  58. </view>
  59. <view class="img-box" @click="collectClick(item)">
  60. <image v-if="item.IsCollect" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/collect_act.png"></image>
  61. <image v-else src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/collect_ico.png"></image>
  62. <text class=""> {{ item.CollectNum }}人收藏 </text>
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. <!-- <view class="content-bottom">最新榜单您已掌握,明天再刷刷看~</view> -->
  68. </view>
  69. <view class="content-ul" v-if="hotList.length && tagActive == '主题'">
  70. <view class="hot-li" v-for="(item, index) in hotList" :key="item.IndustrialManagementId">
  71. <view class="li-item hot-item">
  72. <view style="display: flex" class="text_oneLine hot-new" @click="themeDetails(item, '主题热度榜')">
  73. <text class="li-serial serial-number" :style="{ background: serialBackground(index) }">
  74. {{ index + 1 }}
  75. </text>
  76. <text class="text_oneLine title" style="display: inline"> # {{ item.IndustryName }} </text>
  77. <image class="new-img" v-if="item.IsNew" src="https://hzstatic.hzinsights.com/cygx/icon/new_report.png"></image>
  78. </view>
  79. <text :class="item.IsFollw ? 'cancel-attention' : 'attention'" @click="isAttention(item, '主题')">{{
  80. item.IsFollw ? "取消关注" : "+ 关注"
  81. }}</text>
  82. </view>
  83. <view class="li-item read-more" @click="themeDetails(item, '主题热度榜')">
  84. <text class="text-box text_oneLine" v-for="val in item.IndustrialSubjectList" :key="val.IndustrialSubjectId">
  85. {{ val.SubjectName }}
  86. </text>
  87. </view>
  88. </view>
  89. <view class="content-button" @click="goThemeAuthor('主题')">查看全部主题>></view>
  90. </view>
  91. <view class="content-ul" v-if="kolList.length && tagActive == '专家'">
  92. <view class="kol-li" v-for="(item, index) in kolList" :key="item.DepartmentId">
  93. <text class="li-serial serial-number" :style="{ background: serialBackground(index) }">
  94. {{ index + 1 }}
  95. </text>
  96. <image @click="authorDetails(item)" :src="item.ImgUrl" v-if="item.ImgUrl"></image>
  97. <view class="li-item kol-item">
  98. <view class="item-top">
  99. <text @click="authorDetails(item)">
  100. {{ item.NickName }}
  101. </text>
  102. <text :class="item.IsFollw ? 'cancel-attention' : 'attention'" @click="isAttention(item, '专家')">{{
  103. item.IsFollw ? "取消关注" : "+ 关注"
  104. }}</text>
  105. </view>
  106. <text @click="themeDetails(val, 'KOL榜')" class="kol-text text_oneLine" v-for="val in item.List" :key="val.IndustrialManagementId">
  107. # {{ val.IndustryName }}
  108. </text>
  109. </view>
  110. </view>
  111. <view class="content-button" @click="goThemeAuthor('作者')">查看全部作者>></view>
  112. </view>
  113. </view>
  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. <Loading />
  130. </view>
  131. </template>
  132. <script>
  133. import { Reports, Research } from "@/config/api.js";
  134. import purchaserReportListMixins from "../components/purchaser-report-list-mixins.js";
  135. export default {
  136. data() {
  137. return {
  138. accounts: "",
  139. tagActive: "用户",
  140. collectionList: [], //用户收藏
  141. hotList: [],
  142. kolList: [],
  143. researchTabBars:[
  144. { titel: "月度收藏榜", name: "用户" },
  145. { titel: "主题热度榜", name: "主题" },
  146. { titel: "KOL榜", name: "专家" },
  147. ],
  148. confirmText: "知道了",
  149. isCancelBtn: false,
  150. goFollowShow: false,
  151. }
  152. },
  153. // purchaserReportListMixins 混入了 收藏、作者详情、文章详情、主题详情-method
  154. mixins:[purchaserReportListMixins],
  155. watch: {
  156. tagActive: {
  157. handler(val) {
  158. val == "用户" ? this.researchCollectionList() : val == "主题" ? this.researchHotList() : this.researchKolList();
  159. },
  160. immediate: true,
  161. },
  162. },
  163. mounted() {
  164. // 处理数据 列表同步详情
  165. uni.$on("updateFllowTheme", (data) => {
  166. this.hotList.forEach((item) => {
  167. if (item.IndustrialManagementId == data.id) {
  168. item.IsFollw = data.isFollw;
  169. }
  170. });
  171. });
  172. // 处理数据 列表同步详情
  173. uni.$on("updateFllowAuthor", (data) => {
  174. this.kolList.forEach((item) => {
  175. if (item.DepartmentId == data.id) {
  176. item.IsFollw = data.isFollw;
  177. }
  178. });
  179. });
  180. },
  181. methods: {
  182. //tabs切换
  183. typeChange(item) {
  184. this.tagActive = item.name;
  185. },
  186. //计算遍历的颜色
  187. serialBackground(index) {
  188. index += 1;
  189. return index == 1 ? "#D7584F" : index == 2 ? "#E98033" : index == 3 ? "#FDD367" : "#D3D3D3";
  190. },
  191. //用户收藏榜
  192. async researchCollectionList() {
  193. const res = await Research.researchCollectionList({ ChartPermissionId: 31 });
  194. if (res.Ret === 200) {
  195. this.collectionList = res.Data.List || [];
  196. }
  197. },
  198. //主题热度/近期更新更多
  199. async researchHotList() {
  200. const res = await Research.researchHotList({ ChartPermissionId: 31, ThemeType: 1 });
  201. if (res.Ret === 200) {
  202. this.hotList = res.Data.List || [];
  203. }
  204. },
  205. //KOL榜列表接口
  206. async researchKolList() {
  207. const res = await Research.researchKolList({ ChartPermissionId: 31 });
  208. if (res.Ret === 200) {
  209. this.kolList = res.Data.List || [];
  210. }
  211. },
  212. //关注
  213. async isAttention(item, val) {
  214. await this.$store.dispatch("showLoginModal");
  215. const res =
  216. val === "主题"
  217. ? await Reports.reportFllow({ IndustrialManagementId: item.IndustrialManagementId, PageRouter: this.$store.state.pageRouterReport })
  218. : await Reports.reportFllowDepartment({ DepartmentId: item.DepartmentId, PageRouter: this.$store.state.pageRouterReport });
  219. if (res.Ret === 200) {
  220. item.IsFollw = !item.IsFollw;
  221. if (res.Data.Status == 1) {
  222. this.goFollowShow = true;
  223. this.confirmText = res.Data.GoFollow ? "去关注" : "知道了";
  224. if (res.Data.GoFollow) {
  225. this.accounts = `${val == "主题" ? "产业" : "作者"}关注成功 <br> 想要及时获取该${
  226. val === "主题" ? "产业内容的更新推送" : "作者的报告更新提示"
  227. },请关注【查研观向小助手】公众号`;
  228. this.isCancelBtn = true;
  229. } else {
  230. this.accounts =
  231. `${val == "主题" ? "产业" : "作者"}` +
  232. `关注成功<br>请关注【查研观向小助手】公众号,及时获取${val === "主题" ? "产业" : "作者"}报告更新提醒`;
  233. }
  234. } else {
  235. uni.showToast({
  236. title: "已取消关注",
  237. icon: "none",
  238. duration: 2000,
  239. });
  240. }
  241. }
  242. },
  243. //去关注
  244. goFollowShowBtn() {
  245. if (this.confirmText == "去关注") {
  246. uni.navigateTo({
  247. url: "/activityPages/accountsOfficial/accountsOfficial",
  248. });
  249. }
  250. this.goFollowShow = false;
  251. },
  252. // 跳转主题 of 作者
  253. goThemeAuthor(type) {
  254. type === "主题"
  255. ? uni.navigateTo({ url: "/pages-purchaser/researchTheme/researchTheme" })
  256. : uni.navigateTo({ url: "/pages-purchaser/researchAuthor/researchAuthor" });
  257. },
  258. loadShare(option){
  259. this.tagActive = option.tagActive || "用户"
  260. }
  261. },
  262. /** 用户点击分享 */
  263. onShareAppMessage: function (res) {
  264. return {
  265. title: "研选榜单",
  266. path: "/pages-purchaser/researchList/researchList?tagActive=" + this.tagActive,
  267. };
  268. },
  269. onLoad(option) {
  270. this.loadShare(option);
  271. },
  272. }
  273. </script>
  274. <style lang="scss" scoped>
  275. @import "../components/purchaser-report-list.scss";
  276. .research-list-container{
  277. background-color: #f7f7f7;
  278. padding-top: 20rpx;
  279. box-sizing: border-box;
  280. .tab-cont {
  281. height: 115rpx;
  282. background-color: #fff;
  283. font-size: 32rpx;
  284. border-bottom: 1rpx solid #ececec;
  285. .scroll-tab {
  286. position: relative;
  287. width: 100%;
  288. white-space: nowrap;
  289. display: flex;
  290. justify-content: space-around;
  291. }
  292. .scroll-tab-item {
  293. text-align: center;
  294. display: inline-block;
  295. padding: 32rpx 8rpx 30rpx 8rpx;
  296. border-bottom: 8rpx solid transparent;
  297. margin-right: 60rpx;
  298. position: relative;
  299. color: #999999;
  300. font-size: 32rpx;
  301. &:last-child {
  302. margin-right: 0;
  303. }
  304. &.active {
  305. border-bottom: none;
  306. color: #333;
  307. font-weight: 500;
  308. }
  309. .border_act {
  310. width: 80%;
  311. height: 8rpx;
  312. position: absolute;
  313. bottom: 0;
  314. left: 50%;
  315. transform: translateX(-50%);
  316. }
  317. }
  318. }
  319. // .content-bottom {
  320. // background-color: #fff;
  321. // text-align: center;
  322. // line-height: 100rpx;
  323. // color: #c4c4c4;
  324. // font-size: 20rpx;
  325. // }
  326. .content-button {
  327. height: 100rpx;
  328. width: 100%;
  329. text-align: center;
  330. line-height: 100rpx;
  331. color: #3385ff;
  332. }
  333. }
  334. </style>