myCollection.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  1. <template>
  2. <view class="container myCollection-container">
  3. <view class="global_one_tabs top-tabs">
  4. <view :class="['item', item.id == tabsActive && 'tabs-active']" v-for="item in tabsList" :key="item.id" @click="handleClickTopSub(item)">
  5. {{ item.name }}
  6. </view>
  7. </view>
  8. <view class="collect-ul" v-if="haveData">
  9. <view class="audio-video-content" v-if="tabsActive == 2">
  10. <view class="audio-item" v-for="item in collectList" :key="item.Id">
  11. <RoadshowItem :list="item" @isCollectionHandeler="isCollectionHandeler" />
  12. </view>
  13. </view>
  14. <blok v-else-if="tabsActive == 3">
  15. <viwe class="chart-ul">
  16. <view style="width: 49%" v-for="item in collectList" :key="item.Id">
  17. <ChartItem class="chart-item" :isMyChartCollection="true" :list="item" @myChartIsTop="myChartIsTop" @myChartCollect="myChartCollect" />
  18. </view>
  19. </viwe>
  20. </blok>
  21. <block v-else>
  22. <view class="global_card_content content-item" v-for="item in collectList" :key="item.ArticleId">
  23. <blok v-if="item.NickName">
  24. <view class="item-user" v-if="item.Source == 2 || item.IsSpecial == 1">
  25. <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/user_report.png"></image>
  26. <text> {{ item.NickName }}</text>
  27. </view>
  28. </blok>
  29. <view class="title-content-box">
  30. <view v-if="item.ArticleTypeName" class="tag global_content_center">{{ item.ArticleTypeName }}</view>
  31. <view class="item-title global_title" @click="goDetailReport(item)">
  32. {{ item.Title }}
  33. <block v-if="item.SpecialTags && item.IsSpecial == 1">
  34. <text @click.stop="themeDetails(item, val)" style="color: #90aeda" v-for="it in item.SpecialTags.split(',')" class="item-industry" :key="it">#{{ it }}</text>
  35. </block>
  36. <text @click.stop="themeDetails(item, val)" class="item-industry" v-for="val in item.List" :key="val.IndustrialManagementId"> # {{ val.IndustryName }} </text>
  37. </view>
  38. </view>
  39. <view class="item-more">
  40. <text>{{ item.PublishDate }}</text>
  41. <view class="global_pv-ollect" v-if="item.Source == 2 || item.IsSpecial == 1">
  42. <view>
  43. <image class="pv" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/new_cygx/examine_icon.png"></image>
  44. {{ item.Pv }}
  45. </view>
  46. <view @click="collectClick(item)">
  47. <image v-if="item.IsCollect" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/new_cygx/collect_act.png"></image>
  48. <image v-else src="https://hzchart.oss-cn-shanghai.aliyuncs.com/new_cygx/collect_ico.png"></image>
  49. {{ item.CollectNum }}
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. </block>
  55. <u-loadmore :status="status" icon-type="flower" :load-text="loadText" margin-top="20" v-if="totalPage > 1" />
  56. </view>
  57. <view class="nodata" v-else>
  58. <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/act_search.png" mode="" class="nodata_ico"></image>
  59. <text>暂时没有收藏的内容</text>
  60. </view>
  61. <freeCharge class="free-charge" :isShowFreeBtn="isShowFree" />
  62. <Loading />
  63. <view v-if="showAudioBox">
  64. <audioModule :showAudioPop.sync="showAudioPop" />
  65. </view>
  66. </view>
  67. </template>
  68. <script>
  69. import { Mine, Report, Home, User, Chart, purchaserApi } from "@/config/api.js";
  70. import RoadshowItem from "@/components/ItemComponent/roadshowItem.vue";
  71. import freeCharge from "@/components/freeCharge";
  72. import ChartItem from "@/components/ItemComponent/chartItem.vue";
  73. import audioModule from "@/components/audioModule/index";
  74. export default {
  75. data() {
  76. return {
  77. page_no: 1,
  78. pageSize: 10,
  79. collectList: [],
  80. videoAudioList: [],
  81. status: "loadmore",
  82. totalPage: "",
  83. loadText: {
  84. loadmore: "上拉加载更多",
  85. loading: "加载中",
  86. nomore: "已经到底了",
  87. },
  88. haveData: true, //是否有数据
  89. refresh: false, //正在下拉
  90. tabsList: [
  91. { name: "报告", id: 1 },
  92. { name: "微路演", id: 2 },
  93. { name: "图表", id: 3 },
  94. ],
  95. tabsActive: 1,
  96. showAudioPop:false
  97. };
  98. },
  99. onLoad() {
  100. uni.hideShareMenu();
  101. this.getCollectList();
  102. },
  103. components: {
  104. freeCharge,
  105. RoadshowItem,
  106. ChartItem,
  107. audioModule
  108. },
  109. methods: {
  110. /* 获取列表 */
  111. async getCollectList() {
  112. const res =
  113. this.tabsActive == 1
  114. ? await Mine.getCollect({
  115. PageSize: this.pageSize,
  116. CurrentIndex: this.page_no,
  117. })
  118. : this.tabsActive == 3
  119. ? await Chart.getChartcollection({
  120. PageSize: this.pageSize,
  121. CurrentIndex: this.pageNum,
  122. })
  123. : this.getrroadshowList();
  124. if (res.Ret === 200) {
  125. this.status = this.page_no < res.Data.Paging.Pages ? "loadmore" : "nomore";
  126. this.totalPage = res.Data.Paging.Pages; //总页数
  127. if (this.page_no === 1) {
  128. this.collectList = res.Data.List || [];
  129. this.haveData = this.collectList.length ? true : false;
  130. if (this.refresh) {
  131. uni.stopPullDownRefresh();
  132. this.refresh = false;
  133. }
  134. } else {
  135. this.collectList = this.collectList.concat(res.Data.List);
  136. }
  137. }
  138. },
  139. async getrroadshowList() {
  140. const res = await User.getListMicroRoadshow();
  141. if (res.Ret === 200) {
  142. this.status = this.page_no < res.Data.Paging.Pages ? "loadmore" : "nomore";
  143. this.totalPage = res.Data.Paging.Pages; //总页数
  144. if (this.page_no === 1) {
  145. this.collectList = res.Data.List || [];
  146. this.haveData = this.collectList.length ? true : false;
  147. if (this.refresh) {
  148. uni.stopPullDownRefresh();
  149. this.refresh = false;
  150. }
  151. } else {
  152. this.collectList = this.collectList.concat(res.Data.List);
  153. }
  154. }
  155. },
  156. // 去往文章详情页面
  157. goDetailReport(item) {
  158. if (item.IsSpecial == 1) {
  159. uni.navigateTo({ url: "/pages-purchaser/noteAndViewpoint/noteAndViewpoint?id=" + item.ArticleId });
  160. return;
  161. }
  162. if (item.IsRoadShow) {
  163. //跳转路演精华
  164. uni.navigateTo({
  165. url: "/reportPages/roadEssence/roadEssence?id=" + item.ArticleId,
  166. });
  167. } else {
  168. uni.navigateTo({ url: "/pageMy/reportDetail/reportDetail?id=" + item.ArticleId });
  169. }
  170. },
  171. // 去往主题详情
  172. themeDetails(item, val) {
  173. if (item.IsSpecial == 1) return;
  174. if (item.Source === 1) {
  175. //非严选
  176. uni.navigateTo({ url: "/reportPages/IndustryReport/IndustryReport?id=" + val.IndustrialManagementId });
  177. } else {
  178. //严选
  179. uni.navigateTo({ url: "/reportPages/researchTheme/researchTheme?id=" + val.IndustrialManagementId });
  180. }
  181. },
  182. // 收藏
  183. async collectClick(item) {
  184. const res =
  185. item.IsSpecial == 1
  186. ? await purchaserApi.yanxuanSpecialCollect({
  187. Id: item.ArticleId,
  188. Status: item.IsCollect ? 2 : 1,
  189. })
  190. : await Report.collectRpt({ ArticleId: item.ArticleId });
  191. if (res.Ret === 200) {
  192. item.IsCollect = !item.IsCollect;
  193. item.IsCollect
  194. ? (item.CollectNum += 1) &&
  195. uni.showToast({
  196. title: "收藏成功",
  197. icon: "none",
  198. duration: 2000,
  199. })
  200. : (item.CollectNum -= 1);
  201. !item.IsCollect &&
  202. uni.showToast({
  203. title: "已取消收藏",
  204. icon: "none",
  205. duration: 2000,
  206. });
  207. }
  208. },
  209. // 点击top tabs
  210. handleClickTopSub(item) {
  211. this.tabsActive = item.id;
  212. this.page_no = 1;
  213. this.collectList = [];
  214. this.getCollectList();
  215. },
  216. // 微路演收藏
  217. async isCollectionHandeler(item) {
  218. await this.$store.dispatch("showLoginModal");
  219. const res = await Home.microRoadshowCollect({
  220. SourceId: item.SourceId,
  221. SourceType: item.Type,
  222. PageRouter: this.$store.state.pageRouterReport,
  223. });
  224. if (res.Ret === 200) {
  225. let index = this.collectList.findIndex((key) => key.SourceId == item.SourceId && key.Type == item.Type);
  226. this.collectList.splice(index, 1);
  227. uni.showToast({
  228. title: res.Msg,
  229. duration: 2000,
  230. });
  231. }
  232. },
  233. //我的收藏的删除
  234. myChartCollect(id) {
  235. uni.showModal({
  236. content: "确认要将该图表移除我的收藏吗?",
  237. confirmColor: "#376cbb",
  238. cancelColor: "#606266",
  239. success: async (res) => {
  240. if (res.confirm) {
  241. const res = await Chart.myChartCollect({
  242. ChartId: id,
  243. });
  244. if (res.Ret === 200) {
  245. this.page_no = 1;
  246. this.getCollectList();
  247. this.$util.toast("已取消收藏");
  248. }
  249. }
  250. },
  251. });
  252. },
  253. //我的收藏 置顶
  254. async myChartIsTop(id) {
  255. const res = await Chart.myChartTop({
  256. ChartId: id,
  257. });
  258. if (res.Ret === 200) {
  259. this.page_no = 1;
  260. this.getCollectList();
  261. this.$util.toast(res.Msg);
  262. }
  263. },
  264. },
  265. computed: {
  266. curVoiceId() {
  267. //当前正在播放的音频id
  268. return this.$store.state.audioBg.indexId;
  269. },
  270. curAudioPaused() {
  271. //当前音频是否暂停状态
  272. return this.$store.state.audioBg.paused;
  273. },
  274. showAudioBox() {
  275. return this.$store.state.audioBg.parseIntShow;
  276. },
  277. },
  278. onShow() {
  279. this.$store.commit("audioBg/parseIntAudio", true);
  280. this.$store.commit("setRouterReport", "收藏");
  281. },
  282. onHide() {
  283. this.$store.commit("audioBg/parseIntAudio", false);
  284. this.curVideoId = 0;
  285. },
  286. /* 触底 */
  287. onReachBottom() {
  288. if (this.status === "nomore") return;
  289. this.status = "loading";
  290. this.page_no++;
  291. this.getCollectList();
  292. },
  293. /* 下拉刷新 */
  294. onPullDownRefresh() {
  295. this.page_no = 1;
  296. this.refresh = true;
  297. this.getCollectList();
  298. },
  299. /** 用户点击分享*/
  300. onShareAppMessage: function ({ from, target }) {
  301. if (from === "button") {
  302. let item = target.dataset.item;
  303. let audio_id = item.Type == 1 || item.AudioType == 1 ? item.Id : "";
  304. // type=2 -- 活动视频 type=3 -- 产业视频
  305. let video_id = item.Type == 2 || item.Type == 3 ? item.Id : "";
  306. let activity_id = item.Type == 2 && item.ActivityId > 0 ? item.ActivityId : "";
  307. let title_share = item.AudioTitle || item.Title;
  308. this.getRecordTracking("我的收藏转发", { ActivityId: item.ActivityId, Id: item.Id, Type: item.Type });
  309. return {
  310. title: this.isHorzMobile ? "好友向您推荐此内容,上传名片享查研观向免费月卡!" : title_share,
  311. path: "/pages/material/material?topTabsActive=4" + "&audioShareId=" + audio_id + "&videoShareId=" + video_id + "&activityId=" + activity_id,
  312. imageUrl: item.AudioShareImg || item.ShareImg,
  313. };
  314. }
  315. },
  316. };
  317. </script>
  318. <style lang="scss">
  319. .myCollection-container {
  320. background-color: $uni-bg-color;
  321. .top-tabs {
  322. .item {
  323. flex: 1;
  324. }
  325. }
  326. .collect-ul {
  327. padding: 4rpx 25rpx 20rpx;
  328. .content-item {
  329. background-color: #fff;
  330. margin-top: 20rpx;
  331. padding: 35rpx 20rpx 0;
  332. border-top: 4rpx solid #376cbb;
  333. .title-content-box {
  334. display: flex;
  335. .tag {
  336. width: 126rpx;
  337. height: 42rpx;
  338. color: #928563;
  339. font-size: 24rpx;
  340. font-weight: 500;
  341. border-radius: 38rpx;
  342. background-color: #f2e8cc;
  343. flex-shrink: 0;
  344. margin-right: 10rpx;
  345. }
  346. }
  347. .item-title {
  348. font-weight: 500;
  349. position: relative;
  350. .item-industry {
  351. font-size: 28rpx;
  352. text-indent: 0;
  353. margin-left: 10rpx;
  354. color: $uni-color-new;
  355. display: inline-block;
  356. }
  357. }
  358. .item-user {
  359. display: flex;
  360. align-items: center;
  361. color: #999999;
  362. font-size: 28rpx;
  363. margin-bottom: 20rpx;
  364. image {
  365. width: 23rpx;
  366. height: 26rpx;
  367. margin-right: 20rpx;
  368. }
  369. }
  370. .item-more {
  371. display: flex;
  372. justify-content: space-between;
  373. color: #cecece;
  374. margin: 20rpx 0 0;
  375. padding-bottom: 30rpx;
  376. }
  377. }
  378. }
  379. .audio-video-content {
  380. display: flex;
  381. flex-wrap: wrap;
  382. justify-content: space-between;
  383. padding-top: 20rpx;
  384. .audio-item {
  385. width: 49%;
  386. }
  387. }
  388. .chart-ul {
  389. display: flex;
  390. flex-wrap: wrap;
  391. padding-top: 20rpx;
  392. justify-content: space-between;
  393. }
  394. }
  395. </style>