|
@@ -98,9 +98,7 @@
|
|
|
</view>
|
|
|
<view class="answer-item">
|
|
|
我的答案:
|
|
|
- <text class="answer-text">{{
|
|
|
- item.selectAns.map((i) => i.value).join("")
|
|
|
- }}</text>
|
|
|
+ <text class="answer-text">{{ item.selectAns.join("") }}</text>
|
|
|
</view>
|
|
|
<view
|
|
|
class="tip"
|
|
@@ -139,7 +137,7 @@
|
|
|
>
|
|
|
下一题
|
|
|
</button>
|
|
|
- <button v-if="parindex + 1 === total" @click="submit">交卷</button>
|
|
|
+ <button v-if="parindex + 1 === total" @click="examEnd">交卷</button>
|
|
|
</view>
|
|
|
</template>
|
|
|
</template>
|
|
@@ -296,17 +294,22 @@ const onBack = () =>
|
|
|
r = resolve;
|
|
|
});
|
|
|
|
|
|
+const examEnd = () => {
|
|
|
+ data.value = data.value.map((item) => {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ showResult: true,
|
|
|
+ isRight: isRight(
|
|
|
+ item.selectAns,
|
|
|
+ item.ansList.map((q) => q.label)
|
|
|
+ ),
|
|
|
+ };
|
|
|
+ });
|
|
|
+ emit("lookReport", data.value, submitter.value);
|
|
|
+};
|
|
|
const onClose = () => {
|
|
|
if (submitter.value.closeText !== "提交试卷") return r(true);
|
|
|
- data.value = data.value.map((item) => ({
|
|
|
- ...item,
|
|
|
- showResult: true,
|
|
|
- isRight: isRight(
|
|
|
- item.selectAns.map((q) => q.value),
|
|
|
- item.ansList.map((q) => q.label)
|
|
|
- ),
|
|
|
- }));
|
|
|
- emit("lookReport", data.value, submitter.value);
|
|
|
+ examEnd();
|
|
|
};
|
|
|
const onSubmit = () =>
|
|
|
new Promise((res) => {
|
|
@@ -317,7 +320,8 @@ const nowIndex = ref(0);
|
|
|
|
|
|
// 判断答案是否正确
|
|
|
const isRight = (selectAns, rightAns) => {
|
|
|
- return rightAns.every((item) => selectAns.includes(item));
|
|
|
+ if (!selectAns.length) return;
|
|
|
+ return selectAns.every((item) => rightAns.includes(item));
|
|
|
};
|
|
|
|
|
|
const handleSelect = ({ pid, checked, index, style }) => {
|