Commit 57abcfd9 authored by 罗超's avatar 罗超

1

parent f5f6467f
...@@ -5,22 +5,39 @@ ...@@ -5,22 +5,39 @@
<view class="name"> <view class="name">
<view> <view>
{{ changeNumToHan(sortIndex) }}{{ data.GroupName }} {{ changeNumToHan(sortIndex) }}{{ data.GroupName }}
<text class="Exam_Score">(共{{ data.DetailsList.length }}道,{{ data.GScore }}分)</text> <text class="Exam_Score"
>(共{{ data.DetailsList.length }}道,{{ data.GScore }}分)</text
>
</view> </view>
<view class="ExamIndex_Box"> <view class="ExamIndex_Box">
<text class="Single_Before">{{ ExamIndex }}</text>/<text <text class="Single_Before">{{ ExamIndex }}</text
class="Exam_Total">{{ data.DetailsList.length }}</text> >/<text class="Exam_Total">{{ data.DetailsList.length }}</text>
</view> </view>
</view> </view>
<swiper class="swiper-box" :style="{ <swiper
class="swiper-box"
:style="{
height: `calc(100vh - 300rpx - ${statusBarHeight}px)`, height: `calc(100vh - 300rpx - ${statusBarHeight}px)`,
}" :autoplay="autoplay" :current="current" @change="onchange" :skip-hidden-item-layout="true"> }"
:autoplay="autoplay"
:current="current"
@change="onchange"
:skip-hidden-item-layout="true"
>
<swiper-item v-if="sortIndex != 1"></swiper-item> <swiper-item v-if="sortIndex != 1"></swiper-item>
<swiper-item v-for="(item1, index1) in data.DetailsList" :key="index1"> <swiper-item v-for="(item1, index1) in data.DetailsList" :key="index1">
<audio style="text-align: left" <audio
style="text-align: left"
poster="https://bjetxgzv.cdn.bspapp.com/VKCEYUGU-uni-app-doc/7fbf26a0-4f4a-11eb-b680-7980c8a877b8.png" poster="https://bjetxgzv.cdn.bspapp.com/VKCEYUGU-uni-app-doc/7fbf26a0-4f4a-11eb-b680-7980c8a877b8.png"
:src="item1.Src" name="日语听力" :action="audioAction" controls></audio> :src="item1.Src"
<view class="item1" :style="{height: `calc(100vh - 540rpx - ${statusBarHeight}px)`}"> name="日语听力"
:action="audioAction"
controls
></audio>
<view
class="item1"
:style="{ height: `calc(100vh - 540rpx - ${statusBarHeight}px)` }"
>
<view class="flex flex_start_center"> <view class="flex flex_start_center">
<!-- <view <!-- <view
class="audioBox flex flex_center_center" class="audioBox flex flex_center_center"
...@@ -41,76 +58,133 @@ ...@@ -41,76 +58,133 @@
</view> --> </view> -->
</view> </view>
<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">
<view>{{ index2 + 1 }}、({{ <view
>{{ index2 + 1 }}、({{
item2.QuestionName.slice(0, 2) item2.QuestionName.slice(0, 2)
}})</view> }})</view
>
<view v-html="item2.SubTitle"></view> <view v-html="item2.SubTitle"></view>
<text class=".Exam_Score">{{item1.Score}}</text> <text class=".Exam_Score">{{ item1.Score }}</text>
</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=" <view
class="flex flex_start_center item3"
v-if="
item2.QuestionKey === 'single' || item2.QuestionKey === 'single' ||
item2.QuestionKey === 'judge' item2.QuestionKey === 'judge'
"> "
>
<template v-if="isOperate"> <template v-if="isOperate">
<view class="chooseNum" :class="{ myAnswer: item3.IsAnswer }" <view
@click="singerChange(item2, item3)">{{ item3.Name }} class="chooseNum"
:class="{ myAnswer: item3.IsAnswer }"
@click="singerChange(item2, item3)"
>{{ item3.Name }}
</view> </view>
<view class="chooseName" @click="singerChange(item2, item3)" <view
v-html="item3.Content"></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="chooseNum"
:class="{ isTrueAnswer: item3.IsAnswer }"
>
{{ item3.Name }} {{ item3.Name }}
</view> </view>
<view class="chooseName" :class="{ isTrueAnswer: item3.IsAnswer }" <view
v-html="item3.Content"></view> class="chooseName"
:class="{ isTrueAnswer: item3.IsAnswer }"
v-html="item3.Content"
></view>
</template> </template>
</view> </view>
<!-- 多选 --> <!-- 多选 -->
<view class="flex flex_start_center item3" v-if="item2.QuestionKey === 'multiple'"> <view
class="flex flex_start_center item3"
v-if="item2.QuestionKey === 'multiple'"
>
<template v-if="isOperate"> <template v-if="isOperate">
<view class="chooseNum" :class="{ myAnswer: item3.IsAnswer }" <view
@click="multipleChange(item2, item3)">{{ item3.Name }} class="chooseNum"
:class="{ myAnswer: item3.IsAnswer }"
@click="multipleChange(item2, item3)"
>{{ item3.Name }}
</view> </view>
<view class="chooseName" @click="multipleChange(item2, item3)" <view
v-html="item3.Content"></view> class="chooseName"
@click="multipleChange(item2, item3)"
v-html="item3.Content"
></view>
</template> </template>
<template v-else> <template v-else>
<view class="chooseNum" :class="{ isTrueAnswer: item3.IsAnswer }"> <view
class="chooseNum"
:class="{ isTrueAnswer: item3.IsAnswer }"
>
{{ item3.Name }} {{ item3.Name }}
</view> </view>
<view class="chooseName" :class="{ isTrueAnswer: item3.IsAnswer }" <view
v-html="item3.Content"></view> class="chooseName"
:class="{ isTrueAnswer: item3.IsAnswer }"
v-html="item3.Content"
></view>
</template> </template>
</view> </view>
<!-- 填空 --> <!-- 填空 -->
<view class="flex flex_start_center item3" v-if="item2.QuestionKey === 'fill-in'"> <view
class="flex flex_start_center item3"
v-if="item2.QuestionKey === 'fill-in'"
>
<view class="chooseNum">{{ index3 + 1 }} </view> <view class="chooseNum">{{ index3 + 1 }} </view>
<template v-if="isOperate"> <template v-if="isOperate">
<input v-for="cItem in item2.SubAnwser" type="text" v-model="cItem.Content" <input
class="chooseName chooseName2" placeholder="请填写答案" v-for="cItem in item2.SubAnwser"
@input="AnswerChange(item2)" /> type="text"
v-model="cItem.Content"
class="chooseName chooseName2"
placeholder="请填写答案"
@input="AnswerChange(item2)"
/>
</template> </template>
<template v-else> <template v-else>
<view v-for="cItem in item2.SubAnwser" class="viewAnswerContent" <view
v-html="cItem.Content"></view> v-for="cItem in item2.SubAnwser"
class="viewAnswerContent"
v-html="cItem.Content"
></view>
</template> </template>
</view> </view>
<!-- 简答 --> <!-- 简答 -->
<view class="flex flex_start_center item3" <view
v-if="item2.QuestionKey === 'short-answer'"> class="flex flex_start_center item3"
v-if="item2.QuestionKey === 'short-answer'"
>
<template v-if="isOperate"> <template v-if="isOperate">
<textarea type="text" v-for="cItem in item2.SubAnwser" <textarea
v-model="cItem.Content" class="chooseName chooseName2" type="text"
placeholder="请填写答案" @input="AnswerChange(item2)" /> v-for="cItem in item2.SubAnwser"
v-model="cItem.Content"
class="chooseName chooseName2"
placeholder="请填写答案"
@input="AnswerChange(item2)"
/>
</template> </template>
<template v-else> <template v-else>
<view v-for="cItem in item2.SubAnwser" class="viewAnswerContent" <view
v-html="cItem.Content"></view> v-for="cItem in item2.SubAnwser"
class="viewAnswerContent"
v-html="cItem.Content"
></view>
</template> </template>
</view> </view>
</view> </view>
...@@ -120,11 +194,20 @@ ...@@ -120,11 +194,20 @@
<text style="color: #8c8a94">正确答案:</text> <text style="color: #8c8a94">正确答案:</text>
<text class="isTrueAnswer">{{ <text class="isTrueAnswer">{{
item1.QuestionAnswerList[index2].SubAnswer item1.QuestionAnswerList[index2].SubAnswer
}}</text> }}</text
>
<text> <text>
您的答案: 您的答案:
<template v-if="item1.AnswerList[index2].SubAnswer!=''"> <template
<text v-if="item1.QuestionAnswerList[index2].SubAnswer == item1.AnswerList[index2].SubAnswer"class="isTrueAnswer"> v-if="item1.AnswerList[index2].SubAnswer != ''"
>
<text
v-if="
item1.QuestionAnswerList[index2].SubAnswer ==
item1.AnswerList[index2].SubAnswer
"
class="isTrueAnswer"
>
{{ item1.AnswerList[index2].SubAnswer }},回答正确 {{ item1.AnswerList[index2].SubAnswer }},回答正确
</text> </text>
<text v-else class="isNotAnswer"> <text v-else class="isNotAnswer">
...@@ -136,11 +219,19 @@ ...@@ -136,11 +219,19 @@
</template> </template>
</text> </text>
</view> </view>
<view style="margin-top: 20rpx" <view
v-if="item1.AnswerList[index2].StudentScore!=''||item1.AnswerList[index2].StudentScore===0"> style="margin-top: 20rpx"
v-if="
item1.AnswerList[index2].StudentScore != '' ||
item1.AnswerList[index2].StudentScore === 0
"
>
<text style="color: #8c8a94">您的得分:</text> <text style="color: #8c8a94">您的得分:</text>
<text class="isTrueAnswer" <text
v-if="item1.AnswerList[index2].StudentScore > 0">{{ item1.AnswerList[index2].StudentScore }}</text> class="isTrueAnswer"
v-if="item1.AnswerList[index2].StudentScore > 0"
>{{ item1.AnswerList[index2].StudentScore }}</text
>
<text class="isNotAnswer" v-else>{{ <text class="isNotAnswer" v-else>{{
item1.AnswerList[index2].StudentScore item1.AnswerList[index2].StudentScore
}}</text> }}</text>
...@@ -152,13 +243,26 @@ ...@@ -152,13 +243,26 @@
<view class="AnswerContent" v-if="!isOperate && item1.AnswerParse"> <view class="AnswerContent" v-if="!isOperate && item1.AnswerParse">
<view style="word-wrap: break-word"> <view style="word-wrap: break-word">
<text style="color: #8c8a94">解析:</text> <text style="color: #8c8a94">解析:</text>
<view style="color: #000; display: inline-block" v-html="item1.AnswerParse"></view> <view
style="color: #000; display: inline-block"
v-html="item1.AnswerParse"
></view>
</view> </view>
</view> </view>
</view> </view>
<view class="AnswerBtn clear"> <view class="AnswerBtn clear">
<view class="AnswerBtnFirst" @click="getBeforeExam()" v-if="ExamIndex!=1||sortIndex!=1">上一题</view> <view
<view class="AnswerBtnSecond" v-if="sortIndex != sortTotal" @click="getNextExam()">下一题</view> class="AnswerBtnFirst"
@click="getBeforeExam()"
v-if="ExamIndex != 1 || sortIndex != 1"
>上一题</view
>
<view
class="AnswerBtnSecond"
v-if="sortIndex != sortTotal"
@click="getNextExam()"
>下一题</view
>
</view> </view>
</swiper-item> </swiper-item>
<swiper-item v-if="sortIndex != sortTotal"></swiper-item> <swiper-item v-if="sortIndex != sortTotal"></swiper-item>
...@@ -169,7 +273,7 @@ ...@@ -169,7 +273,7 @@
</template> </template>
<script> <script>
import { import {
ref, ref,
reactive, reactive,
toRefs, toRefs,
...@@ -179,13 +283,11 @@ ...@@ -179,13 +283,11 @@
computed, computed,
onMounted, onMounted,
onUnmounted, onUnmounted,
} from "vue"; } from "vue";
import { import { changeNumToHan } from "../../utils/index";
changeNumToHan const innerAudioContext = uni.createInnerAudioContext();
} from "../../utils/index"; innerAudioContext.autoplay = true;
const innerAudioContext = uni.createInnerAudioContext(); export default {
innerAudioContext.autoplay = true;
export default {
props: { props: {
paperData: Object, paperData: Object,
sort: Number, sort: Number,
...@@ -196,9 +298,7 @@ ...@@ -196,9 +298,7 @@
ExamStatus: Number, ExamStatus: Number,
}, },
setup(props, context) { setup(props, context) {
let { let { refs } = getCurrentInstance();
refs
} = getCurrentInstance();
console.log(163, refs); console.log(163, refs);
let data = reactive({ let data = reactive({
autoplay: false, autoplay: false,
...@@ -213,8 +313,9 @@ ...@@ -213,8 +313,9 @@
isOperate: props.isOperate, isOperate: props.isOperate,
ExamStatus: props.ExamStatus, ExamStatus: props.ExamStatus,
audioAction: { audioAction: {
method: 'pause' method: "pause",
} },
isIOS: false,
}); });
data.data.DetailsList.map((item) => { data.data.DetailsList.map((item) => {
let arr = item.Title.split(" "); //按空格分段 let arr = item.Title.split(" "); //按空格分段
...@@ -263,20 +364,21 @@ ...@@ -263,20 +364,21 @@
//获取总时长 //获取总时长
getTotalTime(url) { getTotalTime(url) {
innerAudioContext.src = url; innerAudioContext.src = url;
var Inner = ''; var Inner = "";
innerAudioContext.onCanplay(() => { innerAudioContext.onCanplay(() => {
innerAudioContext.duration; innerAudioContext.duration;
let t = innerAudioContext.duration; let t = innerAudioContext.duration;
let Time = t let Time = t;
var second = parseInt(Time) var second = parseInt(Time);
var hours = Math.floor(second / 3600) var hours = Math.floor(second / 3600);
second = second - hours * 3600 second = second - hours * 3600;
var mimute = Math.floor(second / 60) var mimute = Math.floor(second / 60);
second = second - mimute * 60 second = second - mimute * 60;
// let aa = hours + ':' + ('0' + mimute).slice(-2) + ':' + ('0' + second).slice(-2); // let aa = hours + ':' + ('0' + mimute).slice(-2) + ':' + ('0' + second).slice(-2);
let TotalTime = ('0' + mimute).slice(-2) + ':' + ('0' + second).slice(-2); let TotalTime =
return TotalTime ("0" + mimute).slice(-2) + ":" + ("0" + second).slice(-2);
}) return TotalTime;
});
}, },
audioManage(url) { audioManage(url) {
innerAudioContext.src = url; innerAudioContext.src = url;
...@@ -363,7 +465,13 @@ ...@@ -363,7 +465,13 @@
//点击下一题 //点击下一题
getNextExam() { getNextExam() {
data.current = data.current + 1; data.current = data.current + 1;
},
getSystem() {
let sys = uni.getSystemInfoSync().system;
if ((sys, indexOf("ios") != -1)) {
data.isIOS = true;
} }
},
}; };
onMounted(() => { onMounted(() => {
if (props.isLast) { if (props.isLast) {
...@@ -374,6 +482,7 @@ ...@@ -374,6 +482,7 @@
} }
} }
data.statusBarHeight = uni.getSystemInfoSync().statusBarHeight; data.statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
that.getSystem();
}); });
onUnmounted(() => { onUnmounted(() => {
innerAudioContext.stop(); innerAudioContext.stop();
...@@ -385,40 +494,40 @@ ...@@ -385,40 +494,40 @@
...methods, ...methods,
}; };
}, },
}; };
</script> </script>
<style scoped> <style scoped>
.AnswerBtn { .AnswerBtn {
margin-top: 20rpx; margin-top: 20rpx;
} }
.clear { .clear {
clear: both clear: both;
} }
.AnswerBtnFirst { .AnswerBtnFirst {
width: 250rpx; width: 250rpx;
height: 60rpx; height: 60rpx;
text-align: center; text-align: center;
line-height: 60rpx; line-height: 60rpx;
border-radius: 10rpx; border-radius: 10rpx;
border: 1px solid #00ACF9; border: 1px solid #00acf9;
color: #00ACF9; color: #00acf9;
float: left; float: left;
} }
.AnswerBtnSecond { .AnswerBtnSecond {
width: 250rpx; width: 250rpx;
height: 60rpx; height: 60rpx;
text-align: center; text-align: center;
line-height: 60rpx; line-height: 60rpx;
border-radius: 10rpx; border-radius: 10rpx;
background-color: #00ACF9; background-color: #00acf9;
color: #fff; color: #fff;
float: right; float: right;
} }
.name { .name {
height: 90rpx; height: 90rpx;
font-size: 30rpx; font-size: 30rpx;
font-family: PingFang SC; font-family: PingFang SC;
...@@ -427,73 +536,73 @@ ...@@ -427,73 +536,73 @@
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
} }
.ExamIndex_Box { .ExamIndex_Box {
margin-right: 40rpx; margin-right: 40rpx;
} }
.Single_Before { .Single_Before {
font-size: 30rpx; font-size: 30rpx;
font-weight: bold; font-weight: bold;
color: #da7878; color: #da7878;
} }
.isTrueAnswer { .isTrueAnswer {
color: green !important; color: green !important;
} }
.isNotAnswer { .isNotAnswer {
color: red !important; color: red !important;
} }
.AnswerContent { .AnswerContent {
font-size: 30rpx; font-size: 30rpx;
padding: 25rpx; padding: 25rpx;
background-color: #f4f4f4; background-color: #f4f4f4;
border-radius: 5px; border-radius: 5px;
} }
.viewAnswerContent { .viewAnswerContent {
width: 100%; width: 100%;
min-height: 44rpx; min-height: 44rpx;
border-bottom: 1px solid #d1d1d1; border-bottom: 1px solid #d1d1d1;
padding-bottom: 5px; padding-bottom: 5px;
} }
.Exam_Total { .Exam_Total {
font-size: 25rpx; font-size: 25rpx;
color: gray; color: gray;
} }
.swiper-box { .swiper-box {
height: calc(100vh - 270rpx); height: calc(100vh - 270rpx);
box-sizing: border-box; box-sizing: border-box;
} }
.num { .num {
font-size: 30rpx; font-size: 30rpx;
font-family: PingFang SC; font-family: PingFang SC;
color: #111111; color: #111111;
} }
.item { .item {
/* margin-bottom: 40rpx; */ /* margin-bottom: 40rpx; */
position: relative; position: relative;
} }
.item1 { .item1 {
/* margin: 25rpx 0; */ /* margin: 25rpx 0; */
align-items: center; align-items: center;
overflow-y: auto; overflow-y: auto;
margin-top:30rpx; margin-top: 30rpx;
} }
.questionView { .questionView {
overflow-y: auto; overflow-y: auto;
} }
.audioBox { .audioBox {
width: 120rpx; width: 120rpx;
height: 30rpx; height: 30rpx;
background: #b4ddfe; background: #b4ddfe;
...@@ -503,25 +612,25 @@ ...@@ -503,25 +612,25 @@
font-family: PingFang SC; font-family: PingFang SC;
font-weight: 500; font-weight: 500;
color: #00acf9; color: #00acf9;
} }
.item2 { .item2 {
box-sizing: border-box; box-sizing: border-box;
margin: 30rpx 0; margin: 30rpx 0;
/* padding: 0 30rpx; */ /* padding: 0 30rpx; */
} }
.item3 { .item3 {
padding-left: 25rpx; padding-left: 25rpx;
margin: 20rpx 0; margin: 20rpx 0;
} }
.myAnswer { .myAnswer {
background-color: #00acf9 !important; background-color: #00acf9 !important;
color: #ffffff !important; color: #ffffff !important;
} }
.chooseNum { .chooseNum {
width: 50rpx; width: 50rpx;
height: 50rpx; height: 50rpx;
text-align: center; text-align: center;
...@@ -533,34 +642,34 @@ ...@@ -533,34 +642,34 @@
font-family: PingFang SC; font-family: PingFang SC;
font-weight: bold; font-weight: bold;
color: #111111; color: #111111;
} }
.chooseName { .chooseName {
font-size: 30rpx; font-size: 30rpx;
font-family: PingFang SC; font-family: PingFang SC;
font-weight: 500; font-weight: 500;
color: #111111; color: #111111;
} }
.chooseName2 { .chooseName2 {
flex-grow: 1; flex-grow: 1;
border-bottom: 1px solid #111; border-bottom: 1px solid #111;
} }
.questionTitle { .questionTitle {
font-size: 28rpx; font-size: 28rpx;
font-family: PingFang SC; font-family: PingFang SC;
font-weight: bold; font-weight: bold;
color: #111111; color: #111111;
} }
.listen .van-count-down { .listen .van-count-down {
font-size: 22rpx !important; font-size: 22rpx !important;
color: #00acf9 !important; color: #00acf9 !important;
} }
.Exam_Score { .Exam_Score {
color: #999999; color: #999999;
font-size: 28rpx; font-size: 28rpx;
} }
</style> </style>
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