|
@@ -31,23 +31,18 @@
|
|
>
|
|
>
|
|
<van-radio
|
|
<van-radio
|
|
@change="changeCheckbox"
|
|
@change="changeCheckbox"
|
|
- :value="
|
|
|
|
- problemList[problemListIndex].userAnswer.includes(
|
|
|
|
- problemList[problemListIndex].answer
|
|
|
|
- )
|
|
|
|
- "
|
|
|
|
|
|
+ :value="item.value"
|
|
class="problem-checkbox"
|
|
class="problem-checkbox"
|
|
use-icon-slot
|
|
use-icon-slot
|
|
v-for="(item, index) in problemList[problemListIndex].optsArr"
|
|
v-for="(item, index) in problemList[problemListIndex].optsArr"
|
|
:key="index"
|
|
:key="index"
|
|
:name="item"
|
|
:name="item"
|
|
>
|
|
>
|
|
- <text>{{ item }}</text>
|
|
|
|
|
|
+ <text>{{ item.value }}</text>
|
|
<view
|
|
<view
|
|
class="problem-op"
|
|
class="problem-op"
|
|
:class="{
|
|
:class="{
|
|
- 'problem-op_selected':
|
|
|
|
- problemList[problemListIndex].userAnswer.includes(item),
|
|
|
|
|
|
+ 'problem-op_selected': item.selected,
|
|
}"
|
|
}"
|
|
slot="icon"
|
|
slot="icon"
|
|
>{{ numberToLetter(index) }}</view
|
|
>{{ numberToLetter(index) }}</view
|
|
@@ -66,8 +61,27 @@
|
|
:key="index"
|
|
:key="index"
|
|
class="problem-select"
|
|
class="problem-select"
|
|
>
|
|
>
|
|
- <icon class="icon-box-img" type="success" size="70rpx"></icon>
|
|
|
|
- <text class="problem-opAnswer">{{ numberToLetter(index) }}</text>
|
|
|
|
|
|
+ <icon
|
|
|
|
+ v-if="item.isAnswer && item.selected"
|
|
|
|
+ class="icon-box-img"
|
|
|
|
+ type="success"
|
|
|
|
+ size="75rpx"
|
|
|
|
+ ></icon>
|
|
|
|
+ <icon
|
|
|
|
+ v-if="!item.isAnswer && item.selected"
|
|
|
|
+ class="icon-box-img"
|
|
|
|
+ type="cancel"
|
|
|
|
+ size="75rpx"
|
|
|
|
+ ></icon>
|
|
|
|
+ <text v-if="!item.isAnswer && !item.selected" class="problem-op">{{
|
|
|
|
+ numberToLetter(index)
|
|
|
|
+ }}</text>
|
|
|
|
+ <text
|
|
|
|
+ v-if="item.isAnswer && !item.selected"
|
|
|
|
+ class="problem-op_green"
|
|
|
|
+ >{{ numberToLetter(index) }}</text
|
|
|
|
+ >
|
|
|
|
+ <text class="problem-opAnswer">{{ item.value }}</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<!-- 多选 -->
|
|
<!-- 多选 -->
|
|
@@ -79,34 +93,76 @@
|
|
class="problem-ops"
|
|
class="problem-ops"
|
|
>
|
|
>
|
|
<van-checkbox-group
|
|
<van-checkbox-group
|
|
|
|
+ @change="changeCheckGroup"
|
|
:value="problemList[problemListIndex].userAnswer"
|
|
:value="problemList[problemListIndex].userAnswer"
|
|
:max="4"
|
|
:max="4"
|
|
>
|
|
>
|
|
<van-checkbox
|
|
<van-checkbox
|
|
@change="changeCheckbox"
|
|
@change="changeCheckbox"
|
|
- :value="
|
|
|
|
- problemList[problemListIndex].userAnswer.includes(
|
|
|
|
- problemList[problemListIndex].answer
|
|
|
|
- )
|
|
|
|
- "
|
|
|
|
|
|
+ :value="item.selected"
|
|
class="problem-checkbox"
|
|
class="problem-checkbox"
|
|
use-icon-slot
|
|
use-icon-slot
|
|
v-for="(item, index) in problemList[problemListIndex].optsArr"
|
|
v-for="(item, index) in problemList[problemListIndex].optsArr"
|
|
:key="index"
|
|
:key="index"
|
|
- :name="item"
|
|
|
|
|
|
+ :name="item.value"
|
|
>
|
|
>
|
|
- <text>{{ item }}</text>
|
|
|
|
|
|
+ <text>{{ item.value }}</text>
|
|
<view
|
|
<view
|
|
class="problem-op"
|
|
class="problem-op"
|
|
:class="{
|
|
:class="{
|
|
- 'problem-op_selected':
|
|
|
|
- problemList[problemListIndex].userAnswer.includes(item),
|
|
|
|
|
|
+ 'problem-op_selected': problemList[
|
|
|
|
+ problemListIndex
|
|
|
|
+ ].userAnswer.includes(item.value),
|
|
}"
|
|
}"
|
|
slot="icon"
|
|
slot="icon"
|
|
>{{ numberToLetter(index) }}</view
|
|
>{{ numberToLetter(index) }}</view
|
|
>
|
|
>
|
|
</van-checkbox>
|
|
</van-checkbox>
|
|
</van-checkbox-group>
|
|
</van-checkbox-group>
|
|
|
|
+ <view class="flex-center">
|
|
|
|
+ <van-button
|
|
|
|
+ @click="confirmMult"
|
|
|
|
+ color="#498ef5"
|
|
|
|
+ round
|
|
|
|
+ custom-style="width:600rpx"
|
|
|
|
+ type="primary"
|
|
|
|
+ >确定</van-button
|
|
|
|
+ >
|
|
|
|
+ </view>
|
|
|
|
+ </view>
|
|
|
|
+ <view
|
|
|
|
+ v-if="
|
|
|
|
+ problemList[problemListIndex].questionType == 3 &&
|
|
|
|
+ problemList[problemListIndex].isCompleted
|
|
|
|
+ "
|
|
|
|
+ >
|
|
|
|
+ <view
|
|
|
|
+ v-for="(item, index) in problemList[problemListIndex].optsArr"
|
|
|
|
+ :key="index"
|
|
|
|
+ class="problem-select"
|
|
|
|
+ >
|
|
|
|
+ <icon
|
|
|
|
+ v-if="item.isAnswer && item.selected"
|
|
|
|
+ class="icon-box-img"
|
|
|
|
+ type="success"
|
|
|
|
+ size="75rpx"
|
|
|
|
+ ></icon>
|
|
|
|
+ <icon
|
|
|
|
+ v-if="!item.isAnswer && item.selected"
|
|
|
|
+ class="icon-box-img"
|
|
|
|
+ type="cancel"
|
|
|
|
+ size="75rpx"
|
|
|
|
+ ></icon>
|
|
|
|
+ <text v-if="!item.isAnswer && !item.selected" class="problem-op">{{
|
|
|
|
+ numberToLetter(index)
|
|
|
|
+ }}</text>
|
|
|
|
+ <text
|
|
|
|
+ v-if="item.isAnswer && !item.selected"
|
|
|
|
+ class="problem-op_green"
|
|
|
|
+ >{{ numberToLetter(index) }}</text
|
|
|
|
+ >
|
|
|
|
+ <text class="problem-opAnswer">{{ item.value }}</text>
|
|
|
|
+ </view>
|
|
</view>
|
|
</view>
|
|
<view class="function-list">
|
|
<view class="function-list">
|
|
<div class="function-item">
|
|
<div class="function-item">
|
|
@@ -144,6 +200,9 @@
|
|
<view>答案是:{{ problemList[problemListIndex].answer }}</view>
|
|
<view>答案是:{{ problemList[problemListIndex].answer }}</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
+ <explainJs @close="()=>{
|
|
|
|
+ explainJsVisible=false
|
|
|
|
+ }" :explainJs="problemList[problemListIndex].explainJs" :explainjsmp3="problemList[problemListIndex].explainjsmp3" :show="explainJsVisible"></explainJs>
|
|
|
|
|
|
<van-tabbar>
|
|
<van-tabbar>
|
|
<van-tabbar-item @click="goBeforeTopics"
|
|
<van-tabbar-item @click="goBeforeTopics"
|
|
@@ -155,13 +214,29 @@
|
|
size="18px"
|
|
size="18px"
|
|
/>上一题
|
|
/>上一题
|
|
</van-tabbar-item>
|
|
</van-tabbar-item>
|
|
|
|
+ <van-tabbar-item>
|
|
|
|
+ <icon slot="icon" class="icon-box-img" type="success" size="18px"></icon
|
|
|
|
+ >{{ trueNum }}</van-tabbar-item
|
|
|
|
+ >
|
|
|
|
+ <van-tabbar-item
|
|
|
|
+ ><icon
|
|
|
|
+ slot="icon"
|
|
|
|
+ class="icon-box-img"
|
|
|
|
+ type="cancel"
|
|
|
|
+ size="18px"
|
|
|
|
+ ></icon>
|
|
|
|
+ {{ falseNum }}
|
|
|
|
+ </van-tabbar-item>
|
|
<van-tabbar-item
|
|
<van-tabbar-item
|
|
><van-icon slot="icon" size="18px" name="description" />{{
|
|
><van-icon slot="icon" size="18px" name="description" />{{
|
|
problemListIndex + 1
|
|
problemListIndex + 1
|
|
}}/{{ problemListTotal }}
|
|
}}/{{ problemListTotal }}
|
|
</van-tabbar-item>
|
|
</van-tabbar-item>
|
|
- <van-tabbar-item @click="submitExam"
|
|
|
|
- ><van-icon slot="icon" size="18px" name="records" />交卷
|
|
|
|
|
|
+ <van-tabbar-item
|
|
|
|
+ @click="()=>{
|
|
|
|
+ explainJsVisible=true
|
|
|
|
+ }"
|
|
|
|
+ ><icon slot="icon" type="warn" size="18px" />解释
|
|
</van-tabbar-item>
|
|
</van-tabbar-item>
|
|
<van-tabbar-item @click="goNextTopics"
|
|
<van-tabbar-item @click="goNextTopics"
|
|
><van-icon
|
|
><van-icon
|
|
@@ -179,6 +254,7 @@
|
|
import navBar from "./components/navBar.vue";
|
|
import navBar from "./components/navBar.vue";
|
|
import api from "@/api/index";
|
|
import api from "@/api/index";
|
|
import utils from "@/utils/index";
|
|
import utils from "@/utils/index";
|
|
|
|
+import explainJs from './components/explainJs.vue'
|
|
export default {
|
|
export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
@@ -188,13 +264,17 @@ export default {
|
|
subject: "",
|
|
subject: "",
|
|
title: "",
|
|
title: "",
|
|
},
|
|
},
|
|
- currentAnswer: [
|
|
|
|
|
|
+ trueNum: 0,
|
|
|
|
+ falseNum: 0,
|
|
|
|
+ currentOptions: [
|
|
{
|
|
{
|
|
selected: false,
|
|
selected: false,
|
|
value: "",
|
|
value: "",
|
|
isAnswer: false,
|
|
isAnswer: false,
|
|
},
|
|
},
|
|
|
|
+ {},
|
|
],
|
|
],
|
|
|
|
+ explainJsVisible:false,
|
|
time: 45 * 60 * 1000,
|
|
time: 45 * 60 * 1000,
|
|
problemListTotal: 1,
|
|
problemListTotal: 1,
|
|
problemList: [
|
|
problemList: [
|
|
@@ -358,17 +438,59 @@ export default {
|
|
globalAudio.play();
|
|
globalAudio.play();
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ confirmMult(e) {
|
|
|
|
+ this.$set(this.problemList[this.problemListIndex], "isCompleted", true);
|
|
|
|
+ if (
|
|
|
|
+ JSON.stringify(
|
|
|
|
+ this.problemList[this.problemListIndex].answer.split("-").sort()
|
|
|
|
+ ) ===
|
|
|
|
+ JSON.stringify(
|
|
|
|
+ this.problemList[this.problemListIndex].userAnswer.sort()
|
|
|
|
+ )
|
|
|
|
+ ) {
|
|
|
|
+ this.trueNum++;
|
|
|
|
+ } else {
|
|
|
|
+ this.falseNum++;
|
|
|
|
+ }
|
|
|
|
+ // this.problemList[this.problemListIndex]
|
|
|
|
+ },
|
|
|
|
+ changeCheckGroup(e) {
|
|
|
|
+ //console.log(e);
|
|
|
|
+ // this.$set()
|
|
|
|
+ this.$set(
|
|
|
|
+ this.problemList[this.problemListIndex],
|
|
|
|
+ "userAnswer",
|
|
|
|
+ e.detail
|
|
|
|
+ );
|
|
|
|
+ this.problemList[this.problemListIndex].optsArr.forEach((item) => {
|
|
|
|
+ if (e.detail.includes(item.value)) {
|
|
|
|
+ item.selected = true;
|
|
|
|
+ } else {
|
|
|
|
+ item.selected = false;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
changeRadioGroup(e) {
|
|
changeRadioGroup(e) {
|
|
- // console.log(e);
|
|
|
|
|
|
+ console.log(e);
|
|
this.$set(this.problemList[this.problemListIndex], "isCompleted", true);
|
|
this.$set(this.problemList[this.problemListIndex], "isCompleted", true);
|
|
this.$set(
|
|
this.$set(
|
|
this.problemList[this.problemListIndex],
|
|
this.problemList[this.problemListIndex],
|
|
"userAnswer",
|
|
"userAnswer",
|
|
|
|
+ e.detail.value
|
|
|
|
+ );
|
|
|
|
+ e.detail.selected = true;
|
|
|
|
+ this.$set(
|
|
|
|
+ this.problemList[this.problemListIndex].optsArr,
|
|
|
|
+ e.detail.index,
|
|
e.detail
|
|
e.detail
|
|
);
|
|
);
|
|
|
|
+ e.detail.value === this.problemList[this.problemListIndex].answer
|
|
|
|
+ ? (this.trueNum = this.trueNum + 1)
|
|
|
|
+ : (this.falseNum = this.falseNum + 1);
|
|
|
|
+ // this.problemList[this.problemListIndex].optsArr
|
|
},
|
|
},
|
|
changeCheckbox(e) {
|
|
changeCheckbox(e) {
|
|
- console.log(e);
|
|
|
|
|
|
+ // console.log(e);
|
|
},
|
|
},
|
|
numberToLetter(index) {
|
|
numberToLetter(index) {
|
|
index = Number(index);
|
|
index = Number(index);
|
|
@@ -384,9 +506,26 @@ export default {
|
|
})
|
|
})
|
|
.then((res) => {
|
|
.then((res) => {
|
|
res.rows.forEach((element) => {
|
|
res.rows.forEach((element) => {
|
|
- element.optsArr = element.opts.split("-");
|
|
|
|
|
|
+ element.optsArr = [];
|
|
|
|
+ element.opts.split("-").forEach((item, index) => {
|
|
|
|
+ if (element.questionType == 3) {
|
|
|
|
+ element.optsArr.push({
|
|
|
|
+ selected: false,
|
|
|
|
+ value: item,
|
|
|
|
+ index: index,
|
|
|
|
+ isAnswer: element.answer.split("-").includes(item),
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ element.optsArr.push({
|
|
|
|
+ selected: false,
|
|
|
|
+ value: item,
|
|
|
|
+ index: index,
|
|
|
|
+ isAnswer: item === element.answer,
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
element.isCompleted = false;
|
|
element.isCompleted = false;
|
|
- element.userAnswer = "";
|
|
|
|
|
|
+ element.userAnswer = [];
|
|
});
|
|
});
|
|
that.problemListTotal = res.total;
|
|
that.problemListTotal = res.total;
|
|
that.problemList = res.rows;
|
|
that.problemList = res.rows;
|
|
@@ -413,6 +552,7 @@ export default {
|
|
|
|
|
|
components: {
|
|
components: {
|
|
navBar,
|
|
navBar,
|
|
|
|
+ explainJs
|
|
},
|
|
},
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|
|
@@ -423,6 +563,11 @@ export default {
|
|
height: 24rpx;
|
|
height: 24rpx;
|
|
background-color: #f2f3f5;
|
|
background-color: #f2f3f5;
|
|
}
|
|
}
|
|
|
|
+.flex-center {
|
|
|
|
+ display: flex;
|
|
|
|
+ justify-content: center;
|
|
|
|
+ width: 100%;
|
|
|
|
+}
|
|
|
|
|
|
.box {
|
|
.box {
|
|
width: 100%;
|
|
width: 100%;
|
|
@@ -469,6 +614,7 @@ export default {
|
|
}
|
|
}
|
|
.problem-box {
|
|
.problem-box {
|
|
padding: 15rpx;
|
|
padding: 15rpx;
|
|
|
|
+ padding-bottom: 50rpx;
|
|
background: #fff;
|
|
background: #fff;
|
|
/deep/ .van-checkbox {
|
|
/deep/ .van-checkbox {
|
|
padding-bottom: 15rpx;
|
|
padding-bottom: 15rpx;
|
|
@@ -503,8 +649,19 @@ export default {
|
|
background: #fff;
|
|
background: #fff;
|
|
box-shadow: 0px 4rpx 12rpx rgba(0, 0, 0, 0.16);
|
|
box-shadow: 0px 4rpx 12rpx rgba(0, 0, 0, 0.16);
|
|
}
|
|
}
|
|
|
|
+ .problem-op_green {
|
|
|
|
+ width: 75rpx;
|
|
|
|
+ height: 75rpx;
|
|
|
|
+ line-height: 75rpx;
|
|
|
|
+ border-radius: 50%;
|
|
|
|
+ text-align: center;
|
|
|
|
+ overflow: hidden;
|
|
|
|
+ background: #01c18d;
|
|
|
|
+
|
|
|
|
+ box-shadow: 0px 4rpx 12rpx rgba(0, 0, 0, 0.16);
|
|
|
|
+ }
|
|
.problem-opAnswer {
|
|
.problem-opAnswer {
|
|
- font-size: 40rpx;
|
|
|
|
|
|
+ font-size: 16px;
|
|
margin-left: 12rpx;
|
|
margin-left: 12rpx;
|
|
}
|
|
}
|
|
.problem-op_selected {
|
|
.problem-op_selected {
|