list.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768
  1. <template>
  2. <div class="page">
  3. <van-list
  4. v-model="loadingMore"
  5. :finished="finished"
  6. :immediate-check="false"
  7. :finished-text="total ? '没有更多了' : ''"
  8. @load="fetchVideoList"
  9. >
  10. <div class="page-top"></div>
  11. <div class="page-content">
  12. <!-- 操作区域 -->
  13. <div class="control">
  14. <div class="search">
  15. <el-input
  16. placeholder="搜索登录账户后四位或所属机构"
  17. @keyup.enter.native="getList"
  18. v-model="listQuery.clubUserName"
  19. clearable
  20. @clear="getList"
  21. >
  22. <i slot="prefix" class="el-input__icon el-icon-search"></i>
  23. </el-input>
  24. </div>
  25. <div class="publish" @click="onPublish">发布视频</div>
  26. </div>
  27. <!-- 视频列表区域 -->
  28. <div class="video-content">
  29. <div class="title">视频排名</div>
  30. <div class="video-list">
  31. <div
  32. class="video"
  33. v-for="(item, index) in list"
  34. :key="index"
  35. @click="onPlay(item)"
  36. >
  37. <div class="cover">
  38. <img :src="item.cover" alt="" />
  39. <div class="name">{{ item.title }}</div>
  40. <div class="rank" :class="'rank-0' + (index + 1)">
  41. {{ index + 1 }}
  42. </div>
  43. <div class="play" @click="onPlay(item)"></div>
  44. </div>
  45. <div class="info">
  46. <div class="club-name">{{ item.authParty }}</div>
  47. <div class="mobile">{{ item.userName | mobileFormat }}</div>
  48. </div>
  49. <div class="foot">
  50. <div class="date">{{ item.releaseTime | dateFormat }}</div>
  51. <div class="praise">{{ item.diggCount }}</div>
  52. <div class="pv">{{ item.playCount }}</div>
  53. </div>
  54. </div>
  55. </div>
  56. <!-- 列表为空 -->
  57. <SimpleEmpty
  58. v-if="!total && !isRequest"
  59. name="icon-empty-video.png"
  60. description="暂无视频~"
  61. ></SimpleEmpty>
  62. </div>
  63. </div>
  64. </van-list>
  65. <div class="publish" @click="onPublish">发布视频</div>
  66. <!-- 发布提示对话框 -->
  67. <SimpleDialog
  68. v-model="dialog"
  69. :confirmText="dialogOption.confirmText"
  70. :description="dialogOption.description"
  71. :cancel="dialogOption.cancel"
  72. @confirm="onConfirm"
  73. @cancel="onCancel"
  74. ></SimpleDialog>
  75. <!-- 视频播放组件 -->
  76. <SimpleVideoPlayer
  77. :videoSrc="videoUrl"
  78. :description="description"
  79. ref="videoPlayer"
  80. ></SimpleVideoPlayer>
  81. </div>
  82. </template>
  83. <script>
  84. import { mapGetters } from 'vuex'
  85. import { debounce } from '~/utils'
  86. export default {
  87. layout: 'app-asbl',
  88. filters: {
  89. mobileFormat(mobile) {
  90. return mobile ? mobile.replace(/^(\w{3})\w+(\w{4})$/, '$1****$2') : ''
  91. },
  92. },
  93. data() {
  94. return {
  95. isRequest: true,
  96. finished: true, // 列表加载是否完毕(加载完了所有数据)
  97. loadingMore: false, // 是否正在加载
  98. listQuery: {
  99. clubUserName: '',
  100. pageNum: 1,
  101. pageSize: 20,
  102. status: 1,
  103. },
  104. list: [],
  105. total: 0,
  106. dialog: false,
  107. dialogOption: {
  108. confirmText: '确定',
  109. description: '抱歉,活动已结束,暂无法发布视频!',
  110. cancel: false,
  111. },
  112. publishInfo: {},
  113. videoUrl: '',
  114. description: '',
  115. }
  116. },
  117. computed: {
  118. ...mapGetters(['routePrefix', 'accessToken', 'userInfo', 'authUserId']),
  119. },
  120. created() {
  121. this.getList()
  122. },
  123. beforeDestroy() {
  124. this.$toast.clear()
  125. },
  126. methods: {
  127. // 获取列表
  128. getList() {
  129. this.$toast.loading({
  130. message: '正在获取视频列表...',
  131. duration: 0,
  132. })
  133. this.listQuery.pageNum = 1
  134. this.isRequest = true
  135. this.list = []
  136. this.fetchVideoList()
  137. },
  138. // 获取视频列表
  139. fetchVideoList: debounce(async function () {
  140. try {
  141. this.loadingMore = true
  142. this.isRequest = true
  143. this.listQuery.authUserId = this.authUserId
  144. const res = await this.$http.api.fetchVideoList(this.listQuery)
  145. this.list = [...this.list, ...res.data.list]
  146. this.total = res.data.total
  147. this.listQuery.pageNum++
  148. this.finished = !res.data.hasNextPage
  149. this.loadingMore = false
  150. this.isRequest = false
  151. } catch (error) {
  152. console.log(error)
  153. } finally {
  154. this.$toast.clear()
  155. }
  156. }, 500),
  157. // 提示框确定
  158. onConfirm() {
  159. this.dialog = false
  160. if (this.dialogOption.confirmText === '去认证') {
  161. const path = `${this.routePrefix}/form/club-register`
  162. this.$router.push(path)
  163. }
  164. },
  165. // 提示框取消
  166. onCancel() {
  167. this.dialog = false
  168. },
  169. // 去发布视频
  170. async onPublish() {
  171. if (!this.accessToken) {
  172. this.$toast('请先登录')
  173. this.formType = 'login'
  174. this.$store.commit('app/SHOW_LOGIN')
  175. return
  176. }
  177. if (!this.userInfo.authId) {
  178. this.dialogOption.description = '抱歉,由于您未认证机构,无法参与!'
  179. this.dialogOption.confirmText = '去认证'
  180. this.dialog = true
  181. return
  182. }
  183. // 查询活动状态
  184. await this.checkActivityPublish()
  185. if (this.publishInfo.activityState === 0) {
  186. this.dialogOption.description = '抱歉,活动未开始!'
  187. this.dialog = true
  188. return
  189. } else if (this.publishInfo.activityState === 2) {
  190. this.dialogOption.description = '抱歉,活动已结束,暂无法发布视频!'
  191. this.dialog = true
  192. return
  193. } else if (this.publishInfo.releaseStatus === 1) {
  194. this.dialogOption.description =
  195. '抱歉,平台规定每个用户只能发布一个视频,由于您已发布过视频,请勿再次发布!'
  196. this.dialog = true
  197. return
  198. }
  199. const url = `${this.routePrefix}/activity/challenge/publish`
  200. this.$router.push(url)
  201. },
  202. // 验证发布状态
  203. async checkActivityPublish() {
  204. if (!this.accessToken) return
  205. const { authId, mobile } = this.userInfo
  206. try {
  207. const res = await this.$http.api.checkActivityPublish({
  208. authUserId: this.authUserId,
  209. authId,
  210. userName: mobile,
  211. })
  212. this.publishInfo = res.data
  213. } catch (error) {
  214. console.log(error)
  215. }
  216. },
  217. // 播放视频
  218. onPlay(row) {
  219. this.videoUrl = row.ossUrl
  220. this.description = row.title
  221. this.$refs.videoPlayer.open()
  222. },
  223. },
  224. }
  225. </script>
  226. <style lang="scss" scoped>
  227. ::v-deep {
  228. .el-input.is-active .el-input__inner,
  229. .el-input__inner:focus {
  230. border-color: #f3920d;
  231. }
  232. }
  233. @media screen and (min-width: 768px) {
  234. .page {
  235. background: #fff;
  236. min-height: calc(100vh - 80px - 80px);
  237. padding-bottom: 20px;
  238. .page-top {
  239. width: 100%;
  240. height: 530px;
  241. background: url(~assets/theme-images/ross/pc-banner-activity.png)
  242. no-repeat center;
  243. background-size: auto 530px;
  244. }
  245. .publish {
  246. display: none;
  247. }
  248. .page-content {
  249. width: 1200px;
  250. margin: 0 auto;
  251. .control {
  252. display: flex;
  253. align-items: center;
  254. padding: 32px 0;
  255. .publish {
  256. display: block;
  257. width: 120px;
  258. height: 46px;
  259. text-align: center;
  260. line-height: 46px;
  261. background: #f3920d;
  262. color: #fff;
  263. font-size: 16px;
  264. border-radius: 4px;
  265. cursor: pointer;
  266. transition: all 0.2s;
  267. margin-left: 48px;
  268. &:hover {
  269. background: #e98d0d;
  270. }
  271. }
  272. .search {
  273. flex: 1;
  274. flex-shrink: 0;
  275. .el-input {
  276. height: 46px;
  277. font-size: 16px;
  278. .el-input__icon {
  279. font-size: 24px;
  280. line-height: 46px;
  281. margin-left: 12px;
  282. }
  283. ::v-deep {
  284. & > .el-input__inner {
  285. height: 46px;
  286. padding-left: 55px;
  287. }
  288. }
  289. }
  290. }
  291. }
  292. .video-content {
  293. .title {
  294. font-size: 16px;
  295. color: #282828;
  296. font-weight: bold;
  297. margin: 16px 0;
  298. }
  299. .video-list {
  300. &::after {
  301. content: '';
  302. display: block;
  303. clear: both;
  304. }
  305. .video {
  306. float: left;
  307. width: 288px;
  308. height: 356px;
  309. background: #fff;
  310. box-sizing: border-box;
  311. border: 1px solid #efefef;
  312. margin: 0 16px 16px 0;
  313. transition: all 0.4s;
  314. &:hover {
  315. transform: translateY(-10px);
  316. box-shadow: 0px 6px 16px 1px rgba(0, 0, 0, 0.1);
  317. .info {
  318. .club-name {
  319. color: #f3920d;
  320. }
  321. }
  322. }
  323. &:nth-child(4n) {
  324. margin-right: 0;
  325. }
  326. .cover {
  327. width: 100%;
  328. height: 198px;
  329. position: relative;
  330. img {
  331. display: block;
  332. width: 100%;
  333. height: 100%;
  334. }
  335. &::after {
  336. content: '';
  337. display: block;
  338. position: absolute;
  339. left: 0;
  340. top: 0;
  341. z-index: 1;
  342. width: 100%;
  343. height: 100%;
  344. background: #000;
  345. opacity: 0;
  346. transition: opacity 0.2s;
  347. }
  348. .play {
  349. position: absolute;
  350. z-index: 2;
  351. width: 48px;
  352. height: 48px;
  353. background: url(~assets/theme-images/common/pc-icon-play.png)
  354. no-repeat center;
  355. background-size: 48px;
  356. left: 50%;
  357. top: 50%;
  358. transform: translate(-50%, -50%);
  359. opacity: 0;
  360. transition: opacity 0.2s;
  361. cursor: pointer;
  362. }
  363. &:hover {
  364. .play {
  365. opacity: 1;
  366. }
  367. .rank,
  368. .name {
  369. opacity: 0;
  370. }
  371. &::after {
  372. opacity: 0.4;
  373. }
  374. }
  375. .name {
  376. color: #fff;
  377. font-size: 16px;
  378. text-align: center;
  379. width: 100%;
  380. line-height: 40px;
  381. @include ellipsis(1);
  382. box-sizing: border-box;
  383. padding: 0 16px;
  384. position: absolute;
  385. left: 0;
  386. bottom: 0;
  387. background: rgba(0, 0, 0, 0.5);
  388. transition: opacity 0.2s;
  389. }
  390. .rank {
  391. position: absolute;
  392. left: 10px;
  393. top: 0;
  394. width: 43px;
  395. height: 45px;
  396. background: url(~assets/theme-images/ross/pc-rank.png) no-repeat
  397. center;
  398. background-size: 43px;
  399. text-align: center;
  400. box-sizing: border-box;
  401. padding-top: 13px;
  402. font-weight: bold;
  403. color: #fff;
  404. font-size: 13px;
  405. transition: opacity 0.2s;
  406. &.rank-01 {
  407. background-image: url(~assets/theme-images/ross/pc-rank-01.png);
  408. }
  409. &.rank-02 {
  410. background-image: url(~assets/theme-images/ross/pc-rank-02.png);
  411. }
  412. &.rank-03 {
  413. background-image: url(~assets/theme-images/ross/pc-rank-03.png);
  414. }
  415. }
  416. }
  417. .info {
  418. padding: 24px 16px;
  419. .club-name {
  420. font-size: 18px;
  421. color: #282828;
  422. @include ellipsis(1);
  423. }
  424. .mobile {
  425. font-size: 16px;
  426. color: #666;
  427. margin-top: 12px;
  428. }
  429. }
  430. .foot {
  431. color: #999999;
  432. font-size: 14px;
  433. display: flex;
  434. justify-content: space-between;
  435. align-items: center;
  436. margin: 0 16px;
  437. border-top: 1px solid #efefef;
  438. padding-top: 12px;
  439. .date,
  440. .praise,
  441. .pv {
  442. flex-shrink: 0;
  443. line-height: 24px;
  444. }
  445. .praise,
  446. .pv {
  447. position: relative;
  448. margin-left: 16px;
  449. padding-left: 30px;
  450. &::after {
  451. content: '';
  452. display: block;
  453. width: 24px;
  454. height: 24px;
  455. background: url(~assets/theme-images/common/icon-praise.png)
  456. no-repeat center;
  457. background-size: 24px;
  458. position: absolute;
  459. left: 0;
  460. top: 50%;
  461. transform: translateY(-50%);
  462. }
  463. }
  464. .pv {
  465. &::after {
  466. background-image: url(~assets/theme-images/common/icon-pv.png);
  467. }
  468. }
  469. .date {
  470. margin-right: 44px;
  471. }
  472. }
  473. }
  474. }
  475. }
  476. }
  477. }
  478. }
  479. @media screen and (max-width: 768px) {
  480. .page {
  481. background: #fff;
  482. position: relative;
  483. position: relative;
  484. // padding-bottom: 20vw;
  485. .page-top {
  486. width: 100%;
  487. height: 100vw;
  488. background: url(~assets/theme-images/ross/h5-banner-activity.png)
  489. no-repeat center;
  490. background-size: auto 100vw;
  491. }
  492. .publish {
  493. // position: fixed;
  494. // bottom: 14vw;
  495. // left: 7.4vw;
  496. width: 85.6vw;
  497. margin: 4vw auto;
  498. height: 12vw;
  499. background: #f3920d;
  500. color: #fff;
  501. text-align: center;
  502. font-size: 3.6vw;
  503. line-height: 12vw;
  504. }
  505. .page-content {
  506. position: relative;
  507. width: 93.6vw;
  508. margin: 0 auto;
  509. .control {
  510. display: flex;
  511. align-items: center;
  512. padding: 6.4vw 0 7.2vw;
  513. .publish {
  514. display: none;
  515. }
  516. .search {
  517. flex: 1;
  518. flex-shrink: 0;
  519. .el-input {
  520. height: 9.6vw;
  521. font-size: 3.4vw;
  522. .el-input__icon {
  523. font-size: 5.6vw;
  524. line-height: 9.6vw;
  525. margin-left: 12px;
  526. }
  527. ::v-deep {
  528. & > .el-input__inner {
  529. height: 9.6vw;
  530. padding-left: 55px;
  531. }
  532. }
  533. }
  534. }
  535. }
  536. .video-content {
  537. .title {
  538. font-size: 3.4vw;
  539. color: #282828;
  540. font-weight: bold;
  541. margin: 0 0 4vw;
  542. }
  543. .video-list {
  544. &::after {
  545. content: '';
  546. display: block;
  547. clear: both;
  548. }
  549. .video {
  550. float: left;
  551. width: 45.6vw;
  552. height: 56.4vw;
  553. background: #fff;
  554. box-sizing: border-box;
  555. border: 0.1vw solid #efefef;
  556. margin: 0 2.4vw 2.4vw 0;
  557. transition: all 0.4s;
  558. &:nth-child(2n) {
  559. margin-right: 0;
  560. }
  561. .cover {
  562. width: 100%;
  563. height: 31.3vw;
  564. position: relative;
  565. img {
  566. display: block;
  567. width: 100%;
  568. height: 31.3vw;
  569. }
  570. &::after {
  571. content: '';
  572. display: block;
  573. position: absolute;
  574. left: 0;
  575. top: 0;
  576. z-index: 1;
  577. width: 100%;
  578. height: 100%;
  579. background: #000;
  580. opacity: 0;
  581. transition: opacity 0.2s;
  582. }
  583. .play {
  584. position: absolute;
  585. z-index: 2;
  586. width: 48px;
  587. height: 48px;
  588. background: url(~assets/theme-images/common/pc-icon-play.png)
  589. no-repeat center;
  590. background-size: 48px;
  591. left: 50%;
  592. top: 50%;
  593. transform: translate(-50%, -50%);
  594. opacity: 0;
  595. transition: opacity 0.2s;
  596. cursor: pointer;
  597. }
  598. .name {
  599. color: #fff;
  600. font-size: 3vw;
  601. text-align: center;
  602. width: 100%;
  603. line-height: 6.4vw;
  604. height: 6.4vw;
  605. @include ellipsis(1);
  606. box-sizing: border-box;
  607. padding: 0 1.2vw;
  608. position: absolute;
  609. left: 0;
  610. bottom: 0;
  611. background: rgba(0, 0, 0, 0.5);
  612. }
  613. .rank {
  614. position: absolute;
  615. left: 2.4vw;
  616. top: 0;
  617. width: 7.2vw;
  618. height: 7.5vw;
  619. background: url(~assets/theme-images/ross/h5-rank.png) no-repeat
  620. center;
  621. background-size: 7.2vw;
  622. text-align: center;
  623. box-sizing: border-box;
  624. padding-top: 1.9vw;
  625. font-weight: bold;
  626. color: #fff;
  627. font-size: 2.1vw;
  628. &.rank-01 {
  629. background-image: url(~assets/theme-images/ross/h5-rank-01.png);
  630. }
  631. &.rank-02 {
  632. background-image: url(~assets/theme-images/ross/h5-rank-02.png);
  633. }
  634. &.rank-03 {
  635. background-image: url(~assets/theme-images/ross/h5-rank-03.png);
  636. }
  637. }
  638. }
  639. .info {
  640. padding: 2.4vw;
  641. .club-name {
  642. font-size: 3.4vw;
  643. color: #282828;
  644. @include ellipsis(1);
  645. }
  646. .mobile {
  647. font-size: 3vw;
  648. color: #666;
  649. margin-top: 1.6vw;
  650. }
  651. }
  652. .foot {
  653. color: #999999;
  654. font-size: 2.6vw;
  655. display: flex;
  656. justify-content: space-between;
  657. align-items: center;
  658. margin: 0 2.4vw;
  659. border-top: 0.1vw solid #efefef;
  660. padding-top: 2.3vw;
  661. .date,
  662. .praise,
  663. .pv {
  664. flex-shrink: 0;
  665. line-height: 3.6vw;
  666. }
  667. .praise,
  668. .pv {
  669. position: relative;
  670. padding-left: 4.4vw;
  671. &::after {
  672. content: '';
  673. display: block;
  674. width: 3.6vw;
  675. height: 3.6vw;
  676. background: url(~assets/theme-images/common/icon-praise.png)
  677. no-repeat center;
  678. background-size: 3.6vw;
  679. position: absolute;
  680. left: 0;
  681. top: 50%;
  682. transform: translateY(-50%);
  683. }
  684. }
  685. .pv {
  686. &::after {
  687. background-image: url(~assets/theme-images/common/icon-pv.png);
  688. }
  689. }
  690. .date {
  691. margin-right: 5.5vw;
  692. }
  693. }
  694. }
  695. }
  696. }
  697. }
  698. }
  699. }
  700. </style>