list.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776
  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.diggCount }}</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-ross',
  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. @mixin ellipsis($line: 1) {
  228. overflow: hidden;
  229. text-overflow: ellipsis;
  230. display: -webkit-box;
  231. -webkit-line-clamp: $line;
  232. -webkit-box-orient: vertical;
  233. }
  234. ::v-deep {
  235. .el-input.is-active .el-input__inner,
  236. .el-input__inner:focus {
  237. border-color: #f3920d;
  238. }
  239. }
  240. @media screen and (min-width: 768px) {
  241. .page {
  242. background: #fff;
  243. min-height: calc(100vh - 80px - 80px);
  244. padding-bottom: 20px;
  245. .page-top {
  246. width: 100%;
  247. height: 530px;
  248. background: url(~assets/theme-images/ross/pc-banner-activity.png)
  249. no-repeat center;
  250. background-size: auto 530px;
  251. }
  252. .publish {
  253. display: none;
  254. }
  255. .page-content {
  256. width: 1200px;
  257. margin: 0 auto;
  258. .control {
  259. display: flex;
  260. align-items: center;
  261. padding: 32px 0;
  262. .publish {
  263. display: block;
  264. width: 120px;
  265. height: 46px;
  266. text-align: center;
  267. line-height: 46px;
  268. background: #f3920d;
  269. color: #fff;
  270. font-size: 16px;
  271. border-radius: 4px;
  272. cursor: pointer;
  273. transition: all 0.2s;
  274. margin-left: 48px;
  275. &:hover {
  276. background: #e98d0d;
  277. }
  278. }
  279. .search {
  280. flex: 1;
  281. flex-shrink: 0;
  282. .el-input {
  283. height: 46px;
  284. font-size: 16px;
  285. .el-input__icon {
  286. font-size: 24px;
  287. line-height: 46px;
  288. margin-left: 12px;
  289. }
  290. ::v-deep {
  291. & > .el-input__inner {
  292. height: 46px;
  293. padding-left: 55px;
  294. }
  295. }
  296. }
  297. }
  298. }
  299. .video-content {
  300. .title {
  301. font-size: 16px;
  302. color: #282828;
  303. font-weight: bold;
  304. margin: 16px 0;
  305. }
  306. .video-list {
  307. &::after {
  308. content: '';
  309. display: block;
  310. clear: both;
  311. }
  312. .video {
  313. float: left;
  314. width: 288px;
  315. height: 356px;
  316. background: #fff;
  317. box-sizing: border-box;
  318. border: 1px solid #efefef;
  319. margin: 0 16px 16px 0;
  320. transition: all 0.4s;
  321. &:hover {
  322. transform: translateY(-10px);
  323. box-shadow: 0px 6px 16px 1px rgba(0, 0, 0, 0.1);
  324. .info {
  325. .club-name {
  326. color: #f3920d;
  327. }
  328. }
  329. }
  330. &:nth-child(4n) {
  331. margin-right: 0;
  332. }
  333. .cover {
  334. width: 100%;
  335. height: 198px;
  336. position: relative;
  337. img {
  338. display: block;
  339. width: 100%;
  340. height: 100%;
  341. }
  342. &::after {
  343. content: '';
  344. display: block;
  345. position: absolute;
  346. left: 0;
  347. top: 0;
  348. z-index: 1;
  349. width: 100%;
  350. height: 100%;
  351. background: #000;
  352. opacity: 0;
  353. transition: opacity 0.2s;
  354. }
  355. .play {
  356. position: absolute;
  357. z-index: 2;
  358. width: 48px;
  359. height: 48px;
  360. background: url(~assets/theme-images/common/pc-icon-play.png)
  361. no-repeat center;
  362. background-size: 48px;
  363. left: 50%;
  364. top: 50%;
  365. transform: translate(-50%, -50%);
  366. opacity: 0;
  367. transition: opacity 0.2s;
  368. cursor: pointer;
  369. }
  370. &:hover {
  371. .play {
  372. opacity: 1;
  373. }
  374. .rank,
  375. .name {
  376. opacity: 0;
  377. }
  378. &::after {
  379. opacity: 0.4;
  380. }
  381. }
  382. .name {
  383. color: #fff;
  384. font-size: 16px;
  385. text-align: center;
  386. width: 100%;
  387. line-height: 40px;
  388. @include ellipsis(1);
  389. box-sizing: border-box;
  390. padding: 0 16px;
  391. position: absolute;
  392. left: 0;
  393. bottom: 0;
  394. background: rgba(0, 0, 0, 0.5);
  395. transition: opacity 0.2s;
  396. }
  397. .rank {
  398. position: absolute;
  399. left: 10px;
  400. top: 0;
  401. width: 43px;
  402. height: 45px;
  403. background: url(~assets/theme-images/ross/pc-rank.png) no-repeat
  404. center;
  405. background-size: 43px;
  406. text-align: center;
  407. box-sizing: border-box;
  408. padding-top: 13px;
  409. font-weight: bold;
  410. color: #fff;
  411. font-size: 13px;
  412. transition: opacity 0.2s;
  413. &.rank-01 {
  414. background-image: url(~assets/theme-images/ross/pc-rank-01.png);
  415. }
  416. &.rank-02 {
  417. background-image: url(~assets/theme-images/ross/pc-rank-02.png);
  418. }
  419. &.rank-03 {
  420. background-image: url(~assets/theme-images/ross/pc-rank-03.png);
  421. }
  422. }
  423. }
  424. .info {
  425. padding: 24px 16px;
  426. .club-name {
  427. font-size: 18px;
  428. color: #282828;
  429. @include ellipsis(1);
  430. }
  431. .mobile {
  432. font-size: 16px;
  433. color: #666;
  434. margin-top: 12px;
  435. }
  436. }
  437. .foot {
  438. color: #999999;
  439. font-size: 14px;
  440. display: flex;
  441. justify-content: space-between;
  442. align-items: center;
  443. margin: 0 16px;
  444. border-top: 1px solid #efefef;
  445. padding-top: 12px;
  446. .date,
  447. .praise,
  448. .pv {
  449. flex-shrink: 0;
  450. line-height: 24px;
  451. }
  452. .praise,
  453. .pv {
  454. position: relative;
  455. margin-left: 16px;
  456. padding-left: 30px;
  457. &::after {
  458. content: '';
  459. display: block;
  460. width: 24px;
  461. height: 24px;
  462. background: url(~assets/theme-images/common/icon-praise.png)
  463. no-repeat center;
  464. background-size: 24px;
  465. position: absolute;
  466. left: 0;
  467. top: 50%;
  468. transform: translateY(-50%);
  469. }
  470. }
  471. .pv {
  472. &::after {
  473. background-image: url(~assets/theme-images/common/icon-pv.png);
  474. }
  475. }
  476. .date {
  477. margin-right: 44px;
  478. }
  479. }
  480. }
  481. }
  482. }
  483. }
  484. }
  485. }
  486. @media screen and (max-width: 768px) {
  487. .page {
  488. background: #fff;
  489. position: relative;
  490. position: relative;
  491. // padding-bottom: 20vw;
  492. .page-top {
  493. width: 100%;
  494. height: 100vw;
  495. background: url(~assets/theme-images/ross/h5-banner-activity.png)
  496. no-repeat center;
  497. background-size: auto 100vw;
  498. }
  499. .publish {
  500. // position: fixed;
  501. // bottom: 14vw;
  502. // left: 7.4vw;
  503. width: 85.6vw;
  504. margin: 4vw auto;
  505. height: 12vw;
  506. background: #f3920d;
  507. color: #fff;
  508. text-align: center;
  509. font-size: 3.6vw;
  510. line-height: 12vw;
  511. }
  512. .page-content {
  513. position: relative;
  514. width: 93.6vw;
  515. margin: 0 auto;
  516. .control {
  517. display: flex;
  518. align-items: center;
  519. padding: 6.4vw 0 7.2vw;
  520. .publish {
  521. display: none;
  522. }
  523. .search {
  524. flex: 1;
  525. flex-shrink: 0;
  526. .el-input {
  527. height: 9.6vw;
  528. font-size: 3.4vw;
  529. .el-input__icon {
  530. font-size: 5.6vw;
  531. line-height: 9.6vw;
  532. margin-left: 12px;
  533. }
  534. ::v-deep {
  535. & > .el-input__inner {
  536. height: 9.6vw;
  537. padding-left: 55px;
  538. }
  539. }
  540. }
  541. }
  542. }
  543. .video-content {
  544. .title {
  545. font-size: 3.4vw;
  546. color: #282828;
  547. font-weight: bold;
  548. margin: 0 0 4vw;
  549. }
  550. .video-list {
  551. &::after {
  552. content: '';
  553. display: block;
  554. clear: both;
  555. }
  556. .video {
  557. float: left;
  558. width: 45.6vw;
  559. height: 56.4vw;
  560. background: #fff;
  561. box-sizing: border-box;
  562. border: 0.1vw solid #efefef;
  563. margin: 0 2.4vw 2.4vw 0;
  564. transition: all 0.4s;
  565. &:nth-child(2n) {
  566. margin-right: 0;
  567. }
  568. .cover {
  569. width: 100%;
  570. height: 31.3vw;
  571. position: relative;
  572. img {
  573. display: block;
  574. width: 100%;
  575. height: 31.3vw;
  576. }
  577. &::after {
  578. content: '';
  579. display: block;
  580. position: absolute;
  581. left: 0;
  582. top: 0;
  583. z-index: 1;
  584. width: 100%;
  585. height: 100%;
  586. background: #000;
  587. opacity: 0;
  588. transition: opacity 0.2s;
  589. }
  590. .play {
  591. position: absolute;
  592. z-index: 2;
  593. width: 48px;
  594. height: 48px;
  595. background: url(~assets/theme-images/common/pc-icon-play.png)
  596. no-repeat center;
  597. background-size: 48px;
  598. left: 50%;
  599. top: 50%;
  600. transform: translate(-50%, -50%);
  601. opacity: 0;
  602. transition: opacity 0.2s;
  603. cursor: pointer;
  604. }
  605. .name {
  606. color: #fff;
  607. font-size: 3vw;
  608. text-align: center;
  609. width: 100%;
  610. line-height: 6.4vw;
  611. height: 6.4vw;
  612. @include ellipsis(1);
  613. box-sizing: border-box;
  614. padding: 0 1.2vw;
  615. position: absolute;
  616. left: 0;
  617. bottom: 0;
  618. background: rgba(0, 0, 0, 0.5);
  619. }
  620. .rank {
  621. position: absolute;
  622. left: 2.4vw;
  623. top: 0;
  624. width: 7.2vw;
  625. height: 7.5vw;
  626. background: url(~assets/theme-images/ross/h5-rank.png) no-repeat
  627. center;
  628. background-size: 7.2vw;
  629. text-align: center;
  630. box-sizing: border-box;
  631. padding-top: 1.9vw;
  632. font-weight: bold;
  633. color: #fff;
  634. font-size: 2.1vw;
  635. &.rank-01 {
  636. background-image: url(~assets/theme-images/ross/h5-rank-01.png);
  637. }
  638. &.rank-02 {
  639. background-image: url(~assets/theme-images/ross/h5-rank-02.png);
  640. }
  641. &.rank-03 {
  642. background-image: url(~assets/theme-images/ross/h5-rank-03.png);
  643. }
  644. }
  645. }
  646. .info {
  647. padding: 2.4vw;
  648. .club-name {
  649. font-size: 3.4vw;
  650. color: #282828;
  651. @include ellipsis(1);
  652. }
  653. .mobile {
  654. font-size: 3vw;
  655. color: #666;
  656. margin-top: 1.6vw;
  657. }
  658. }
  659. .foot {
  660. color: #999999;
  661. font-size: 2.6vw;
  662. display: flex;
  663. justify-content: space-between;
  664. align-items: center;
  665. margin: 0 2.4vw;
  666. border-top: 0.1vw solid #efefef;
  667. padding-top: 2.3vw;
  668. .date,
  669. .praise,
  670. .pv {
  671. flex-shrink: 0;
  672. line-height: 3.6vw;
  673. }
  674. .praise,
  675. .pv {
  676. position: relative;
  677. padding-left: 4.4vw;
  678. &::after {
  679. content: '';
  680. display: block;
  681. width: 3.6vw;
  682. height: 3.6vw;
  683. background: url(~assets/theme-images/common/icon-praise.png)
  684. no-repeat center;
  685. background-size: 3.6vw;
  686. position: absolute;
  687. left: 0;
  688. top: 50%;
  689. transform: translateY(-50%);
  690. }
  691. }
  692. .pv {
  693. &::after {
  694. background-image: url(~assets/theme-images/common/icon-pv.png);
  695. }
  696. }
  697. .date {
  698. margin-right: 5.5vw;
  699. }
  700. }
  701. }
  702. }
  703. }
  704. }
  705. }
  706. }
  707. </style>