|
|
@@ -1,36 +1,46 @@
|
|
|
<!-- -->
|
|
|
<template>
|
|
|
-<div class='tab4-1' v-if="videoList.length!==0">
|
|
|
- <!-- 左侧列表 -->
|
|
|
- <div class="one_left">
|
|
|
- <div class="alone" v-for="item in videoList" :key="item.id" @click="videoChange(item.filePath)">
|
|
|
- <div class="video_name" :title="item.name">{{item.name}}</div>
|
|
|
- <img :src="baseURL + item.thumb" alt="">
|
|
|
+ <div class="tab4-1" v-if="videoList.length !== 0">
|
|
|
+ <!-- 左侧列表 -->
|
|
|
+ <div class="one_left">
|
|
|
+ <div
|
|
|
+ class="alone"
|
|
|
+ :class="{active:videoInd===index}"
|
|
|
+ v-for="(item,index) in videoList"
|
|
|
+ :key="item.id"
|
|
|
+ @click="videoChange(item,index)"
|
|
|
+ >
|
|
|
+ <div class="video_name" :title="item.name">{{ item.name }}</div>
|
|
|
+ <img :src="baseURL + item.thumb" alt="" />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- 右侧视频 -->
|
|
|
+ <div class="one_right">
|
|
|
+ <video
|
|
|
+ v-if="videoSrc"
|
|
|
+ :src="baseURL + videoSrc"
|
|
|
+ autoplay
|
|
|
+ controls
|
|
|
+ ></video>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <!-- 右侧视频 -->
|
|
|
- <div class="one_right">
|
|
|
- <video v-if="videoSrc" :src="baseURL+videoSrc" autoplay controls></video>
|
|
|
- </div>
|
|
|
-</div>
|
|
|
-<div class='tab4-1 conNull' v-else>
|
|
|
- 暂 无 数 据
|
|
|
-</div>
|
|
|
+ <div class="tab4-1 conNull" v-else>暂 无 数 据</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import axios from '@/utils/request'
|
|
|
-import {videoList} from '@/utils/api'
|
|
|
+import axios from "@/utils/request";
|
|
|
+import { videoList, webVisit } from "@/utils/api";
|
|
|
export default {
|
|
|
- name: 'tab4-1',
|
|
|
+ name: "tab4-1",
|
|
|
components: {},
|
|
|
- data () {
|
|
|
+ data() {
|
|
|
// 这里存放数据
|
|
|
return {
|
|
|
- videoSrc:'',
|
|
|
- videoList:[],
|
|
|
- baseURL:''
|
|
|
- }
|
|
|
+ videoInd:0,
|
|
|
+ videoSrc: "",
|
|
|
+ videoList: [],
|
|
|
+ baseURL: "",
|
|
|
+ };
|
|
|
},
|
|
|
// 监听属性 类似于data概念
|
|
|
computed: {},
|
|
|
@@ -38,87 +48,99 @@ export default {
|
|
|
watch: {},
|
|
|
// 方法集合
|
|
|
methods: {
|
|
|
- videoChange(url){
|
|
|
- this.videoSrc=url
|
|
|
- }
|
|
|
+ async videoChange(val,ind) {
|
|
|
+ this.videoSrc = val.filePath;
|
|
|
+ this.videoInd=ind
|
|
|
+ // 记录访问量
|
|
|
+ await webVisit("video", val.id);
|
|
|
+ },
|
|
|
},
|
|
|
// 生命周期 - 创建完成(可以访问当前this实例)
|
|
|
- created () {
|
|
|
+ created() {
|
|
|
// 获取服务器前缀地址
|
|
|
- this.baseURL = axios.defaults.baseURL
|
|
|
+ this.baseURL = axios.defaults.baseURL;
|
|
|
},
|
|
|
// 生命周期 - 挂载完成(可以访问DOM元素)
|
|
|
- async mounted () {
|
|
|
- let res = await videoList({pageNum:1,pageSize:999})
|
|
|
- this.videoList=res.data.records
|
|
|
- this.videoSrc=this.videoList[0].filePath
|
|
|
- // console.log(998,res);
|
|
|
+ async mounted() {
|
|
|
+ let res = await videoList({ pageNum: 1, pageSize: 999 });
|
|
|
+ this.videoList = res.data.records;
|
|
|
+ this.videoSrc = this.videoList[0].filePath;
|
|
|
+ // 进页面为第一个视频添加访问量
|
|
|
+ if(res.data.records[0]) await webVisit("video", res.data.records[0].id);
|
|
|
+ // console.log(998,res);
|
|
|
},
|
|
|
- beforeCreate () {}, // 生命周期 - 创建之前
|
|
|
- beforeMount () {}, // 生命周期 - 挂载之前
|
|
|
- beforeUpdate () {}, // 生命周期 - 更新之前
|
|
|
- updated () {}, // 生命周期 - 更新之后
|
|
|
- beforeDestroy () {}, // 生命周期 - 销毁之前
|
|
|
- destroyed () {}, // 生命周期 - 销毁完成
|
|
|
- activated () {} // 如果页面有keep-alive缓存功能,这个函数会触发
|
|
|
-}
|
|
|
+ beforeCreate() {}, // 生命周期 - 创建之前
|
|
|
+ beforeMount() {}, // 生命周期 - 挂载之前
|
|
|
+ beforeUpdate() {}, // 生命周期 - 更新之前
|
|
|
+ updated() {}, // 生命周期 - 更新之后
|
|
|
+ beforeDestroy() {}, // 生命周期 - 销毁之前
|
|
|
+ destroyed() {}, // 生命周期 - 销毁完成
|
|
|
+ activated() {}, // 如果页面有keep-alive缓存功能,这个函数会触发
|
|
|
+};
|
|
|
</script>
|
|
|
<style lang='less' scoped>
|
|
|
- /deep/::-webkit-scrollbar-thumb{
|
|
|
- background-color: #b9412e !important;
|
|
|
- outline: 1px solid #b9412e !important;
|
|
|
- outline-offset: 0;
|
|
|
- }
|
|
|
-.conNull{
|
|
|
+/deep/::-webkit-scrollbar-thumb {
|
|
|
+ background-color: #b9412e !important;
|
|
|
+ outline: 1px solid #b9412e !important;
|
|
|
+ outline-offset: 0;
|
|
|
+}
|
|
|
+.conNull {
|
|
|
font-size: 30px;
|
|
|
align-items: center;
|
|
|
justify-content: center;
|
|
|
- color: #B9412E;
|
|
|
+ color: #b9412e;
|
|
|
}
|
|
|
-.tab4-1{
|
|
|
+.tab4-1 {
|
|
|
display: flex;
|
|
|
width: 100%;
|
|
|
height: 675px;
|
|
|
min-width: 1500px;
|
|
|
- .one_left{
|
|
|
+ .one_left {
|
|
|
+ padding-right: 5px;
|
|
|
margin-right: 24px;
|
|
|
width: 280px;
|
|
|
height: 100%;
|
|
|
overflow-y: auto;
|
|
|
- .alone{
|
|
|
+ .alone {
|
|
|
position: relative;
|
|
|
cursor: pointer;
|
|
|
width: 100%;
|
|
|
height: 158px;
|
|
|
margin-bottom: 10px;
|
|
|
+ // border: 2px solid #b9412e;
|
|
|
+ &:hover{
|
|
|
border: 2px solid #b9412e;
|
|
|
- &:last-child{
|
|
|
+ }
|
|
|
+ &:last-child {
|
|
|
margin-bottom: 0;
|
|
|
}
|
|
|
- &>img{
|
|
|
+ & > img {
|
|
|
object-fit: cover;
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
}
|
|
|
- .video_name{
|
|
|
+ .video_name {
|
|
|
overflow: hidden;
|
|
|
text-overflow: ellipsis;
|
|
|
- white-space: nowrap;
|
|
|
+ white-space: nowrap;
|
|
|
width: 100%;
|
|
|
position: absolute;
|
|
|
bottom: 0;
|
|
|
left: 0;
|
|
|
- background-color: rgba(0,0,0,.8);
|
|
|
+ background-color: rgba(0, 0, 0, 0.8);
|
|
|
height: 24px;
|
|
|
line-height: 24px;
|
|
|
color: #fff;
|
|
|
text-align: center;
|
|
|
}
|
|
|
}
|
|
|
+ .active{
|
|
|
+ border: 2px solid #b9412e;
|
|
|
+ }
|
|
|
}
|
|
|
- .one_right{
|
|
|
+ .one_right {
|
|
|
flex: 1;
|
|
|
- &>video{
|
|
|
+ & > video {
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
}
|