Browse Source

答题优化

h5_css
蟑螂恶霸 3 years ago
parent
commit
56f179de53
  1. 52
      components/s-video/s-video.vue
  2. BIN
      static/videos/skin_bg_1a.png
  3. BIN
      static/videos/skin_bg_v1.png

52
components/s-video/s-video.vue

@ -6,20 +6,23 @@
<view class="popup-layer-back" v-if="!start" v-show="question"> <view class="popup-layer-back" v-if="!start" v-show="question">
<!-- <view class="popup-layer-close" @click="question=false">关闭</view> --> <!-- <view class="popup-layer-close" @click="question=false">关闭</view> -->
<view class="popup-layer"> <view class="popup-layer">
<h2>请选择</h2> <!-- <h2>请选择</h2> -->
<p @click="nextQuestion(item.outs[0], item)" v-for="(item, index) in answerList">{{item.channel}}</p> <view class="anitem" @click="nextQuestion(item.outs[0], item)" v-for="(item, index) in answerList">
<image class="animg" src="/static/videos/skin_bg_1a.png"></image>
<view class="antxt">{{item.channel}}</view>
</view>
</view> </view>
</view> </view>
<view class="popup-layer-back" v-if="start"> <!-- <view class="popup-layer-back" v-if="start">
<view class="popup-layer" @click="nextQuestion(2, null)"> <view class="popup-layer" @click="nextQuestion(2, null)">
<p>开始</p> <p>开始</p>
</view> </view>
</view> </view> -->
<view class="popup-layer-back" v-if="end"> <!-- <view class="popup-layer-back" v-if="end">
<view class="popup-layer" @click="getBindJson()"> <view class="popup-layer" @click="getBindJson()">
<p>重新开始</p> <p>重新开始</p>
</view> </view>
</view> </view> -->
</view> </view>
</view> </view>
</template> </template>
@ -40,6 +43,7 @@
question: false, question: false,
questionFreId: "", questionFreId: "",
preQuestionId: "", preQuestionId: "",
correct: "",
}; };
}, },
computed: { computed: {
@ -70,8 +74,8 @@
this.getBindJson(); this.getBindJson();
}, },
methods: { methods: {
videoEnded() { videoEnded() {
debugger
this.auto = false; this.auto = false;
this.question = true; this.question = true;
// 出答案 // 出答案
@ -98,16 +102,15 @@
}) })
.then(res => { .then(res => {
this.questionFreId = res.data; this.questionFreId = res.data;
console.log(this.questionFreId);
}).catch((e) => console.log(e)); //捕获异常 }).catch((e) => console.log(e)); //捕获异常
} }
// 先提交所选答案 // 先提交所选答案
if(null!=obj) { if(null!=obj) {
var param = { var param = {
answer : obj.channel, answer : obj.channel,
questionFreId : this.questionFreId, questionFreId : this.questionFreId,
questionId : this.preQuestionId questionId : this.preQuestionId,
correctAnswer : this.correct
} }
this.$api.addAnswer(param) this.$api.addAnswer(param)
.then(res => { .then(res => {
@ -135,13 +138,19 @@
for(var i=0; i<this.videoObjList.length; i++) { for(var i=0; i<this.videoObjList.length; i++) {
if(nodeId == this.videoObjList[i].nodeId) { if(nodeId == this.videoObjList[i].nodeId) {
this.videoObj = this.videoObjList[i]; this.videoObj = this.videoObjList[i];
this.correct = this.videoObjList[i].correct;
} }
} }
this.preQuestionId = this.videoObj.questionId; this.preQuestionId = this.videoObj.questionId;
// 直接自动开始播放
if(nodeId == 1) {
this.nextQuestion(2, null)
}
}, },
getAnswer(outId) { getAnswer(outId) {
for(var i=0; i<this.videoObjList.length; i++) { for(var i=0; i<this.videoObjList.length; i++) {
if(outId == this.videoObjList[i].nodeId) { if(outId == this.videoObjList[i].nodeId) {
console.log(this.videoObjList[i])
this.answerList.push(this.videoObjList[i]); this.answerList.push(this.videoObjList[i]);
} }
} }
@ -168,10 +177,31 @@
top: 50%; top: 50%;
left: 50%; left: 50%;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
background-color: #fff; /* background-color: #fff; */
color: #fff;
padding: 20px; padding: 20px;
z-index: 9999; z-index: 9999;
} }
.popup-layer .anitem {
position: relative;
margin: 80rpx;
width: 300rpx;
height: 100rpx;
text-align: center;
}
.popup-layer .anitem .animg {
width: 100%;
height: 100%;
}
.popup-layer .anitem .antxt {
position: absolute;
top: 30%;
width: 100%;
}
/* 设置关闭按钮 */ /* 设置关闭按钮 */
.popup-layer-close { .popup-layer-close {

BIN
static/videos/skin_bg_1a.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 KiB

BIN
static/videos/skin_bg_v1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 464 KiB

Loading…
Cancel
Save