Commit a8329433 authored by zhengke's avatar zhengke

修改

parent 915430b5
...@@ -11,15 +11,12 @@ ...@@ -11,15 +11,12 @@
</template> </template>
</van-nav-bar> </van-nav-bar>
<swiper class="swiper-box" :style="{height: `calc(100vh - 180rpx)`}" :current="current" @change="onchange"> <swiper class="swiper-box" :style="{height: `calc(100vh - 180rpx)`}" :current="current" @change="onchange">
<swiper-item v-for="(item1, index1) in dataList" :key="index1" :catchtouchmove="true"> <swiper-item v-for="(item1, index1) in dataList" :key="index1">
<!-- <audio style="text-align: left" ref="audio" v-if="isShow"
poster="http://pic.pimg.tw/pam86591/1408719752-3322564110_n.jpg" :src="item1.Src" name="日语听力"
:action="audioAction" controls></audio> -->
<view class="My_listen" @click="play(item1.Src)"> <view class="My_listen" @click="play(item1.Src)">
<i class="icon_audio_default" v-if="!isPlay"></i> <i class="icon_audio_default" v-if="!isPlay"></i>
<i class="icon_audio_playing" v-else></i> <i class="icon_audio_playing" v-else></i>
</view> </view>
<view class="item1" :style="{ height: `calc(100vh - 560rpx)` }"> <view class="item1" :style="{ height: `calc(100vh - 480rpx)` }">
<template v-if="item1.StudentAnswer.length<item1.QuestionContentObj.length"> <template v-if="item1.StudentAnswer.length<item1.QuestionContentObj.length">
<view class="questionView"> <view class="questionView">
<view v-for="(item2, index2) in item1.QuestionContentObj" :key="index2" class="item2"> <view v-for="(item2, index2) in item1.QuestionContentObj" :key="index2" class="item2">
...@@ -95,10 +92,10 @@ ...@@ -95,10 +92,10 @@
</view> </view>
</template> </template>
</view> </view>
<view class="AnswerBtn clear"> <view class="AnswerBtn clear" style="display:none">
<view class="AnswerBtnFirst" @click="getBeforeExam()" v-if="current!=0">上一题</view> <view class="AnswerBtnFirst" @click="getBeforeExam()" v-if="current!=0">上一题</view>
<view class="AnswerBtnSecond" :class="{'isCanNext':item1.StudentAnswer.length==0}" v-if="current!=dataList.length" <view class="AnswerBtnSecond" :class="{'isCanNext':item1.StudentAnswer.length==0}"
@click="getNextExam(item1)">下一题</view> v-if="current!=dataList.length" @click="getNextExam(item1)">下一题</view>
</view> </view>
</swiper-item> </swiper-item>
</swiper> </swiper>
...@@ -143,13 +140,17 @@ ...@@ -143,13 +140,17 @@
method: "pause" method: "pause"
}, },
isIOS: false, isIOS: false,
isPlay:false isPlay: false
}); });
let UserInfo = uni.getStorageSync('userInfo'); let UserInfo = uni.getStorageSync('userInfo');
let sys = uni.getSystemInfoSync().system; let sys = uni.getSystemInfoSync().system;
watch(() => [...props.paperData], (val) => { watch(() => [...props.paperData], (val) => {
data.dataList = [...data.dataList, ...val]; data.dataList = [...data.dataList, ...val];
}) })
watch(()=>data.current, (newVal, oldValue) => {
innerAudioContext.stop();
data.isPlay=false;
},{deep:true});
let methods = { let methods = {
//阻止手动滑动 //阻止手动滑动
stopTouchMove() { stopTouchMove() {
...@@ -167,6 +168,9 @@ ...@@ -167,6 +168,9 @@
// 单选 // 单选
singerChange(item1, index, item3) { singerChange(item1, index, item3) {
item1.StudentAnswer[index] = item3.Name; item1.StudentAnswer[index] = item3.Name;
if (item1.StudentAnswer.length == item1.QuestionAnswerList.length) {
this.getNextExam();
}
}, },
getErrorAnswer(item1, index, name) { getErrorAnswer(item1, index, name) {
if (item1.StudentAnswer[index] == name) { if (item1.StudentAnswer[index] == name) {
...@@ -183,14 +187,14 @@ ...@@ -183,14 +187,14 @@
} }
}, },
play(Src) { play(Src) {
if(data.isPlay){ if (data.isPlay) {
innerAudioContext.pause(); innerAudioContext.pause();
data.isPlay=false; data.isPlay = false;
}else{ } else {
innerAudioContext.src = Src; innerAudioContext.src = Src;
innerAudioContext.play() innerAudioContext.play()
data.isPlay = true; data.isPlay = true;
innerAudioContext.onEnded((e)=>{ innerAudioContext.onEnded((e) => {
data.isPlay = false; data.isPlay = false;
}) })
} }
...@@ -201,47 +205,47 @@ ...@@ -201,47 +205,47 @@
}, },
//点击下一题 //点击下一题
getNextExam(item) { getNextExam(item) {
if (item.StudentAnswer.length>0) { let msg = {
innerAudioContext.stop(); Id: 0,
data.isPlay=false; StudentId: UserInfo.AccountId,
let msg = { Category: data.dataList[data.current].Category,
Id: 0, QuestionId: data.dataList[data.current].QuestionId,
StudentId: UserInfo.AccountId, Title: data.dataList[data.current].Title,
Category: data.dataList[data.current].Category, QuestionContent: data.dataList[data.current].QuestionContentObj,
QuestionId: data.dataList[data.current].QuestionId, QuestionTypeId: data.dataList[data.current].QuestionTypeId,
Title: data.dataList[data.current].Title, QuestionTypeKey: data.dataList[data.current].QuestionTypeKey,
QuestionContent: data.dataList[data.current].QuestionContentObj, StudentAnswer: data.dataList[data.current].StudentAnswer,
QuestionTypeId: data.dataList[data.current].QuestionTypeId, AnswerParse: data.dataList[data.current].AnswerParse,
QuestionTypeKey: data.dataList[data.current].QuestionTypeKey, LevelType: data.dataList[data.current].LevelType,
StudentAnswer: data.dataList[data.current].StudentAnswer, Answer: data.dataList[data.current].QuestionAnswerList.toString(),
AnswerParse: data.dataList[data.current].AnswerParse, IsAnswer: 0,
LevelType: data.dataList[data.current].LevelType, IsWrong: 0
Answer: data.dataList[data.current].QuestionAnswerList.toString(), }
IsAnswer: 0, if (data.dataList[data.current].StudentAnswer.length > 0) {
IsWrong: 0 msg.IsAnswer = 1;
} } else {
if (data.dataList[data.current].StudentAnswer.length > 0) { msg.IsAnswer = 0;
msg.IsAnswer = 1; }
if (data.dataList[data.current].StudentAnswer.length == data.dataList[data.current]
.QuestionAnswerList.length) {
if (data.dataList[data.current].StudentAnswer.toString() == data.dataList[data.current]
.QuestionAnswerList.toString()) {
msg.IsWrong = 0
} else { } else {
msg.IsAnswer = 0; msg.IsWrong = 1
} }
if (data.dataList[data.current].StudentAnswer.length == data.dataList[data.current] }
.QuestionAnswerList.length) { let res = SetStudentPractice(msg).then(res => {
if (data.dataList[data.current].StudentAnswer.toString() == data.dataList[data.current] if (res) {
.QuestionAnswerList.toString()) { if (res.Code == 1) {
msg.IsWrong = 0
} else {
msg.IsWrong = 1
} }
} }
let res = SetStudentPractice(msg).then(res => { });
if (res) { if(msg.IsWrong == 0){
if (res.Code == 1) {
}
}
});
data.current = data.current + 1; data.current = data.current + 1;
innerAudioContext.stop();
data.isPlay = false;
} }
}, },
}; };
...@@ -262,7 +266,7 @@ ...@@ -262,7 +266,7 @@
</script> </script>
<style scoped> <style scoped>
.AnswerBtn { .AnswerBtn {
margin-top:38rpx; margin-top: 38rpx;
/* position: absolute; */ /* position: absolute; */
} }
...@@ -302,24 +306,29 @@ ...@@ -302,24 +306,29 @@
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
} }
.isRightAnswer{
background-color: green!important; .isRightAnswer {
color:#fff!important; background-color: green !important;
color: #fff !important;
} }
.isRightText{
color:green!important; .isRightText {
color: green !important;
} }
.isTrueAnswer { .isTrueAnswer {
color: green !important; color: green !important;
} }
.isNotRightAnswer{
.isNotRightAnswer {
background-color: red; background-color: red;
color:#fff!important; color: #fff !important;
} }
.isNotAnswer { .isNotAnswer {
color: red ; color: red;
} }
.AnswerContent { .AnswerContent {
font-size: 30rpx; font-size: 30rpx;
padding: 25rpx; padding: 25rpx;
...@@ -437,6 +446,7 @@ ...@@ -437,6 +446,7 @@
.isCanNext { .isCanNext {
background-color: gray !important; background-color: gray !important;
} }
.icon_audio_default { .icon_audio_default {
background: transparent url('https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/iconloop.png') no-repeat 0 0; background: transparent url('https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/iconloop.png') no-repeat 0 0;
width: 18px; width: 18px;
...@@ -447,7 +457,7 @@ ...@@ -447,7 +457,7 @@
background-size: 54px 25px; background-size: 54px 25px;
background-position: -36px center; background-position: -36px center;
} }
.icon_audio_playing { .icon_audio_playing {
background: transparent url('https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/iconloop.png') no-repeat 0 0; background: transparent url('https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/iconloop.png') no-repeat 0 0;
width: 18px; width: 18px;
...@@ -459,28 +469,29 @@ ...@@ -459,28 +469,29 @@
-webkit-animation: audio_playing 1s infinite; -webkit-animation: audio_playing 1s infinite;
background-position: 0px center; background-position: 0px center;
} }
@-webkit-keyframes audio_playing { @-webkit-keyframes audio_playing {
30% { 30% {
background-position: 0px center; background-position: 0px center;
} }
31% { 31% {
background-position: -18px center; background-position: -18px center;
} }
61% { 61% {
background-position: -18px center; background-position: -18px center;
} }
61.5% { 61.5% {
background-position: -36px center; background-position: -36px center;
} }
100% { 100% {
background-position: -36px center; background-position: -36px center;
} }
} }
.My_listen { .My_listen {
width: 150rpx; width: 150rpx;
height: 150rpx; height: 150rpx;
......
...@@ -11,9 +11,9 @@ ...@@ -11,9 +11,9 @@
</template> </template>
</van-nav-bar> </van-nav-bar>
<swiper class="swiper-box" :style="{height: `calc(100vh - 320rpx)`}" :current="current" @change="onchange"> <swiper class="swiper-box" :style="{height: `calc(100vh - 320rpx)`}" :current="current" @change="onchange">
<swiper-item v-for="(item1, index1) in dataList" :key="index1" :catchtouchmove="true"> <swiper-item v-for="(item1, index1) in dataList" :key="index1">
<view class="item1"> <view class="item1">
<view class="flex" style="max-height:520rpx;overflow:auto;"> <view class="flex" style="max-height:600rpx;overflow:auto;">
<view class="num readTitle" v-html="item1.Title"></view> <view class="num readTitle" v-html="item1.Title"></view>
</view> </view>
<view :style="{maxHeight: `calc(100vh - 800rpx)`}" <view :style="{maxHeight: `calc(100vh - 800rpx)`}"
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
</swiper-item> </swiper-item>
</swiper> </swiper>
</view> </view>
<view class="AnswerBtn clear"> <view class="AnswerBtn clear" style="display:none;">
<view class="AnswerBtnFirst" @click="getBeforeExam()" v-if="current!=0">上一题 <view class="AnswerBtnFirst" @click="getBeforeExam()" v-if="current!=0">上一题
</view> </view>
<view class="AnswerBtnSecond" :class="{'isCanNext':!isCanNext}" v-if="current!=dataList.length" @click="getNextExam()">下一题</view> <view class="AnswerBtnSecond" :class="{'isCanNext':!isCanNext}" v-if="current!=dataList.length" @click="getNextExam()">下一题</view>
...@@ -143,6 +143,9 @@ ...@@ -143,6 +143,9 @@
data.dataList = [...data.dataList, ...val]; data.dataList = [...data.dataList, ...val];
}) })
let methods = { let methods = {
stopTouchMove(){
return true
},
clickImg(src) { clickImg(src) {
console.log(src); console.log(src);
wx.previewImage({ wx.previewImage({
...@@ -175,6 +178,7 @@ ...@@ -175,6 +178,7 @@
//判断题数已经全做 //判断题数已经全做
if(item1.StudentAnswer.length==item1.QuestionContentObj.length){ if(item1.StudentAnswer.length==item1.QuestionContentObj.length){
data.isCanNext=true; data.isCanNext=true;
this.getNextExam();
} }
}, },
onchange(e) { onchange(e) {
...@@ -189,42 +193,42 @@ ...@@ -189,42 +193,42 @@
}, },
//点击下一题 //点击下一题
getNextExam() { getNextExam() {
if(data.isCanNext){ let msg = {
let msg = { Id: 0,
Id: 0, StudentId: UserInfo.AccountId,
StudentId: UserInfo.AccountId, Category: data.dataList[data.current].Category,
Category: data.dataList[data.current].Category, QuestionId: data.dataList[data.current].QuestionId,
QuestionId: data.dataList[data.current].QuestionId, Title: data.dataList[data.current].Title,
Title: data.dataList[data.current].Title, QuestionContent: data.dataList[data.current].QuestionContentObj,
QuestionContent: data.dataList[data.current].QuestionContentObj, QuestionTypeId: data.dataList[data.current].QuestionTypeId,
QuestionTypeId: data.dataList[data.current].QuestionTypeId, QuestionTypeKey: data.dataList[data.current].QuestionTypeKey,
QuestionTypeKey: data.dataList[data.current].QuestionTypeKey, StudentAnswer: data.dataList[data.current].StudentAnswer,
StudentAnswer: data.dataList[data.current].StudentAnswer, AnswerParse: data.dataList[data.current].AnswerParse,
AnswerParse: data.dataList[data.current].AnswerParse, LevelType:data.dataList[data.current].LevelType,
LevelType:data.dataList[data.current].LevelType, Answer:data.dataList[data.current].Answer,
Answer:data.dataList[data.current].Answer, IsAnswer: 0,
IsAnswer: 0, IsWrong: 0
IsWrong: 0 }
} if(data.dataList[data.current].StudentAnswer.length>0){
if(data.dataList[data.current].StudentAnswer.length>0){ msg.IsAnswer=1;
msg.IsAnswer=1; }else{
msg.IsAnswer=0;
}
if(data.dataList[data.current].StudentAnswer.length==data.dataList[data.current].QuestionAnswerList.length){
if(data.dataList[data.current].StudentAnswer.toString()==data.dataList[data.current].QuestionAnswerList.toString()){
msg.IsWrong = 0
}else{ }else{
msg.IsAnswer=0; msg.IsWrong = 1
} }
if(data.dataList[data.current].StudentAnswer.length==data.dataList[data.current].QuestionAnswerList.length){ }
if(data.dataList[data.current].StudentAnswer.toString()==data.dataList[data.current].QuestionAnswerList.toString()){ let res = SetStudentPractice(msg).then(res => {
msg.IsWrong = 0 if (res) {
}else{ if (res.Code == 1) {
msg.IsWrong = 1
} }
} }
let res = SetStudentPractice(msg).then(res => { });
if (res) { if(msg.IsWrong==0){
if (res.Code == 1) {
}
}
});
data.current = data.current + 1; data.current = data.current + 1;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment