playBack.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  1. <template>
  2. <view class="container container-play-back">
  3. <!-- 筛选部分 -->
  4. <view class="screen-item">
  5. <text :class="[isShowJurisdiction ? 'active' : '', 'text-item']" @click="permissioActivity">有权限行业</text>
  6. <!-- 各种状态选择 -->
  7. <view class="select-conyent">
  8. <van-dropdown-menu active-color="#333333">
  9. <van-dropdown-item id="industry" :title="chartPermissionName">
  10. <view class="menu-items">
  11. <view class="menu-items-box" v-for="item in listChartPermission" :key="item.ChartPermissionId" @click="overallClick(item)">
  12. <view class="items-box">
  13. <u-icon v-if="item.IsChoose" name="checkbox-mark" :color="isShowJurisdiction ? '#ccc' : '#2C83FF'" size="24"></u-icon>
  14. </view>
  15. <text>{{ item.PermissionName }}</text>
  16. </view>
  17. </view>
  18. <view class="replacement">
  19. <text @click="replacementBtn" class="replacement-box">重置</text>
  20. <text @click="replacementConfirm">确定</text>
  21. </view>
  22. </van-dropdown-item>
  23. </van-dropdown-menu>
  24. </view>
  25. <text v-for="item in activityTimeList" :key="item.Id" :class="item.IsChoose ? 'active' : ''" @click="isActivityDate(item.Id)">{{ item.StatusName }}</text>
  26. </view>
  27. <!-- 活动列表 -->
  28. <view class="collect-ul">
  29. <view class="collect-ltem" v-for="(item, index) in collectList" :key="index">
  30. <view class="title-date" @click="goDetail(item)">
  31. <text :class="item.ActivityType == 1 ? '' : 'xianxia'">{{ item.ActivityType == 1 ? "线上" : "线下" }}</text>
  32. {{ item.ActivityTimeText }}
  33. <view class="audio-back" v-if="item.AudioLink" @click.stop="audioPlayBack(item)">
  34. <image
  35. class="audio-img"
  36. :src="
  37. curVoiceId === item.ActivityId && !curAudioPaused
  38. ? 'https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/back_stop.png'
  39. : 'https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/back_group.png'
  40. "
  41. ></image>
  42. {{ curVoiceId === item.ActivityId && !curAudioPaused ? "暂停" : "回放" }}
  43. </view>
  44. </view>
  45. <view class="item-li">
  46. <view class="item-img" @click="goDetail(item)">
  47. <image :src="item.ImgUrl"> </image>
  48. <text v-if="item.ActiveState == 1" class="img-status begin">未开始</text>
  49. <text v-else-if="item.ActiveState == 2" class="img-status proceed">进行中</text>
  50. <text v-else class="img-status">已结束</text>
  51. <view class="img-type">
  52. <image :src="item.ImgUrlText" mode=""></image>
  53. </view>
  54. </view>
  55. <view class="item">
  56. <view class="item-text" @click="goDetail(item)">
  57. <text class="activity-title"> {{ item.ActivityName }} </text>
  58. <text class="text_twoLine" v-if="item.Expert">专家背景:{{ item.Expert }} </text>
  59. <text class="text_twoLine" v-if="item.DistinguishedGuest">嘉宾:{{ item.DistinguishedGuest }} </text>
  60. <text class="text_twoLine" v-if="item.Speaker">主讲人:{{ item.Speaker }}</text>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. <u-loadmore :status="status" icon-type="flower" :load-text="loadText" margin-top="20" v-if="totalPage > 1" />
  66. </view>
  67. <view v-if="showAudioBox">
  68. <audioModule :showAudioPop.sync="showAudioPop" />
  69. </view>
  70. </view>
  71. </template>
  72. <script>
  73. import { activity, User } from "@/config/api.js";
  74. import { Throttle } from "@/config/util.js";
  75. import audioModule from "@/components/audioModule/index";
  76. export default {
  77. data() {
  78. return {
  79. page_no: 1,
  80. pageSize: 10,
  81. collectList: [],
  82. status: "loadmore",
  83. refresh: false, //正在下拉
  84. isShowJurisdiction: false,
  85. isGetJurisdiction: 0,
  86. listChartPermission: [],
  87. chartPermissionName: "所有行业",
  88. chartPermissionIds: "",
  89. loadText: {
  90. loadmore: "上拉加载更多",
  91. loading: "加载中",
  92. nomore: "已经到底了",
  93. },
  94. showAudioPop: false,
  95. showAudioBox: false,
  96. };
  97. },
  98. components: { audioModule },
  99. methods: {
  100. //获取活动
  101. async getActivityList() {
  102. const res = await activity.getActivityListNew({
  103. PageSize: this.pageSize,
  104. CurrentIndex: this.page_no,
  105. ActiveState: "3",
  106. PlayBack: 1,
  107. IsShowJurisdiction: this.isGetJurisdiction,
  108. ChartPermissionIds: this.chartPermissionIds,
  109. });
  110. if (res.Ret === 200) {
  111. this.status = this.page_no < res.Data.Paging.Pages ? "loadmore" : "nomore";
  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 getUserSearchContent() {
  125. const res = await activity.getUserSearchContent({
  126. IsShowJurisdiction: this.isGetJurisdiction,
  127. });
  128. if (res.Ret === 200) {
  129. this.isShowJurisdiction = res.Data.IsShowJurisdiction;
  130. this.listChartPermission = res.Data.ListChartPermission;
  131. this.clickPermission();
  132. }
  133. },
  134. //是否有权限的点击事件
  135. async permissioActivity() {
  136. if (!this.$store.state.isAuth && !this.$store.state.isBind) {
  137. this.selectComponent("#industry").toggle(false);
  138. this.isShowJurisdiction = !this.isShowJurisdiction;
  139. this.isGetJurisdiction = this.isShowJurisdiction ? 1 : 2;
  140. await this.getUserSearchContent();
  141. if (this.isShowJurisdiction) {
  142. this.getActivityList();
  143. this.replacementConfirm();
  144. } else {
  145. this.replacementBtn();
  146. }
  147. } else {
  148. //已授权未绑定
  149. uni.navigateTo({
  150. url: "/pageMy/login/login",
  151. });
  152. }
  153. },
  154. //点击后有权限的
  155. clickPermission() {
  156. if (this.isShowJurisdiction) {
  157. const arr = [];
  158. this.listChartPermission &&
  159. this.listChartPermission.forEach((key) => {
  160. if (key.IsChoose) {
  161. arr.push(key.ChartPermissionId);
  162. }
  163. });
  164. this.chartPermissionIds = arr.join(",");
  165. }
  166. },
  167. //去往详情页面
  168. goDetail(item) {
  169. this.$store.dispatch("checkHandle", "/activityPages/activityDetail/activityDetail?id=" + item.ActivityId);
  170. },
  171. //下拉选择的确定事件
  172. replacementConfirm() {
  173. const arr = [];
  174. const str = [];
  175. this.listChartPermission &&
  176. this.listChartPermission.forEach((key) => {
  177. if (key.IsChoose) {
  178. arr.push(key.ChartPermissionId);
  179. str.push(key.PermissionName);
  180. }
  181. });
  182. if ((str.length == 6 && this.listChartPermission.length == 6) || str.length <= 0) {
  183. this.chartPermissionName = "所有行业";
  184. } else {
  185. this.chartPermissionName = str.join(",");
  186. }
  187. this.chartPermissionIds = arr.join(",");
  188. this.getActivityList();
  189. this.selectComponent("#industry").toggle(false);
  190. },
  191. // 下拉的选择的重置事件
  192. replacementBtn() {
  193. this.chartPermissionIds = "";
  194. this.isShowJurisdiction = false;
  195. this.listChartPermission.map((item) => (item.IsChoose = false));
  196. this.chartPermissionName = "所有行业";
  197. this.getActivityList();
  198. },
  199. // 选择的选中事件
  200. overallClick(item) {
  201. if (this.isShowJurisdiction) return;
  202. item.IsChoose = !item.IsChoose;
  203. },
  204. //点击了回放
  205. audioPlayBack(item) {
  206. // 判断是否为同一个音频
  207. if (this.$store.state.audioBg.activityId == item.ActivityId) {
  208. if (this.globalBgAudioManager.paused) {
  209. this.globalBgAudioManager.play();
  210. } else {
  211. this.globalBgAudioManager.pause();
  212. }
  213. } else {
  214. this.$store.commit("audioBg/addAudio", { list: item.VoiceList, activityId: item.ActivityId, activityTitle: item.ActivityName });
  215. }
  216. this.showAudioPop = true;
  217. },
  218. },
  219. computed: {
  220. curVoiceId() {
  221. //当前正在播放的音频id
  222. return this.$store.state.audioBg.activityId;
  223. },
  224. curAudioPaused() {
  225. //当前音频是否暂停状态
  226. return this.$store.state.audioBg.paused;
  227. },
  228. },
  229. onLoad() {
  230. this.getActivityList();
  231. this.getUserSearchContent();
  232. },
  233. onShow() {
  234. this.showAudioBox = true;
  235. },
  236. onHide() {
  237. this.showAudioBox = false;
  238. },
  239. /* 触底 */
  240. onReachBottom: Throttle(function () {
  241. if (this.status === "nomore") return;
  242. this.status = "loading";
  243. this.page_no++;
  244. this.getActivityList();
  245. }),
  246. /* 用户点击分享 */
  247. onShareAppMessage: function (res) {
  248. return {
  249. title: this.isHorzMobile ? "好友向您推荐此内容,上传名片享查研观向免费月卡!" : "活动回放",
  250. path: "/activityPages/playBack/playBack",
  251. success: (res) => {},
  252. fail: (err) => {},
  253. };
  254. },
  255. };
  256. </script>
  257. <style lang="scss" scoped>
  258. .container-play-back {
  259. background: #f7f7f7;
  260. padding-bottom: 30rpx;
  261. .title-date {
  262. position: relative;
  263. .audio-back {
  264. position: absolute;
  265. right: 0;
  266. top: 50%;
  267. transform: translateY(-50%);
  268. width: 99rpx;
  269. height: 39rpx;
  270. font-size: 24rpx;
  271. color: #fff;
  272. display: flex;
  273. align-items: center;
  274. background-color: #3385ff;
  275. border-radius: 20rpx;
  276. padding-left: 4rpx;
  277. .audio-img {
  278. width: 30rpx;
  279. height: 30rpx;
  280. margin: 0 5rpx;
  281. }
  282. }
  283. }
  284. .screen-item {
  285. position: sticky;
  286. top: 0;
  287. left: 0;
  288. z-index: 9;
  289. background-color: #fff;
  290. height: 111rpx;
  291. padding: 0 34rpx;
  292. font-size: 24rpx;
  293. color: #333;
  294. display: flex;
  295. align-items: center;
  296. .text-item {
  297. width: 150rpx;
  298. text-align: center;
  299. line-height: 51rpx;
  300. box-sizing: border-box;
  301. border-radius: 26rpx;
  302. background-color: #f8f8fa;
  303. margin-right: 20rpx;
  304. }
  305. .active {
  306. background-color: #3385ff;
  307. color: #fff;
  308. }
  309. }
  310. .select-conyent {
  311. .items-box {
  312. width: 40rpx;
  313. }
  314. .menu-items {
  315. background-color: #f8f8fa;
  316. width: 100%;
  317. display: flex;
  318. flex-wrap: wrap;
  319. padding: 30rpx 30rpx 0;
  320. .menu-items-box {
  321. display: flex;
  322. width: 50%;
  323. font-size: 28rpx;
  324. font-weight: 400;
  325. margin-bottom: 40rpx;
  326. }
  327. }
  328. .replacement {
  329. margin: 0rpx 30rpx 20rpx;
  330. display: flex;
  331. background-color: #2c83ff;
  332. height: 60rpx;
  333. line-height: 58rpx;
  334. font-size: 28rpx;
  335. font-weight: 400;
  336. color: #ffffff;
  337. border-radius: 30rpx;
  338. text {
  339. flex: 1;
  340. text-align: center;
  341. line-height: 60rpx;
  342. }
  343. .replacement-box {
  344. border: 1rpx solid #2c83ff;
  345. line-height: 58rpx;
  346. color: #2c83ff;
  347. background: #ffffff;
  348. border-radius: 28rpx 0rpx 28rpx 28rpx;
  349. }
  350. }
  351. }
  352. @import "../components/indexActivity.scss";
  353. }
  354. /deep/.van-dropdown-menu {
  355. background-color: #fff;
  356. box-shadow: none !important;
  357. display: flex;
  358. align-items: center;
  359. }
  360. /deep/.van-dropdown-menu__item {
  361. box-sizing: border-box;
  362. width: 190rpx;
  363. margin-right: 40rpx;
  364. padding-right: 20rpx;
  365. height: 51rpx;
  366. border-radius: 26rpx;
  367. background: #f8f8fa;
  368. }
  369. /deep/.van-dropdown-item {
  370. margin-top: -10rpx;
  371. }
  372. /deep/[data-index="2"] {
  373. margin-right: 0rpx;
  374. }
  375. /deep/ .van-ellipsis {
  376. font-size: 24rpx;
  377. }
  378. </style>