Commit d2621740 authored by zhengke's avatar zhengke

1

parent b328904e
...@@ -10,21 +10,20 @@ ...@@ -10,21 +10,20 @@
<text class="Exam_Current">{{current+1}}</text><text class="Exam_Count">/{{Count}}</text> <text class="Exam_Current">{{current+1}}</text><text class="Exam_Count">/{{Count}}</text>
</template> </template>
</van-nav-bar> </van-nav-bar>
<swiper class="swiper-box" :style="{height: `calc(100vh - 300rpx)`}" <swiper class="swiper-box" :style="{height: `calc(100vh - 300rpx)`}" :current="current" @change="onchange">
: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" poster="http://pic.pimg.tw/pam86591/1408719752-3322564110_n.jpg"
<audio style="text-align: left" :src="item1.Src" name="日语听力" :action="audioAction" controls></audio>
poster="https://bjetxgzv.cdn.bspapp.com/VKCEYUGU-uni-app-doc/7fbf26a0-4f4a-11eb-b680-7980c8a877b8.png" <view class="item1" :style="{ height: `calc(100vh - 414rpx)` }">
:src="item1.Src" name="日语听力" :action="audioAction" controls v-if="!isIOS"></audio> <!-- <view class="flex flex_start_center" v-if="isIOS">
<view class="item1" :style="{ height: `calc(100vh - 414rpx - ${statusBarHeight}px)` }">
<view class="flex flex_start_center" v-if="isIOS">
<view class="audioBox flex flex_center_center" @click="audioManage(item1.Src)"> <view class="audioBox flex flex_center_center" @click="audioManage(item1.Src)">
<image style="width: 26rpx; height: 22rpx" <image style="width: 26rpx; height: 22rpx"
src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/horn.png" /> src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/horn.png" />
<van-count-down :time="audioTime" :auto-start="false" class="flex flex_center_center" <van-count-down :time="audioTime" :auto-start="false" class="flex flex_center_center"
style="color: #00acf9" ref="listenCountdown" format="mm:ss" /> style="color: #00acf9" ref="listenCountdown" format="mm:ss" />
</view> </view>
</view> </view> -->
<template v-if="item1.StundetAnswer.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">
<view class="flex questionTitle"> <view class="flex questionTitle">
...@@ -33,36 +32,55 @@ ...@@ -33,36 +32,55 @@
</view> </view>
<view v-for="(item3, index3) in item2.SubAnwser" :key="index3"> <view v-for="(item3, index3) in item2.SubAnwser" :key="index3">
<!-- 单选 、判断--> <!-- 单选 、判断-->
<view class="flex flex_start_center item3" v-if="item2.QuestionKey === 'single'"> <view class="flex flex_start_center item3"
<template v-if="isOperate"> v-if="item2.QuestionKey === 'single'">
<view class="chooseNum" :class="{ myAnswer: item3.IsAnswer }" <view class="chooseNum"
@click="singerChange(item2, item3)">{{ item3.Name }} :class="{ 'myAnswer': item1.StundetAnswer[index2]==item3.Name }"
@click="singerChange(item1, index2, item3)">{{ item3.Name }}
</view>
<view class="chooseName"
:class="{ 'myAnswer': item1.StundetAnswer[index2]==item3.Name }"
@click="singerChange(item1, index2, item3)" v-html="item3.Content">
</view>
</view>
</view>
</view>
</view> </view>
<view class="chooseName" @click="singerChange(item2, item3)"
v-html="item3.Content"></view>
</template> </template>
<template v-else> <template v-else>
<view class="chooseNum" :class="{ isTrueAnswer: item3.IsAnswer }"> <view class="questionView">
<view v-for="(item2, index2) in item1.QuestionContentObj" :key="index2" class="item2">
<view class="flex questionTitle">
<view>{{ index2 + 1 }}、({{item2.QuestionName.slice(0, 2)}})</view>
<view v-html="item2.SubTitle"></view>
</view>
<view v-for="(item3, index3) in item2.SubAnwser" :key="index3">
<!-- 单选 、判断-->
<view class="flex flex_start_center item3"
v-if="item2.QuestionKey === 'single'">
<view class="chooseNum"
:class="{ 'isTrueAnswer': item3.IsAnswer,'isNotAnswer':getErrorAnswer(item1,index2,item3.Name)}">
{{ item3.Name }} {{ item3.Name }}
</view> </view>
<view class="chooseName" :class="{ isTrueAnswer: item3.IsAnswer }" <view class="chooseName"
:class="{ 'isTrueAnswer': item3.IsAnswer,'isNotAnswer':getErrorAnswer(item1,index2,item3.Name)}"
v-html="item3.Content"></view> v-html="item3.Content"></view>
</template>
</view> </view>
</view> </view>
<template v-if="!isOperate">
<view class="AnswerContent"> <view class="AnswerContent">
<view> <view>
<text style="color: #8c8a94">正确答案:</text> <text style="color: #8c8a94">正确答案:</text>
<text class="isTrueAnswer">{{item1.QuestionAnswerList[index2].SubAnswer}}</text> <text class="isTrueAnswer">{{item1.QuestionAnswerList[index2]}}</text>
<text> <text>
您的答案: 您的答案:
<template v-if="item1.AnswerList[index2].SubAnswer != ''"> <template v-if="item1.StundetAnswer.length>0">
<text v-if="item1.QuestionAnswerList[index2].SubAnswer == item1.AnswerList[index2].SubAnswer" class="isTrueAnswer"> <text
{{ item1.AnswerList[index2].SubAnswer }},回答正确 v-if="item1.StundetAnswer[index2] == item1.QuestionAnswerList[index2]"
class="isTrueAnswer">
{{ item1.StundetAnswer[index2] }},回答正确
</text> </text>
<text v-else class="isNotAnswer"> <text v-else class="isNotAnswer">
{{ item1.AnswerList[index2].SubAnswer }},回答错误 {{ item1.StundetAnswer[index2] }},回答错误
</text> </text>
</template> </template>
<template v-else> <template v-else>
...@@ -71,22 +89,21 @@ ...@@ -71,22 +89,21 @@
</text> </text>
</view> </view>
</view> </view>
</template>
</view> </view>
</view> <view style="word-wrap: break-word; margin-bottom:30rpx;display: flex;"
<view class="AnswerContent" v-if="!isOperate && item1.AnswerParse"> class="AnswerContent" v-if="item1.AnswerParse">
<view style="word-wrap: break-word"> <text style="color: #8c8a94;flex-shrink: 0;">解析:</text>
<text style="color: #8c8a94">解析:</text> <view style="color: #000" v-html="item1.AnswerParse"></view>
<view style="color: #000; display: inline-block" v-html="item1.AnswerParse"></view>
</view> </view>
</view> </view>
</template>
</view> </view>
</swiper-item> </swiper-item>
</swiper> </swiper>
<view class="AnswerBtn clear"> <view class="AnswerBtn clear">
<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"
<view class="AnswerBtnSecond" v-if="current!=dataList.length" @click="getNextExam()">下一题</view> @click="getNextExam()">下一题</view>
</view> </view>
</view> </view>
</view> </view>
...@@ -106,6 +123,10 @@ ...@@ -106,6 +123,10 @@
} from "vue"; } from "vue";
const innerAudioContext = uni.createInnerAudioContext(); const innerAudioContext = uni.createInnerAudioContext();
innerAudioContext.autoplay = true; innerAudioContext.autoplay = true;
import {
SetStudentPractice
} from "../../api/exam";
export default { export default {
props: { props: {
paperData: Array, paperData: Array,
...@@ -120,16 +141,17 @@ ...@@ -120,16 +141,17 @@
dataList: props.paperData, dataList: props.paperData,
current: 0, //默认从第几个开始-用于从快捷菜单点入 current: 0, //默认从第几个开始-用于从快捷菜单点入
statusBarHeight: 0, statusBarHeight: 0,
isCanNext: false,//判断是否能点击下一题 isCanNext: false, //判断是否能点击下一题
audioAction: { audioAction: {
method: "pause" method: "pause"
}, },
isOperate:true,
isIOS: false, isIOS: false,
}); });
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];
console.log(data.dataList, 'data.dataList')
}) })
if (sys.indexOf("iOS") != -1) { if (sys.indexOf("iOS") != -1) {
data.isIOS = true; data.isIOS = true;
...@@ -137,15 +159,11 @@ ...@@ -137,15 +159,11 @@
data.isIOS = false; data.isIOS = false;
} }
console.log(327, sys, data.isIOS); console.log(327, sys, data.isIOS);
data.dataList.map((item) => {
let arr = item.Title.split(" "); //按空格分段
arr.map((e) => {
if (e.indexOf("src") != -1) {
item.Src = decodeURIComponent(e.split("url=")[1].slice(0, -1));
}
});
});
let methods = { let methods = {
//阻止手动滑动
stopTouchMove(){
return true;
},
jumpPage() { jumpPage() {
uni.navigateTo({ uni.navigateTo({
url: "/pages/exam/examPaper", url: "/pages/exam/examPaper",
...@@ -174,6 +192,7 @@ ...@@ -174,6 +192,7 @@
}); });
}, },
audioManage(url) { audioManage(url) {
console.log(url, 'url');
innerAudioContext.src = url; innerAudioContext.src = url;
innerAudioContext.onCanplay(() => { innerAudioContext.onCanplay(() => {
// 必须。可以当做是初始化时长 // 必须。可以当做是初始化时长
...@@ -204,30 +223,22 @@ ...@@ -204,30 +223,22 @@
}); });
}, },
//----------------------------------------选题---------------------------------- //----------------------------------------选题----------------------------------
// 单选or判断 // 单选
singerChange(item2, item3) { singerChange(item1, index, item3) {
item2.SubAnwser.map((e) => { item1.StundetAnswer[index] = item3.Name;
if (e.Name == item3.Name) { //判断题数已经全做
e.IsAnswer = true; if (item1.StundetAnswer.length == item1.QuestionContentObj.length) {
item2.IsRes = true; //答题标记 data.isCanNext = true;
} else {
e.IsAnswer = false;
} }
});
},
// 多选
multipleChange(item2, item3) {
item3.IsAnswer = !item3.IsAnswer;
//标记已回答
item2.IsRes = item2.SubAnwser.some((e) => {
return e.IsAnswer;
});
}, },
AnswerChange(item) { getErrorAnswer(item1, index, name) {
item.IsRes = item.SubAnwser.some((e) => { if (item1.StundetAnswer[index] == name) {
return e.Content && e.Content != ""; return true
}); } else {
return false
}
}, },
onchange(e) { onchange(e) {
innerAudioContext.stop(); innerAudioContext.stop();
innerAudioContext.onCanplay(() => { innerAudioContext.onCanplay(() => {
...@@ -240,15 +251,9 @@ ...@@ -240,15 +251,9 @@
}); });
data.isPlay = true; data.isPlay = true;
data.ExamIndex = e.detail.current; data.current = e.detail.current;
if (data.sortIndex == 1) { if (data.current + 1 == data.dataList.length) {
data.ExamIndex = e.detail.current + 1; this.$emit('getAfter');
}
if (data.ExamIndex === data.data.DetailsList.length + 1) {
this.$emit("getAfterTopic");
}
if (e.detail.current == 0 && data.sortIndex != 1) {
this.$emit("getBeforeTopic");
} }
}, },
//点击上一题 //点击上一题
...@@ -257,7 +262,46 @@ ...@@ -257,7 +262,46 @@
}, },
//点击下一题 //点击下一题
getNextExam() { getNextExam() {
if (data.isCanNext) {
let msg = {
Id: 0,
StudentId: UserInfo.AccountId,
Category: data.dataList[data.current].Category,
QuestionId: data.dataList[data.current].QuestionId,
Title: data.dataList[data.current].Title,
QuestionContent: data.dataList[data.current].QuestionContentObj,
QuestionTypeId: data.dataList[data.current].QuestionTypeId,
QuestionTypeKey: data.dataList[data.current].QuestionTypeKey,
StudentAnswer: data.dataList[data.current].StundetAnswer,
AnswerParse: data.dataList[data.current].AnswerParse,
LevelType: data.dataList[data.current].LevelType,
Answer: data.dataList[data.current].QuestionAnswerList.toString(),
IsAnswer: 0,
IsWrong: 0
}
if (data.dataList[data.current].StundetAnswer.length > 0) {
msg.IsAnswer = 1;
} else {
msg.IsAnswer = 0;
}
if (data.dataList[data.current].StundetAnswer.length == data.dataList[data.current]
.QuestionAnswerList.length) {
if (data.dataList[data.current].StundetAnswer.toString() == data.dataList[data.current]
.QuestionAnswerList.toString()) {
msg.IsWrong = 0
} else {
msg.IsWrong = 1
}
}
let res = SetStudentPractice(msg).then(res => {
if (res) {
if (res.Code == 1) {
}
}
});
data.current = data.current + 1; data.current = data.current + 1;
}
}, },
}; };
onMounted(() => { onMounted(() => {
...@@ -277,7 +321,7 @@ ...@@ -277,7 +321,7 @@
</script> </script>
<style scoped> <style scoped>
.AnswerBtn { .AnswerBtn {
margin-top: 20rpx; margin-top: 40rpx;
} }
.clear { .clear {
...@@ -317,23 +361,14 @@ ...@@ -317,23 +361,14 @@
justify-content: space-between; justify-content: space-between;
} }
.ExamIndex_Box { .isNotAnswer {
margin-right: 40rpx; color: red !important;
}
.Single_Before {
font-size: 30rpx;
font-weight: bold;
color: #da7878;
} }
.isTrueAnswer { .isTrueAnswer {
color: green !important; color: green !important;
} }
.isNotAnswer {
color: red !important;
}
.AnswerContent { .AnswerContent {
font-size: 30rpx; font-size: 30rpx;
...@@ -342,18 +377,6 @@ ...@@ -342,18 +377,6 @@
border-radius: 5px; border-radius: 5px;
} }
.viewAnswerContent {
width: 100%;
min-height: 44rpx;
border-bottom: 1px solid #d1d1d1;
padding-bottom: 5px;
}
.Exam_Total {
font-size: 25rpx;
color: gray;
}
.swiper-box { .swiper-box {
height: calc(100vh - 270rpx); height: calc(100vh - 270rpx);
box-sizing: border-box; box-sizing: border-box;
...@@ -366,12 +389,10 @@ ...@@ -366,12 +389,10 @@
} }
.item { .item {
/* margin-bottom: 40rpx; */
position: relative; position: relative;
} }
.item1 { .item1 {
/* margin: 25rpx 0; */
align-items: center; align-items: center;
overflow-y: auto; overflow-y: auto;
margin-top: 30rpx; margin-top: 30rpx;
...@@ -379,6 +400,7 @@ ...@@ -379,6 +400,7 @@
.questionView { .questionView {
overflow-y: auto; overflow-y: auto;
z-index:999;
} }
.audioBox { .audioBox {
...@@ -447,8 +469,22 @@ ...@@ -447,8 +469,22 @@
color: #00acf9 !important; color: #00acf9 !important;
} }
.Exam_Current {
font-size: 35rpx;
color: red;
}
.Exam_Count {
color: gray;
font-size: 26rpx;
}
.Exam_Score { .Exam_Score {
color: #999999; color: #999999;
font-size: 28rpx; font-size: 28rpx;
} }
.isCanNext {
background-color: gray !important;
}
</style> </style>
...@@ -200,7 +200,7 @@ ...@@ -200,7 +200,7 @@
</view> </view>
</view> </view>
<view class="Ques_CirContent" v-if="TypeObj.wordsFinishCount"> <view class="Ques_CirContent" v-if="TypeObj">
<view class="Ques_Circle" @click="goExam(1)"> <view class="Ques_Circle" @click="goExam(1)">
<view class="Ques_Top">单词</view> <view class="Ques_Top">单词</view>
<view class="Ques_Num" v-if="TypeObj">{{TypeObj.wordsFinishCount}}/{{TypeObj.wordsTotalCount}}</view> <view class="Ques_Num" v-if="TypeObj">{{TypeObj.wordsFinishCount}}/{{TypeObj.wordsTotalCount}}</view>
......
...@@ -99,6 +99,17 @@ ...@@ -99,6 +99,17 @@
let res = GetQuestionListening(data.examMsg).then(res => { let res = GetQuestionListening(data.examMsg).then(res => {
if (res.Code == 1) { if (res.Code == 1) {
this.dataList = res.Data.PageData; this.dataList = res.Data.PageData;
this.dataList.map((item) => {
let arr = item.Title.split(" "); //按空格分段
arr.map((e) => {
if (e.indexOf("src") != -1) {
let Before = e.split("url=")[1]
if(Before){
item.Src = decodeURIComponent(Before.slice(0, -1));
}
}
});
});
this.Count = res.Data.Count; this.Count = res.Data.Count;
} }
}); });
......
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