123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776 |
- <template>
- <div class="page">
- <van-list
- v-model="loadingMore"
- :finished="finished"
- :immediate-check="false"
- :finished-text="total ? '没有更多了' : ''"
- @load="fetchVideoList"
- >
- <div class="page-top"></div>
- <div class="page-content">
- <!-- 操作区域 -->
- <div class="control">
- <div class="search">
- <el-input
- placeholder="搜索登录账户后四位或所属机构"
- @keyup.enter.native="getList"
- v-model="listQuery.clubUserName"
- clearable
- @clear="getList"
- >
- <i slot="prefix" class="el-input__icon el-icon-search"></i>
- </el-input>
- </div>
- <div class="publish" @click="onPublish">发布视频</div>
- </div>
- <!-- 视频列表区域 -->
- <div class="video-content">
- <div class="title">视频排名</div>
- <div class="video-list">
- <div
- class="video"
- v-for="(item, index) in list"
- :key="index"
- @click="onPlay(item)"
- >
- <div class="cover">
- <img :src="item.cover" alt="" />
- <div class="name">{{ item.title }}</div>
- <div class="rank" :class="'rank-0' + (index + 1)">
- {{ index + 1 }}
- </div>
- <div class="play" @click="onPlay(item)"></div>
- </div>
- <div class="info">
- <div class="club-name">{{ item.authParty }}</div>
- <div class="mobile">{{ item.userName | mobileFormat }}</div>
- </div>
- <div class="foot">
- <div class="date">{{ item.releaseTime | dateFormat }}</div>
- <div class="praise">{{ item.diggCount }}</div>
- <div class="pv">{{ item.diggCount }}</div>
- </div>
- </div>
- </div>
- <!-- 列表为空 -->
- <SimpleEmpty
- v-if="!total && !isRequest"
- name="icon-empty-video.png"
- description="暂无视频~"
- ></SimpleEmpty>
- </div>
- </div>
- </van-list>
- <div class="publish" @click="onPublish">发布视频</div>
- <!-- 发布提示对话框 -->
- <SimpleDialog
- v-model="dialog"
- :confirmText="dialogOption.confirmText"
- :description="dialogOption.description"
- :cancel="dialogOption.cancel"
- @confirm="onConfirm"
- @cancel="onCancel"
- ></SimpleDialog>
- <!-- 视频播放组件 -->
- <SimpleVideoPlayer
- :videoSrc="videoUrl"
- :description="description"
- ref="videoPlayer"
- ></SimpleVideoPlayer>
- </div>
- </template>
- <script>
- import { mapGetters } from 'vuex'
- import { debounce } from '~/utils'
- export default {
- layout: 'app-ross',
- filters: {
- mobileFormat(mobile) {
- return mobile ? mobile.replace(/^(\w{3})\w+(\w{4})$/, '$1****$2') : ''
- },
- },
- data() {
- return {
- isRequest: true,
- finished: true, // 列表加载是否完毕(加载完了所有数据)
- loadingMore: false, // 是否正在加载
- listQuery: {
- clubUserName: '',
- pageNum: 1,
- pageSize: 20,
- status: 1,
- },
- list: [],
- total: 0,
- dialog: false,
- dialogOption: {
- confirmText: '确定',
- description: '抱歉,活动已结束,暂无法发布视频!',
- cancel: false,
- },
- publishInfo: {},
- videoUrl: '',
- description: '',
- }
- },
- computed: {
- ...mapGetters(['routePrefix', 'accessToken', 'userInfo', 'authUserId']),
- },
- created() {
- this.getList()
- },
- beforeDestroy() {
- this.$toast.clear()
- },
- methods: {
- // 获取列表
- getList() {
- this.$toast.loading({
- message: '正在获取视频列表...',
- duration: 0,
- })
- this.listQuery.pageNum = 1
- this.isRequest = true
- this.list = []
- this.fetchVideoList()
- },
- // 获取视频列表
- fetchVideoList: debounce(async function () {
- try {
- this.loadingMore = true
- this.isRequest = true
- this.listQuery.authUserId = this.authUserId
- const res = await this.$http.api.fetchVideoList(this.listQuery)
- this.list = [...this.list, ...res.data.list]
- this.total = res.data.total
- this.listQuery.pageNum++
- this.finished = !res.data.hasNextPage
- this.loadingMore = false
- this.isRequest = false
- } catch (error) {
- console.log(error)
- } finally {
- this.$toast.clear()
- }
- }, 500),
- // 提示框确定
- onConfirm() {
- this.dialog = false
- if (this.dialogOption.confirmText === '去认证') {
- const path = `${this.routePrefix}/form/club-register`
- this.$router.push(path)
- }
- },
- // 提示框取消
- onCancel() {
- this.dialog = false
- },
- // 去发布视频
- async onPublish() {
- if (!this.accessToken) {
- this.$toast('请先登录')
- this.formType = 'login'
- this.$store.commit('app/SHOW_LOGIN')
- return
- }
- if (!this.userInfo.authId) {
- this.dialogOption.description = '抱歉,由于您未认证机构,无法参与!'
- this.dialogOption.confirmText = '去认证'
- this.dialog = true
- return
- }
- // 查询活动状态
- await this.checkActivityPublish()
- if (this.publishInfo.activityState === 0) {
- this.dialogOption.description = '抱歉,活动未开始!'
- this.dialog = true
- return
- } else if (this.publishInfo.activityState === 2) {
- this.dialogOption.description = '抱歉,活动已结束,暂无法发布视频!'
- this.dialog = true
- return
- } else if (this.publishInfo.releaseStatus === 1) {
- this.dialogOption.description =
- '抱歉,平台规定每个用户只能发布一个视频,由于您已发布过视频,请勿再次发布!'
- this.dialog = true
- return
- }
- const url = `${this.routePrefix}/activity/challenge/publish`
- this.$router.push(url)
- },
- // 验证发布状态
- async checkActivityPublish() {
- if (!this.accessToken) return
- const { authId, mobile } = this.userInfo
- try {
- const res = await this.$http.api.checkActivityPublish({
- authUserId: this.authUserId,
- authId,
- userName: mobile,
- })
- this.publishInfo = res.data
- } catch (error) {
- console.log(error)
- }
- },
- // 播放视频
- onPlay(row) {
- this.videoUrl = row.ossUrl
- this.description = row.title
- this.$refs.videoPlayer.open()
- },
- },
- }
- </script>
- <style lang="scss" scoped>
- @mixin ellipsis($line: 1) {
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: $line;
- -webkit-box-orient: vertical;
- }
- ::v-deep {
- .el-input.is-active .el-input__inner,
- .el-input__inner:focus {
- border-color: #f3920d;
- }
- }
- @media screen and (min-width: 768px) {
- .page {
- background: #fff;
- min-height: calc(100vh - 80px - 80px);
- padding-bottom: 20px;
- .page-top {
- width: 100%;
- height: 530px;
- background: url(~assets/theme-images/ross/pc-banner-activity.png)
- no-repeat center;
- background-size: auto 530px;
- }
- .publish {
- display: none;
- }
- .page-content {
- width: 1200px;
- margin: 0 auto;
- .control {
- display: flex;
- align-items: center;
- padding: 32px 0;
- .publish {
- display: block;
- width: 120px;
- height: 46px;
- text-align: center;
- line-height: 46px;
- background: #f3920d;
- color: #fff;
- font-size: 16px;
- border-radius: 4px;
- cursor: pointer;
- transition: all 0.2s;
- margin-left: 48px;
- &:hover {
- background: #e98d0d;
- }
- }
- .search {
- flex: 1;
- flex-shrink: 0;
- .el-input {
- height: 46px;
- font-size: 16px;
- .el-input__icon {
- font-size: 24px;
- line-height: 46px;
- margin-left: 12px;
- }
- ::v-deep {
- & > .el-input__inner {
- height: 46px;
- padding-left: 55px;
- }
- }
- }
- }
- }
- .video-content {
- .title {
- font-size: 16px;
- color: #282828;
- font-weight: bold;
- margin: 16px 0;
- }
- .video-list {
- &::after {
- content: '';
- display: block;
- clear: both;
- }
- .video {
- float: left;
- width: 288px;
- height: 356px;
- background: #fff;
- box-sizing: border-box;
- border: 1px solid #efefef;
- margin: 0 16px 16px 0;
- transition: all 0.4s;
- &:hover {
- transform: translateY(-10px);
- box-shadow: 0px 6px 16px 1px rgba(0, 0, 0, 0.1);
- .info {
- .club-name {
- color: #f3920d;
- }
- }
- }
- &:nth-child(4n) {
- margin-right: 0;
- }
- .cover {
- width: 100%;
- height: 198px;
- position: relative;
- img {
- display: block;
- width: 100%;
- height: 100%;
- }
- &::after {
- content: '';
- display: block;
- position: absolute;
- left: 0;
- top: 0;
- z-index: 1;
- width: 100%;
- height: 100%;
- background: #000;
- opacity: 0;
- transition: opacity 0.2s;
- }
- .play {
- position: absolute;
- z-index: 2;
- width: 48px;
- height: 48px;
- background: url(~assets/theme-images/common/pc-icon-play.png)
- no-repeat center;
- background-size: 48px;
- left: 50%;
- top: 50%;
- transform: translate(-50%, -50%);
- opacity: 0;
- transition: opacity 0.2s;
- cursor: pointer;
- }
- &:hover {
- .play {
- opacity: 1;
- }
- .rank,
- .name {
- opacity: 0;
- }
- &::after {
- opacity: 0.4;
- }
- }
- .name {
- color: #fff;
- font-size: 16px;
- text-align: center;
- width: 100%;
- line-height: 40px;
- @include ellipsis(1);
- box-sizing: border-box;
- padding: 0 16px;
- position: absolute;
- left: 0;
- bottom: 0;
- background: rgba(0, 0, 0, 0.5);
- transition: opacity 0.2s;
- }
- .rank {
- position: absolute;
- left: 10px;
- top: 0;
- width: 43px;
- height: 45px;
- background: url(~assets/theme-images/ross/pc-rank.png) no-repeat
- center;
- background-size: 43px;
- text-align: center;
- box-sizing: border-box;
- padding-top: 13px;
- font-weight: bold;
- color: #fff;
- font-size: 13px;
- transition: opacity 0.2s;
- &.rank-01 {
- background-image: url(~assets/theme-images/ross/pc-rank-01.png);
- }
- &.rank-02 {
- background-image: url(~assets/theme-images/ross/pc-rank-02.png);
- }
- &.rank-03 {
- background-image: url(~assets/theme-images/ross/pc-rank-03.png);
- }
- }
- }
- .info {
- padding: 24px 16px;
- .club-name {
- font-size: 18px;
- color: #282828;
- @include ellipsis(1);
- }
- .mobile {
- font-size: 16px;
- color: #666;
- margin-top: 12px;
- }
- }
- .foot {
- color: #999999;
- font-size: 14px;
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin: 0 16px;
- border-top: 1px solid #efefef;
- padding-top: 12px;
- .date,
- .praise,
- .pv {
- flex-shrink: 0;
- line-height: 24px;
- }
- .praise,
- .pv {
- position: relative;
- margin-left: 16px;
- padding-left: 30px;
- &::after {
- content: '';
- display: block;
- width: 24px;
- height: 24px;
- background: url(~assets/theme-images/common/icon-praise.png)
- no-repeat center;
- background-size: 24px;
- position: absolute;
- left: 0;
- top: 50%;
- transform: translateY(-50%);
- }
- }
- .pv {
- &::after {
- background-image: url(~assets/theme-images/common/icon-pv.png);
- }
- }
- .date {
- margin-right: 44px;
- }
- }
- }
- }
- }
- }
- }
- }
- @media screen and (max-width: 768px) {
- .page {
- background: #fff;
- position: relative;
- position: relative;
- // padding-bottom: 20vw;
- .page-top {
- width: 100%;
- height: 100vw;
- background: url(~assets/theme-images/ross/h5-banner-activity.png)
- no-repeat center;
- background-size: auto 100vw;
- }
- .publish {
- // position: fixed;
- // bottom: 14vw;
- // left: 7.4vw;
- width: 85.6vw;
- margin: 4vw auto;
- height: 12vw;
- background: #f3920d;
- color: #fff;
- text-align: center;
- font-size: 3.6vw;
- line-height: 12vw;
- }
- .page-content {
- position: relative;
- width: 93.6vw;
- margin: 0 auto;
- .control {
- display: flex;
- align-items: center;
- padding: 6.4vw 0 7.2vw;
- .publish {
- display: none;
- }
- .search {
- flex: 1;
- flex-shrink: 0;
- .el-input {
- height: 9.6vw;
- font-size: 3.4vw;
- .el-input__icon {
- font-size: 5.6vw;
- line-height: 9.6vw;
- margin-left: 12px;
- }
- ::v-deep {
- & > .el-input__inner {
- height: 9.6vw;
- padding-left: 55px;
- }
- }
- }
- }
- }
- .video-content {
- .title {
- font-size: 3.4vw;
- color: #282828;
- font-weight: bold;
- margin: 0 0 4vw;
- }
- .video-list {
- &::after {
- content: '';
- display: block;
- clear: both;
- }
- .video {
- float: left;
- width: 45.6vw;
- height: 56.4vw;
- background: #fff;
- box-sizing: border-box;
- border: 0.1vw solid #efefef;
- margin: 0 2.4vw 2.4vw 0;
- transition: all 0.4s;
- &:nth-child(2n) {
- margin-right: 0;
- }
- .cover {
- width: 100%;
- height: 31.3vw;
- position: relative;
- img {
- display: block;
- width: 100%;
- height: 31.3vw;
- }
- &::after {
- content: '';
- display: block;
- position: absolute;
- left: 0;
- top: 0;
- z-index: 1;
- width: 100%;
- height: 100%;
- background: #000;
- opacity: 0;
- transition: opacity 0.2s;
- }
- .play {
- position: absolute;
- z-index: 2;
- width: 48px;
- height: 48px;
- background: url(~assets/theme-images/common/pc-icon-play.png)
- no-repeat center;
- background-size: 48px;
- left: 50%;
- top: 50%;
- transform: translate(-50%, -50%);
- opacity: 0;
- transition: opacity 0.2s;
- cursor: pointer;
- }
- .name {
- color: #fff;
- font-size: 3vw;
- text-align: center;
- width: 100%;
- line-height: 6.4vw;
- height: 6.4vw;
- @include ellipsis(1);
- box-sizing: border-box;
- padding: 0 1.2vw;
- position: absolute;
- left: 0;
- bottom: 0;
- background: rgba(0, 0, 0, 0.5);
- }
- .rank {
- position: absolute;
- left: 2.4vw;
- top: 0;
- width: 7.2vw;
- height: 7.5vw;
- background: url(~assets/theme-images/ross/h5-rank.png) no-repeat
- center;
- background-size: 7.2vw;
- text-align: center;
- box-sizing: border-box;
- padding-top: 1.9vw;
- font-weight: bold;
- color: #fff;
- font-size: 2.1vw;
- &.rank-01 {
- background-image: url(~assets/theme-images/ross/h5-rank-01.png);
- }
- &.rank-02 {
- background-image: url(~assets/theme-images/ross/h5-rank-02.png);
- }
- &.rank-03 {
- background-image: url(~assets/theme-images/ross/h5-rank-03.png);
- }
- }
- }
- .info {
- padding: 2.4vw;
- .club-name {
- font-size: 3.4vw;
- color: #282828;
- @include ellipsis(1);
- }
- .mobile {
- font-size: 3vw;
- color: #666;
- margin-top: 1.6vw;
- }
- }
- .foot {
- color: #999999;
- font-size: 2.6vw;
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin: 0 2.4vw;
- border-top: 0.1vw solid #efefef;
- padding-top: 2.3vw;
- .date,
- .praise,
- .pv {
- flex-shrink: 0;
- line-height: 3.6vw;
- }
- .praise,
- .pv {
- position: relative;
- padding-left: 4.4vw;
- &::after {
- content: '';
- display: block;
- width: 3.6vw;
- height: 3.6vw;
- background: url(~assets/theme-images/common/icon-praise.png)
- no-repeat center;
- background-size: 3.6vw;
- position: absolute;
- left: 0;
- top: 50%;
- transform: translateY(-50%);
- }
- }
- .pv {
- &::after {
- background-image: url(~assets/theme-images/common/icon-pv.png);
- }
- }
- .date {
- margin-right: 5.5vw;
- }
- }
- }
- }
- }
- }
- }
- }
- </style>
|