|
|
|
@ -1,18 +1,18 @@ |
|
|
|
<template> |
|
|
|
<view class="video-wrapper" id="video-container"> |
|
|
|
<view style="position: relative;width: 100%; height: 300px;"> |
|
|
|
<video :src="videoObj.videoUrl" @ended="videoEnded()" :autoplay="auto" style="width: 100%;height: 300px;"></video> |
|
|
|
<view style="position:relative;width:100%;" :style="{'height':videoHeight+'px'}"> |
|
|
|
<video id="video_play" :src="videoObj.videoUrl" @ended="videoEnded()" :autoplay="auto" style="width: 100%;height: 100%;"></video> |
|
|
|
<view class="question"></view> |
|
|
|
|
|
|
|
<view class="popup-layer-back" v-if="!start" v-show="question"> |
|
|
|
<!-- <view class="popup-layer-close" @click="question=false">关闭</view> --> |
|
|
|
<view class="popup-layer"> |
|
|
|
<h2>答案填充</h2> |
|
|
|
<p @click="nextQuestion(item.outs[0])" v-for="(item, index) in answerList">答题{{item.outs[0]}}后跳转下一视频</p> |
|
|
|
<p @click="nextQuestion(item.outs[0], item)" v-for="(item, index) in answerList">答题{{item.channel}}后跳转下一视频</p> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="popup-layer-back" v-if="start"> |
|
|
|
<view class="popup-layer" @click="nextQuestion(2)"> |
|
|
|
<view class="popup-layer" @click="nextQuestion(2, null)"> |
|
|
|
<p>开始</p> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
@ -30,6 +30,7 @@ |
|
|
|
name: "s-video", |
|
|
|
data() { |
|
|
|
return { |
|
|
|
videoHeight: 300, |
|
|
|
videoObjList: [], |
|
|
|
videoObj:{}, |
|
|
|
answerList: [], |
|
|
|
@ -37,6 +38,8 @@ |
|
|
|
end: false, |
|
|
|
auto: true, |
|
|
|
question: false, |
|
|
|
questionFreId: "", |
|
|
|
preQuestionId: "", |
|
|
|
}; |
|
|
|
}, |
|
|
|
props:{ |
|
|
|
@ -46,6 +49,14 @@ |
|
|
|
} |
|
|
|
}, |
|
|
|
created() { |
|
|
|
uni.getSystemInfo({ |
|
|
|
success: (res) => { |
|
|
|
this.videoHeight = res.screenHeight; |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
this.videoContext = uni.createVideoContext("video_play"); |
|
|
|
this.videoContext.requestFullScreen(); |
|
|
|
this.getBindJson(); |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
@ -63,7 +74,32 @@ |
|
|
|
this.question = false; |
|
|
|
} |
|
|
|
}, |
|
|
|
nextQuestion(outId) { |
|
|
|
nextQuestion(outId, obj) { |
|
|
|
// 点击开始后先增加题次 |
|
|
|
if(2==outId) { |
|
|
|
this.$api.addQuestionFre({ |
|
|
|
roleId : "1", |
|
|
|
userId : "123" |
|
|
|
}) |
|
|
|
.then(res => { |
|
|
|
this.questionFreId = res.data; |
|
|
|
console.log(this.questionFreId); |
|
|
|
}).catch((e) => console.log(e)); //捕获异常 |
|
|
|
} |
|
|
|
|
|
|
|
// 先提交所选答案 |
|
|
|
if(null!=obj) { |
|
|
|
var param = { |
|
|
|
answer : obj.channel, |
|
|
|
questionFreId : this.questionFreId, |
|
|
|
questionId : this.preQuestionId |
|
|
|
} |
|
|
|
this.$api.addAnswer(param) |
|
|
|
.then(res => { |
|
|
|
console.log(res); |
|
|
|
}).catch((e) => console.log(e)); //捕获异常 |
|
|
|
} |
|
|
|
// 播放下一视频 |
|
|
|
this.hasNodeId(outId); |
|
|
|
this.videoObj.videoUrl = 'http://localhost:85/'+this.videoObj.videoUrl |
|
|
|
this.start = false; |
|
|
|
@ -86,6 +122,7 @@ |
|
|
|
this.videoObj = this.videoObjList[i]; |
|
|
|
} |
|
|
|
} |
|
|
|
this.preQuestionId = this.videoObj.questionId; |
|
|
|
}, |
|
|
|
getAnswer(outId) { |
|
|
|
for(var i=0; i<this.videoObjList.length; i++) { |
|
|
|
|