myCollection.vue 13 KB

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