Files
jwl-applet/src/pages/questionBank/videoDetail.vue

316 lines
8.2 KiB
Vue
Raw Normal View History

2023-08-17 00:23:32 +08:00
<template>
<view>
2023-08-29 00:24:24 +08:00
<sunny-video style="width: 100%" videoHeight="422rpx" ref="sunny-video" :src="videoList[currentIndex].videoUrl" />
2023-08-24 15:26:02 +08:00
<view class="p14tb bc-fff">
<view class="skill-sequence-panel-content-wrapper pr14" v-if="videoType=='test'">
<scroll-view class="skill-sequence-panel-content" scroll-x>
2023-08-29 00:24:24 +08:00
<view class="skill-sequence-skill-wrapper tab_iem" :class="videoIndex===item.value?'checked_tab':''"
v-for="(item,index) of testList" :key="index" @tap="checkTest(item.value)">{{item.label}}</view>
2023-08-24 15:26:02 +08:00
</scroll-view>
2023-08-20 01:59:40 +08:00
</view>
2023-08-24 15:26:02 +08:00
<view class="flex ai-c jc-sb mt10 wp100 p14">
2023-08-28 02:02:46 +08:00
<text class="fs18 fw600 cor-000">{{title}}</text>
2023-08-20 01:59:40 +08:00
<view class="flex" @tap="popupShow=true" v-if="videoType!='test'">
2023-08-17 00:23:32 +08:00
<text class="fs14 cor-666">更多</text>
<u-icon color="#666" name="arrow-right" size="18"></u-icon>
</view>
2023-08-20 01:59:40 +08:00
<view v-else class="fs14 cor-666">共9条路线</view>
2023-08-17 21:52:45 +08:00
</view>
<view>
2023-08-17 00:23:32 +08:00
</view>
</view>
2023-08-28 02:02:46 +08:00
<view class="bc-fff pl14 pb10">
2023-08-24 15:26:02 +08:00
<view class="skill-sequence-panel-content-wrapper">
2023-08-29 00:24:24 +08:00
<scroll-view class="skill-sequence-panel-content" scroll-x :scroll-left="getScrollLeft">
2023-08-24 15:26:02 +08:00
<view class="skill-sequence-skill-wrapper" v-for="(item, index) in videoList" :key="index"
2023-08-28 02:02:46 +08:00
@tap="checkVideo(item.projectId)">
2023-08-24 15:26:02 +08:00
<view>
2023-09-06 00:28:46 +08:00
<view class="mb10 relative contain-box hide" style="overflow: hidden;">
<image class="contain-box" style="position: absolute;left: 0;top: 0;" mode="widthFix"
2023-08-29 00:24:24 +08:00
:src="item.videoUrl+'?x-oss-process=video/snapshot,t_0,f_jpg'"></image>
2023-08-24 15:26:02 +08:00
<view v-if="projectId==item.projectId" class="playLogo">播放中</view>
<image class="play_btn" src="../../static/image/index/play.png" />
2023-08-28 02:02:46 +08:00
<text style="position: absolute;right: 8rpx;bottom: 8rpx;color:#fff">{{item.videoTime}}</text>
2023-08-18 01:41:17 +08:00
</view>
2023-08-29 00:24:24 +08:00
<view class="topic_cont_text" :style="{color:projectId==item.projectId?'#FF6E02':'#333'}">
{{item.description}}
</view>
2023-08-24 15:26:02 +08:00
</view>
</view>
</scroll-view>
</view>
2023-08-18 01:41:17 +08:00
</view>
<u-popup :show="popupShow" mode="bottom" :closeOnClickOverlay="true" @close="popupShow=false">
<view class="p14 flex ai-c jc-sb">
<text class="fs16 fw600 cor-000">课程目录</text>
<text class="fs16 cor-666" @tap="popupShow=false">收起</text>
</view>
<view style="max-height: 800rpx;overflow-y: scroll;" class="p14lr">
2023-09-06 00:28:46 +08:00
<view class="flex bc-fff mb15" style="border-radius: 16rpx;" v-for="(item,index) of videoList" :key="index"
2023-08-28 02:02:46 +08:00
@tap="checkVideo(item.projectId)">
2023-09-06 00:28:46 +08:00
<view class="pic relative hide" style="overflow: hidden;">
<image class="pic" style="position: absolute;left: 0;top: 0;" mode="widthFix" :src="item.videoUrl+'?x-oss-process=video/snapshot,t_0,f_jpg'"></image>
2023-08-18 01:41:17 +08:00
<image class="play_btn_2" src="../../static/image/index/play.png" />
2023-08-28 02:02:46 +08:00
<text style="position: absolute;right: 8rpx;bottom: 8rpx;color:#fff">{{item.videoTime}}</text>
2023-08-18 01:41:17 +08:00
</view>
<view class="ml10">
2023-08-24 15:26:02 +08:00
<text class="fs16 cor-000 fw600">{{item.description}}</text>
2023-08-29 00:24:24 +08:00
<view class="fs14 mt5 cor-666">{{item.subDesc}}</view>
2023-08-18 01:41:17 +08:00
</view>
</view>
</view>
</u-popup>
2023-08-17 00:23:32 +08:00
</view>
</template>
<script>
2023-08-24 15:26:02 +08:00
import {
queryProjectList
} from '@/jtools/api/question';
import storage from '@/jtools/storage';
export default {
data() {
return {
2023-08-29 00:24:24 +08:00
title: '',
currentIndex: 0,
2023-08-24 15:26:02 +08:00
videoIndex: 0,
testList: [{
label: "八一考场",
value: 0,
}, {
label: "富凯考场",
value: 1
}, {
label: "新亚考场",
value: 2
}, {
label: "庐江考场",
value: 3
}, {
label: "富凯考场",
value: 4
}, {
label: "新亚考场",
value: 5
}, {
label: "庐江考场",
value: 6
}],
2023-09-17 13:18:59 +08:00
driveType:'',
2023-08-24 15:26:02 +08:00
videoType: '',
popupShow: false,
videoList: [{
title: '正确的驾驶姿势',
time: '13:14',
id: 0
}, {
title: '正确的驾驶姿势',
time: '13:14',
id: 1
}, {
title: '正确的驾驶姿势',
time: '13:14',
id: 2
}, {
title: '正确的驾驶姿势',
time: '13:14',
id: 3
}, {
title: '正确的驾驶姿势',
time: '13:14',
id: 4
}, {
title: '正确的驾驶姿势',
time: '13:14',
id: 5
}],
2023-08-29 00:24:24 +08:00
projectId: undefined,
param: {}
2023-08-18 01:41:17 +08:00
}
},
2023-08-24 15:26:02 +08:00
onLoad(op) {
2023-09-17 13:18:59 +08:00
if(op.driveType){
this.driveType=op.driveType
this.param.driveType=op.driveType
}
2023-08-24 15:26:02 +08:00
if (op.type) {
this.videoType = op.type
}
2023-08-29 00:24:24 +08:00
if (op.projectId) {
this.projectId = op.projectId
2023-08-24 15:26:02 +08:00
}
2023-08-29 00:24:24 +08:00
if (op.subject) {
this.param.subject = op.subject
2023-08-24 15:26:02 +08:00
}
2023-08-29 00:24:24 +08:00
if (op.type) {
this.param.type = op.type
2023-09-17 13:18:59 +08:00
this.getVideoList()
2023-08-20 01:59:40 +08:00
}
2023-08-29 00:24:24 +08:00
if (op.type == '1') {
if (this.param.subject == '2') {
this.title = '科二基础项目讲解'
} else {
this.title = '科三基础项目讲解'
2023-08-28 02:02:46 +08:00
}
2023-08-29 00:24:24 +08:00
} else {
this.title = '基础操作讲解'
2023-08-28 02:02:46 +08:00
}
2023-09-17 13:18:59 +08:00
2023-08-29 00:24:24 +08:00
},
computed: {
getScrollLeft() {
const index = this.currentIndex - 1 < 0 ? 0 : this.currentIndex - 1
return 164 * index
2023-08-28 02:02:46 +08:00
}
2023-08-20 01:59:40 +08:00
},
2023-08-24 15:26:02 +08:00
methods: {
2023-09-17 13:18:59 +08:00
formateTime(time) {
const h = parseInt(time / 3600)
const minute = parseInt(time / 60 % 60)
const second = Math.ceil(time % 60)
const hours = h < 10 ? '0' + h : h
const formatSecond = second > 59 ? 59 : second
return `${hours > 0 ? `${hours}:` : ''}${minute < 10 ? '0' + minute : minute}:${formatSecond < 10 ? '0' + formatSecond : formatSecond}`
},
getVideoList() {
queryProjectList({
"carTypeId": storage.get('carType') || '1001',
...this.param,
}).then(resp => {
if(resp.code==='0000'){
let arr=[]
if(this.param.type=='1'){
arr = JSON.parse(JSON.stringify(resp.data))
arr = arr.map(item => {
return {
...item,
videoUrl: item.videoList[0]?.videoUrl,
videoTime: this.formateTime(item.videoList[0]?.videoTime)
}
})
}else{
arr = JSON.parse(JSON.stringify(resp.data[0].videoList))
arr = arr.map(item => {
return {
...item,
projectId: item.videoId,
subDesc: resp.data[0].description,
videoTime: this.formateTime(item.videoTime)
}
})
}
this.videoList = arr
this.currentIndex = this.videoList.findIndex(item => item.projectId == this.projectId)
}
})
},
2023-08-24 15:26:02 +08:00
checkTest(val) {
this.videoIndex = val
2023-08-20 01:59:40 +08:00
},
2023-08-24 15:26:02 +08:00
checkVideo(val) {
2023-08-29 00:24:24 +08:00
this.popupShow = false
2023-08-24 15:26:02 +08:00
this.projectId = val
2023-08-29 00:24:24 +08:00
this.currentIndex = this.videoList.findIndex(item => item.projectId == this.projectId)
2023-08-17 00:23:32 +08:00
}
}
}
</script>
2023-08-18 01:41:17 +08:00
<style scoped>
.contain-box {
width: 260rpx;
height: 146rpx;
background: #00B74F;
border-radius: 8rpx;
}
2023-08-24 15:26:02 +08:00
2023-08-29 00:24:24 +08:00
.topic_cont_text {
width: 260rpx;
height:45rpx;
overflow: hidden;
word-break: break-all;
/* break-all(允许在单词内换行。) */
text-overflow: ellipsis;
/* 超出部分省略号 */
/* display: -webkit-box; */
white-space: nowrap;
-webkit-box-orient: vertical; /** 设置或检索伸缩盒对象的子元素的排列方式 **/
-webkit-line-clamp:1; /** 显示的行数 **/
}
2023-08-24 15:26:02 +08:00
.playLogo {
2023-08-18 01:41:17 +08:00
width: 90rpx;
height: 40rpx;
background: #FF6E02;
border-radius: 8rpx 0rpx 8rpx 0rpx;
line-height: 40rpx;
text-align: center;
color: #fff;
font-size: 12px;
position: absolute;
left: 0;
2023-08-24 15:26:02 +08:00
top: 0
2023-08-18 01:41:17 +08:00
}
2023-08-24 15:26:02 +08:00
.play_btn {
2023-08-18 01:41:17 +08:00
width: 65rpx;
height: 65rpx;
position: absolute;
left: 97.5rpx;
2023-08-24 15:26:02 +08:00
top: 39.5rpx
2023-08-18 01:41:17 +08:00
}
2023-08-24 15:26:02 +08:00
.play_btn_2 {
2023-08-18 01:41:17 +08:00
width: 65rpx;
height: 65rpx;
position: absolute;
left: 117.5rpx;
2023-08-24 15:26:02 +08:00
top: 52rpx
2023-08-18 01:41:17 +08:00
}
2023-08-24 15:26:02 +08:00
.pic {
2023-08-18 01:41:17 +08:00
width: 300rpx;
height: 169rpx;
background: #00B74F;
border-radius: 8rpx;
}
2023-08-24 15:26:02 +08:00
.tab_iem {
2023-08-20 01:59:40 +08:00
width: 145rpx;
height: 56rpx;
line-height: 56rpx;
text-align: center;
background: #F5F5F5;
border-radius: 10rpx;
2023-08-24 15:26:02 +08:00
color: #333
}
.checked_tab {
2023-08-20 01:59:40 +08:00
background: linear-gradient(90deg, #11DF20 0%, #01B74F 100%);
2023-08-24 15:26:02 +08:00
color: #fff
}
2023-08-29 00:24:24 +08:00
2023-08-24 15:26:02 +08:00
/*scroll-view外层*/
2023-08-29 00:24:24 +08:00
.skill-sequence-panel-content-wrapper {
position: relative;
white-space: nowrap;
2023-08-24 15:26:02 +08:00
}
2023-08-29 00:24:24 +08:00
2023-08-24 15:26:02 +08:00
/*scroll-view本身*/
2023-08-29 00:24:24 +08:00
.skill-sequence-panel-content {
min-width: 100%;
2023-08-24 15:26:02 +08:00
}
2023-08-29 00:24:24 +08:00
2023-08-24 15:26:02 +08:00
/*scroll-view内层*/
2023-08-29 00:24:24 +08:00
.skill-sequence-skill-wrapper {
display: inline-block;
2023-08-24 15:26:02 +08:00
margin-right: 15px;
2023-08-20 01:59:40 +08:00
}
2023-09-06 00:28:46 +08:00
.hide {
backface-visibility: hidden;
transform: translate3d(0, 0, 0);
-webkit-backface-visibility: hidden;
-webkit-transform: translate3d(0, 0, 0);
}
2023-08-17 00:23:32 +08:00
</style>