myCollection.vue 13 KB

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