list.vue 18 KB

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