myCollection.vue 16 KB

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