Commit d2621740 authored by zhengke's avatar zhengke

1

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