|
@@ -0,0 +1,329 @@
|
|
|
+<script setup>
|
|
|
+import {ref,reactive,onMounted,onActivated} from 'vue'
|
|
|
+import { useElementSize } from '@vueuse/core'
|
|
|
+
|
|
|
+import {apiFICCPermissionList,apiGetWechatQRCode} from '@/api/common'
|
|
|
+import {apiVideoList} from '@/api/video'
|
|
|
+
|
|
|
+import SelfList from '@/components/SelfList.vue'
|
|
|
+
|
|
|
+
|
|
|
+//监听列表页面版心宽度
|
|
|
+const listPageEl=ref('')
|
|
|
+const {width}=useElementSize(listPageEl)
|
|
|
+
|
|
|
+// 获取品种权限数据
|
|
|
+let permissionState=reactive({
|
|
|
+ firstNavList:[],
|
|
|
+ sFirst:'',
|
|
|
+ secNavList:[],
|
|
|
+ sSecond:0//选择的品种id
|
|
|
+})
|
|
|
+const getFICCPermissionList=async ()=>{
|
|
|
+ const res=await apiFICCPermissionList()
|
|
|
+ if(res.code===200){
|
|
|
+ permissionState.firstNavList=res.data
|
|
|
+ handelChangeFirstNav(res.data[0])
|
|
|
+ }
|
|
|
+}
|
|
|
+getFICCPermissionList()
|
|
|
+
|
|
|
+//点击一级分类
|
|
|
+const handelChangeFirstNav=(item)=>{
|
|
|
+ permissionState.sFirst=item.ClassifyName
|
|
|
+ permissionState.secNavList=item.Items
|
|
|
+ handleChangeSecNav(item.Items[0])
|
|
|
+}
|
|
|
+
|
|
|
+//点击二级分类
|
|
|
+const handleChangeSecNav=(item)=>{
|
|
|
+ permissionState.sSecond=item.PermissionId
|
|
|
+ refreshList()
|
|
|
+}
|
|
|
+
|
|
|
+//获取视频列表数据
|
|
|
+let listState = reactive({
|
|
|
+ loading:false,
|
|
|
+ finished:false,
|
|
|
+ page:1,
|
|
|
+ list:[],
|
|
|
+})
|
|
|
+const getVideoList=async ()=>{
|
|
|
+ listState.loading=true
|
|
|
+ const res=await apiVideoList({
|
|
|
+ page_index:Number(listState.page),
|
|
|
+ page_size:20,
|
|
|
+ video_id:0,
|
|
|
+ chart_permission_id:Number(permissionState.sSecond)
|
|
|
+ })
|
|
|
+ listState.loading=false
|
|
|
+ if(res.code===200){
|
|
|
+ let arr=res.data||[]
|
|
|
+ listState.list=[...listState.list,...arr]
|
|
|
+ if(arr.length===0||arr.length<20){
|
|
|
+ listState.finished=true
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+getVideoList()
|
|
|
+
|
|
|
+//刷新列表
|
|
|
+const refreshList=()=>{
|
|
|
+ listState.finished=false
|
|
|
+ listState.page=1
|
|
|
+ listState.list=[]
|
|
|
+ curVideoId.value=0
|
|
|
+ getVideoList()
|
|
|
+}
|
|
|
+
|
|
|
+// 加载下一页
|
|
|
+const onLoad=()=>{
|
|
|
+ listState.page++
|
|
|
+ getVideoList()
|
|
|
+}
|
|
|
+
|
|
|
+//当前正在播放哪个
|
|
|
+let curVideoId=ref(0)
|
|
|
+const handelClickPlay=(item)=>{
|
|
|
+ curVideoId.value=item.community_video_id
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+//获取视频单个对应的小程序二维码
|
|
|
+const handelGetQRCodeImg=async (item)=>{
|
|
|
+ const res=await apiGetWechatQRCode({
|
|
|
+ CodeScene:JSON.stringify({videoId:item.community_video_id}),
|
|
|
+ CodePage:'pages/video/videoList'
|
|
|
+ })
|
|
|
+ if(res.code===200){
|
|
|
+ item.QRCodeImg=res.data
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ //向小程序发送消息
|
|
|
+ let postData = {
|
|
|
+ path: "/pages/video/videoList",
|
|
|
+ params:{},
|
|
|
+ title: "FICC视频社区",
|
|
|
+ shareImg:''
|
|
|
+ };
|
|
|
+ wx.miniProgram.postMessage({ data: postData });
|
|
|
+});
|
|
|
+
|
|
|
+onActivated(()=>{
|
|
|
+ //向小程序发送消息
|
|
|
+ let postData = {
|
|
|
+ path: "/pages/video/videoList",
|
|
|
+ params:{},
|
|
|
+ title: "FICC视频社区",
|
|
|
+ shareImg:''
|
|
|
+ };
|
|
|
+ wx.miniProgram.postMessage({ data: postData });
|
|
|
+})
|
|
|
+
|
|
|
+</script>
|
|
|
+
|
|
|
+<template>
|
|
|
+ <div class="video-list-page" ref="listPageEl">
|
|
|
+ <div class="top-nav-box" :style="{width:width+'px'}">
|
|
|
+ <div class="first-nav-box">
|
|
|
+ <span
|
|
|
+ v-for="item in permissionState.firstNavList"
|
|
|
+ :key="item.ClassifyName"
|
|
|
+ :class="item.ClassifyName==permissionState.sFirst?'active':''"
|
|
|
+ @click="handelChangeFirstNav(item)"
|
|
|
+ >{{item.ClassifyName}}</span>
|
|
|
+ </div>
|
|
|
+ <div class="sec-nav-box">
|
|
|
+ <span
|
|
|
+ :class="['sec-item',item.PermissionId==permissionState.sSecond?'active':'']"
|
|
|
+ v-for="item in permissionState.secNavList.slice(0,6)"
|
|
|
+ :key="item.PermissionId"
|
|
|
+ @click="handleChangeSecNav(item)"
|
|
|
+ >{{item.PermissionName}}</span>
|
|
|
+ <el-popover
|
|
|
+ :width="500"
|
|
|
+ trigger="click"
|
|
|
+ >
|
|
|
+ <template #reference>
|
|
|
+ <img v-if="permissionState.secNavList.length>6" style="width:16px;transform: rotate(90deg);cursor: pointer" src="@/assets/icon-more.png" alt="">
|
|
|
+ </template>
|
|
|
+ <template #default>
|
|
|
+ <div class="flex top-nav-filter-box">
|
|
|
+ <div
|
|
|
+ :class="['item',item.PermissionId == permissionState.sSecond&&'active']"
|
|
|
+ v-for="item in permissionState.secNavList.slice(6)"
|
|
|
+ :key="item.PermissionId"
|
|
|
+ @click="handleChangeSecNav(item)"
|
|
|
+ >{{item.PermissionName}}</div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-popover>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <SelfList
|
|
|
+ :finished="listState.finished"
|
|
|
+ :isEmpty="listState.list.length===0&&listState.finished"
|
|
|
+ :loading="listState.loading"
|
|
|
+ @listOnload="onLoad"
|
|
|
+ >
|
|
|
+ <div class="flex list-wrap">
|
|
|
+ <div class="video-item" v-for="item in listState.list" :key="item.community_video_id">
|
|
|
+ <el-popover
|
|
|
+ :width="200"
|
|
|
+ trigger="click"
|
|
|
+ >
|
|
|
+ <template #reference>
|
|
|
+ <div class="icon-wechat" @click="handelGetQRCodeImg(item)"></div>
|
|
|
+ </template>
|
|
|
+ <template #default>
|
|
|
+ <img style="width:100%" :src="item.QRCodeImg" alt="">
|
|
|
+ </template>
|
|
|
+ </el-popover>
|
|
|
+ <div class="title">{{item.title}}</div>
|
|
|
+ <video
|
|
|
+ :src="item.video_url"
|
|
|
+ controls
|
|
|
+ :poster="item.cover_img_url"
|
|
|
+ controlslist="nodownload"
|
|
|
+ disablePictureInPicture
|
|
|
+ autoplay
|
|
|
+ v-if="item.community_video_id==curVideoId"
|
|
|
+ ></video>
|
|
|
+ <div v-else class="poster-img" :style="'background-image:url('+item.cover_img_url+')'" @click="handelClickPlay(item)"></div>
|
|
|
+ <div class="time">发布时间:{{item.publish_time}}</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </SelfList>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.icon-wechat{
|
|
|
+ cursor: pointer;
|
|
|
+ width: 24px;
|
|
|
+ height: 24px;
|
|
|
+ background-image: url('@/assets/icon-wechat.png');
|
|
|
+ background-size: cover;
|
|
|
+ position: absolute;
|
|
|
+ top: 30px;
|
|
|
+ right: 30px;
|
|
|
+}
|
|
|
+.top-nav-filter-box{
|
|
|
+ flex-wrap: wrap;
|
|
|
+ .item{
|
|
|
+ margin: 5px 10px;
|
|
|
+ width: 113px;
|
|
|
+ height: 40px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ background-color: #f6f6f6;
|
|
|
+ border-radius: 4px;
|
|
|
+ font-size: 16px;
|
|
|
+ cursor: pointer;
|
|
|
+ :hover{
|
|
|
+ color: #fff;
|
|
|
+ background-color: #F3A52F;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .active{
|
|
|
+ color: #fff;
|
|
|
+ background-color: #F3A52F;
|
|
|
+ }
|
|
|
+}
|
|
|
+.video-list-page{
|
|
|
+ .top-nav-box{
|
|
|
+ padding: 30px 30px 12px 30px;
|
|
|
+ background: #FFFFFF;
|
|
|
+ box-shadow: 0px 4px 8px 1px rgba(0, 0, 0, 0.04);
|
|
|
+ position: fixed;
|
|
|
+ top: 60px;
|
|
|
+ width: 100%;
|
|
|
+ max-width: 1240px;
|
|
|
+ z-index: 10;
|
|
|
+ .first-nav-box{
|
|
|
+ span{
|
|
|
+ display: inline-block;
|
|
|
+ width: 140px;
|
|
|
+ line-height: 40px;
|
|
|
+ text-align: center;
|
|
|
+ border-radius: 20px;
|
|
|
+ background-color: #F6F6F6;
|
|
|
+ font-size: 16px;
|
|
|
+ margin-right: 30px;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ .active{
|
|
|
+ background-color: #FFFBF5;
|
|
|
+ box-shadow: 0px 6px 7px 1px #FFF7EB;
|
|
|
+ color: #F3A52F;
|
|
|
+ border: 1px solid #F3A52F;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .sec-nav-box{
|
|
|
+ margin-top: 30px;
|
|
|
+ .sec-item{
|
|
|
+ color: #666;
|
|
|
+ margin-right: 30px;
|
|
|
+ cursor: pointer;
|
|
|
+ display: inline-block;
|
|
|
+ }
|
|
|
+ .active{
|
|
|
+ color: #F3A52F;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .list-wrap{
|
|
|
+ padding-top: 150px;
|
|
|
+ border-left: 1px solid #E2E2E2;
|
|
|
+ border-right: 1px solid #E2E2E2;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ .video-item{
|
|
|
+ width: 50%;
|
|
|
+ padding: 30px;
|
|
|
+ border-bottom: 1px solid #E2E2E2;
|
|
|
+ position: relative;
|
|
|
+ &:nth-of-type(odd){
|
|
|
+ border-right: 1px solid #E2E2E2;
|
|
|
+ }
|
|
|
+ .title{
|
|
|
+ font-size: 16px;
|
|
|
+ color: #666;
|
|
|
+ }
|
|
|
+ video{
|
|
|
+ width: 100%;
|
|
|
+ height: 200px;
|
|
|
+ object-fit: cover;
|
|
|
+ margin: 19px 0;
|
|
|
+ }
|
|
|
+ .poster-img{
|
|
|
+ width: 100%;
|
|
|
+ height: 200px;
|
|
|
+ margin: 19px 0;
|
|
|
+ position: relative;
|
|
|
+ background-size: cover;
|
|
|
+ cursor: pointer;
|
|
|
+ &::after{
|
|
|
+ content:'';
|
|
|
+ display: block;
|
|
|
+ position: absolute;
|
|
|
+ width: 80px;
|
|
|
+ height: 80px;
|
|
|
+ top: 50%;
|
|
|
+ left: 50%;
|
|
|
+ transform: translate(-50%,-50%);
|
|
|
+ background-image: url('@/assets/video-play-btn.png');
|
|
|
+ background-size: cover;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .time{
|
|
|
+ color: #999;
|
|
|
+ font-size: 14px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|