playBack.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  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. 回放
  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. <audioModule :showAudioPop.sync="showAudioPop" />
  68. </view>
  69. </template>
  70. <script>
  71. import { activity, User } from "@/config/api.js";
  72. import { Throttle } from "@/config/util.js";
  73. import audioModule from "@/components/audioModule/index";
  74. export default {
  75. data() {
  76. return {
  77. page_no: 1,
  78. pageSize: 10,
  79. collectList: [],
  80. status: "loadmore",
  81. refresh: false, //正在下拉
  82. isShowJurisdiction: false,
  83. isGetJurisdiction: 0,
  84. listChartPermission: [],
  85. chartPermissionName: "所有行业",
  86. chartPermissionIds: "",
  87. loadText: {
  88. loadmore: "上拉加载更多",
  89. loading: "加载中",
  90. nomore: "已经到底了",
  91. },
  92. showAudioPop: false,
  93. };
  94. },
  95. components: { audioModule },
  96. methods: {
  97. //获取活动
  98. async getActivityList() {
  99. const res = await activity.getActivityListNew({
  100. PageSize: this.pageSize,
  101. CurrentIndex: this.page_no,
  102. ActiveState: "3",
  103. PlayBack: 1,
  104. IsShowJurisdiction: this.isGetJurisdiction,
  105. ChartPermissionIds: this.chartPermissionIds,
  106. });
  107. if (res.Ret === 200) {
  108. this.status = this.page_no < res.Data.Paging.Pages ? "loadmore" : "nomore";
  109. if (this.page_no === 1) {
  110. this.collectList = res.Data.List || [];
  111. this.haveData = this.collectList.length ? true : false;
  112. if (this.refresh) {
  113. uni.stopPullDownRefresh();
  114. this.refresh = false;
  115. }
  116. } else {
  117. this.collectList = this.collectList.concat(res.Data.List);
  118. }
  119. }
  120. },
  121. async getUserSearchContent() {
  122. const res = await activity.getUserSearchContent({
  123. IsShowJurisdiction: this.isGetJurisdiction,
  124. });
  125. if (res.Ret === 200) {
  126. this.isShowJurisdiction = res.Data.IsShowJurisdiction;
  127. this.listChartPermission = res.Data.ListChartPermission;
  128. this.clickPermission();
  129. }
  130. },
  131. //是否有权限的点击事件
  132. async permissioActivity() {
  133. if (!this.$store.state.isAuth && !this.$store.state.isBind) {
  134. this.selectComponent("#industry").toggle(false);
  135. this.isShowJurisdiction = !this.isShowJurisdiction;
  136. this.isGetJurisdiction = this.isShowJurisdiction ? 1 : 2;
  137. await this.getUserSearchContent();
  138. if (this.isShowJurisdiction) {
  139. this.getActivityList();
  140. } else {
  141. this.replacementBtn();
  142. }
  143. } else {
  144. //已授权未绑定
  145. uni.navigateTo({
  146. url: "/pageMy/login/login",
  147. });
  148. }
  149. },
  150. //点击后有权限的
  151. clickPermission() {
  152. if (this.isShowJurisdiction) {
  153. const arr = [];
  154. this.listChartPermission &&
  155. this.listChartPermission.forEach((key) => {
  156. if (key.IsChoose) {
  157. arr.push(key.ChartPermissionId);
  158. }
  159. });
  160. this.chartPermissionIds = arr.join(",");
  161. }
  162. },
  163. //去往详情页面
  164. goDetail(item) {
  165. this.$store.dispatch("checkHandle", "/activityPages/activityDetail/activityDetail?id=" + item.ActivityId);
  166. },
  167. //下拉选择的确定事件
  168. replacementConfirm() {
  169. const arr = [];
  170. const str = [];
  171. this.listChartPermission &&
  172. this.listChartPermission.forEach((key) => {
  173. if (key.IsChoose) {
  174. arr.push(key.ChartPermissionId);
  175. str.push(key.PermissionName);
  176. }
  177. });
  178. if ((str.length == 6 && this.listChartPermission.length == 6) || str.length <= 0) {
  179. this.chartPermissionName = "所有行业";
  180. } else {
  181. this.chartPermissionName = str.join(",");
  182. }
  183. this.chartPermissionIds = arr.join(",");
  184. this.getActivityList();
  185. this.selectComponent("#industry").toggle(false);
  186. },
  187. // 下拉的选择的重置事件
  188. replacementBtn() {
  189. this.chartPermissionIds = "";
  190. this.isShowJurisdiction = false;
  191. this.listChartPermission.map((item) => (item.IsChoose = false));
  192. this.chartPermissionName = "所有行业";
  193. this.getActivityList();
  194. },
  195. // 选择的选中事件
  196. overallClick(item) {
  197. if (this.isShowJurisdiction) return;
  198. item.IsChoose = !item.IsChoose;
  199. },
  200. //点击了回放
  201. audioPlayBack(item) {
  202. // 判断是否为同一个音频
  203. if (this.$store.state.audioBg.activityId == item.ActivityId) {
  204. if (this.globalBgAudioManager.paused) {
  205. this.globalBgAudioManager.play();
  206. } else {
  207. this.globalBgAudioManager.pause();
  208. }
  209. } else {
  210. this.showAudioPop = true;
  211. this.$store.commit("audioBg/addAudio", { list: item.VoiceList, activityId: item.ActivityId, activityTitle: item.ActivityName });
  212. }
  213. },
  214. },
  215. computed: {
  216. curVoiceId() {
  217. //当前正在播放的音频id
  218. return this.$store.state.audioBg.activityId;
  219. },
  220. curAudioPaused() {
  221. //当前音频是否暂停状态
  222. return this.$store.state.audioBg.paused;
  223. },
  224. },
  225. onLoad() {
  226. this.getActivityList();
  227. this.getUserSearchContent();
  228. },
  229. /* 触底 */
  230. onReachBottom: Throttle(function () {
  231. if (this.status === "nomore") return;
  232. this.status = "loading";
  233. this.page_no++;
  234. this.getActivityList();
  235. }),
  236. };
  237. </script>
  238. <style lang="scss" scoped>
  239. .container-play-back {
  240. background: #f7f7f7;
  241. padding-bottom: 30rpx;
  242. .title-date {
  243. position: relative;
  244. .audio-back {
  245. position: absolute;
  246. right: 0;
  247. top: 50%;
  248. transform: translateY(-50%);
  249. width: 99rpx;
  250. height: 39rpx;
  251. font-size: 24rpx;
  252. color: #fff;
  253. display: flex;
  254. align-items: center;
  255. background-color: #3385ff;
  256. border-radius: 20rpx;
  257. .audio-img {
  258. width: 30rpx;
  259. height: 30rpx;
  260. margin: 0 5rpx;
  261. }
  262. }
  263. }
  264. .screen-item {
  265. position: sticky;
  266. top: 0;
  267. left: 0;
  268. z-index: 9;
  269. background-color: #fff;
  270. height: 111rpx;
  271. padding: 0 34rpx;
  272. font-size: 24rpx;
  273. color: #333;
  274. display: flex;
  275. align-items: center;
  276. .text-item {
  277. width: 150rpx;
  278. text-align: center;
  279. line-height: 51rpx;
  280. box-sizing: border-box;
  281. border-radius: 26rpx;
  282. background-color: #f8f8fa;
  283. margin-right: 20rpx;
  284. }
  285. .active {
  286. background-color: #3385ff;
  287. color: #fff;
  288. }
  289. }
  290. .select-conyent {
  291. .items-box {
  292. width: 40rpx;
  293. }
  294. .menu-items {
  295. background-color: #f8f8fa;
  296. width: 100%;
  297. display: flex;
  298. flex-wrap: wrap;
  299. padding: 30rpx 30rpx 0;
  300. .menu-items-box {
  301. display: flex;
  302. width: 50%;
  303. font-size: 28rpx;
  304. font-weight: 400;
  305. margin-bottom: 40rpx;
  306. }
  307. }
  308. .replacement {
  309. margin: 0rpx 30rpx 20rpx;
  310. display: flex;
  311. background-color: #2c83ff;
  312. height: 60rpx;
  313. line-height: 58rpx;
  314. font-size: 28rpx;
  315. font-weight: 400;
  316. color: #ffffff;
  317. border-radius: 30rpx;
  318. text {
  319. flex: 1;
  320. text-align: center;
  321. line-height: 60rpx;
  322. }
  323. .replacement-box {
  324. border: 1rpx solid #2c83ff;
  325. line-height: 58rpx;
  326. color: #2c83ff;
  327. background: #ffffff;
  328. border-radius: 28rpx 0rpx 28rpx 28rpx;
  329. }
  330. }
  331. }
  332. @import "../components/indexActivity.scss";
  333. }
  334. /deep/.van-dropdown-menu {
  335. background-color: #fff;
  336. box-shadow: none !important;
  337. display: flex;
  338. align-items: center;
  339. }
  340. /deep/.van-dropdown-menu__item {
  341. box-sizing: border-box;
  342. width: 190rpx;
  343. margin-right: 40rpx;
  344. padding-right: 20rpx;
  345. height: 51rpx;
  346. border-radius: 26rpx;
  347. background: #f8f8fa;
  348. }
  349. /deep/.van-dropdown-item {
  350. margin-top: -10rpx;
  351. }
  352. /deep/[data-index="2"] {
  353. margin-right: 0rpx;
  354. }
  355. /deep/ .van-ellipsis {
  356. font-size: 24rpx;
  357. }
  358. </style>