|
@@ -7,11 +7,7 @@
|
|
|
:statusBar="true"
|
|
|
:title="examData.examName"
|
|
|
></uni-nav-bar>
|
|
|
- <swiper
|
|
|
- class="swiper"
|
|
|
- :current="current"
|
|
|
- @change="swiperChange"
|
|
|
- >
|
|
|
+ <swiper class="swiper" :current="current" @change="swiperChange">
|
|
|
<swiper-item v-for="(bank, bankIndex) in questionList" :key="bankIndex">
|
|
|
<view class="pageContent">
|
|
|
<view class="pad_8 titBox">
|
|
@@ -67,11 +63,14 @@
|
|
|
<text
|
|
|
:class="{
|
|
|
right:
|
|
|
- bankType == 1 && (item.optionsId == bank.ques ||
|
|
|
- item.optionsId == bank.ans),
|
|
|
+ bankType == 1 &&
|
|
|
+ (item.optionsId == bank.ques ||
|
|
|
+ item.optionsId == bank.ans),
|
|
|
wrong:
|
|
|
- bankType == 1 && item.optionsId == bank.ques && bank.ques != bank.ans,
|
|
|
- user_choose: bankType == 2 && (item.optionsId == bank.ques),
|
|
|
+ bankType == 1 &&
|
|
|
+ item.optionsId == bank.ques &&
|
|
|
+ bank.ques != bank.ans,
|
|
|
+ user_choose: bankType == 2 && item.optionsId == bank.ques,
|
|
|
}"
|
|
|
class="activeTI"
|
|
|
>
|
|
@@ -138,11 +137,13 @@
|
|
|
<text
|
|
|
:class="{
|
|
|
right:
|
|
|
- bankType == 1 && (bank.ques.indexOf(item.optionsId) != -1 ||
|
|
|
- bank.ans.indexOf(item.optionsId) != -1),
|
|
|
+ bankType == 1 &&
|
|
|
+ (bank.ques.indexOf(item.optionsId) != -1 ||
|
|
|
+ bank.ans.indexOf(item.optionsId) != -1),
|
|
|
wrong:
|
|
|
- bankType == 1 && (bank.ques.indexOf(item.optionsId) != -1 &&
|
|
|
- bank.ans.indexOf(item.optionsId) == -1),
|
|
|
+ bankType == 1 &&
|
|
|
+ bank.ques.indexOf(item.optionsId) != -1 &&
|
|
|
+ bank.ans.indexOf(item.optionsId) == -1,
|
|
|
user_choose: bankType == 2 && item.checked,
|
|
|
}"
|
|
|
class="activeTI"
|
|
@@ -226,14 +227,21 @@
|
|
|
class="lisSty"
|
|
|
@click="judgeSelect(index, bankIndex)"
|
|
|
>
|
|
|
- <!-- right: bankType == 1 && (index == bank.ques || index == bank.ans),
|
|
|
+ <!-- right: bankType == 1 && (index == bank.ques || index == bank.ans),
|
|
|
wrong: bankType == 1 && (index == bank.ques && bank.ques != bank.ans),
|
|
|
user_choose: bankType == 2 && (index == bank.ques), -->
|
|
|
<text
|
|
|
:class="{
|
|
|
- right: bankType == 1 && (index == (bank.ques == 1 ? 0 : 1) || index != bank.ans),
|
|
|
- wrong: bankType == 1 && (index == (bank.ques == 1 ? 0 : 1) && bank.ques != bank.ans),
|
|
|
- user_choose: bankType == 2 && (index == (bank.ques == 1 ? 0 : 1)),
|
|
|
+ right:
|
|
|
+ bankType == 1 &&
|
|
|
+ (index == (bank.ques == 1 ? 0 : 1) ||
|
|
|
+ index != bank.ans),
|
|
|
+ wrong:
|
|
|
+ bankType == 1 &&
|
|
|
+ index == (bank.ques == 1 ? 0 : 1) &&
|
|
|
+ bank.ques != bank.ans,
|
|
|
+ user_choose:
|
|
|
+ bankType == 2 && index == (bank.ques == 1 ? 0 : 1),
|
|
|
}"
|
|
|
class="activeTI"
|
|
|
>
|
|
@@ -273,8 +281,10 @@
|
|
|
<view
|
|
|
class="ans_input"
|
|
|
v-if="
|
|
|
- bankType == 2 || (bankType == 1 && (!bank.ques ||
|
|
|
- (!bank.ques.imageList.length && !bank.ques.text)))
|
|
|
+ bankType == 2 ||
|
|
|
+ (bankType == 1 &&
|
|
|
+ (!bank.ques ||
|
|
|
+ (!bank.ques.imageList.length && !bank.ques.text)))
|
|
|
"
|
|
|
>
|
|
|
<view class="top flex">
|
|
@@ -315,7 +325,9 @@
|
|
|
<view
|
|
|
class="ans_submit answerInfos"
|
|
|
v-if="
|
|
|
- bankType == 1 && bank.ques && (bank.ques.imageList.length || bank.ques.text)
|
|
|
+ bankType == 1 &&
|
|
|
+ bank.ques &&
|
|
|
+ (bank.ques.imageList.length || bank.ques.text)
|
|
|
"
|
|
|
>
|
|
|
<view class="answerTitle">我的答案:</view>
|
|
@@ -333,7 +345,11 @@
|
|
|
</view>
|
|
|
|
|
|
<view
|
|
|
- v-if="bankType == 1 && bank.ques && (bank.ques.imageList.length || bank.ques.text)"
|
|
|
+ v-if="
|
|
|
+ bankType == 1 &&
|
|
|
+ bank.ques &&
|
|
|
+ (bank.ques.imageList.length || bank.ques.text)
|
|
|
+ "
|
|
|
>
|
|
|
<view class="pad_8 answerInfos">
|
|
|
<view class="answerTitle">答案解析:</view>
|
|
@@ -410,12 +426,16 @@
|
|
|
<text
|
|
|
:class="{
|
|
|
right:
|
|
|
- bankType == 1 && (option.optionsId == bank.ques[ansIndex] ||
|
|
|
- option.optionsId == bank.ans[ansIndex]),
|
|
|
+ bankType == 1 &&
|
|
|
+ (option.optionsId == bank.ques[ansIndex] ||
|
|
|
+ option.optionsId == bank.ans[ansIndex]),
|
|
|
wrong:
|
|
|
- bankType == 1 && (option.optionsId == bank.ques[ansIndex] &&
|
|
|
- bank.ques[ansIndex] != bank.ans[ansIndex]),
|
|
|
- user_choose: bankType == 2 && (item.optionsId == bank.ques[ansIndex]),
|
|
|
+ bankType == 1 &&
|
|
|
+ option.optionsId == bank.ques[ansIndex] &&
|
|
|
+ bank.ques[ansIndex] != bank.ans[ansIndex],
|
|
|
+ user_choose:
|
|
|
+ bankType == 2 &&
|
|
|
+ item.optionsId == bank.ques[ansIndex],
|
|
|
}"
|
|
|
class="activeTI"
|
|
|
>
|
|
@@ -486,7 +506,9 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<view
|
|
|
- v-if="bankType == 2 || (bankType == 1 && !bank.ques[ansIndex])"
|
|
|
+ v-if="
|
|
|
+ bankType == 2 || (bankType == 1 && !bank.ques[ansIndex])
|
|
|
+ "
|
|
|
class="submit_checkbox"
|
|
|
:class="{
|
|
|
disabled: !isCheckboxChecked(ansItem.optionsList),
|
|
@@ -505,9 +527,11 @@
|
|
|
>
|
|
|
<text
|
|
|
:class="{
|
|
|
- right: bankType == 1 && right(bankIndex, ansIndex, option),
|
|
|
- wrong: bankType == 1 && wrong(bankIndex, ansIndex, option),
|
|
|
- user_choose: bankType == 2 && option.checked,
|
|
|
+ right:
|
|
|
+ bankType == 1 && right(bankIndex, ansIndex, option),
|
|
|
+ wrong:
|
|
|
+ bankType == 1 && wrong(bankIndex, ansIndex, option),
|
|
|
+ user_choose: bankType == 2 && option.checked,
|
|
|
}"
|
|
|
class="activeTI"
|
|
|
>
|
|
@@ -594,12 +618,16 @@
|
|
|
<text
|
|
|
:class="{
|
|
|
right:
|
|
|
- bankType == 1 && (childindex == (bank.ques[ansIndex] == 1 ? 0 : 1) ||
|
|
|
- childindex != bank.ans[ansIndex]),
|
|
|
+ bankType == 1 &&
|
|
|
+ (childindex == (bank.ques[ansIndex] == 1 ? 0 : 1) ||
|
|
|
+ childindex != bank.ans[ansIndex]),
|
|
|
wrong:
|
|
|
- bankType == 1 && (childindex == (bank.ques[ansIndex] == 1 ? 0 : 1) &&
|
|
|
- bank.ques[ansIndex] != bank.ans[ansIndex]),
|
|
|
- user_choose: bankType == 2 && (childindex == (bank.ques[ansIndex] == 1 ? 0 : 1)),
|
|
|
+ bankType == 1 &&
|
|
|
+ childindex == (bank.ques[ansIndex] == 1 ? 0 : 1) &&
|
|
|
+ bank.ques[ansIndex] != bank.ans[ansIndex],
|
|
|
+ user_choose:
|
|
|
+ bankType == 2 &&
|
|
|
+ childindex == (bank.ques[ansIndex] == 1 ? 0 : 1),
|
|
|
}"
|
|
|
class="activeTI"
|
|
|
>
|
|
@@ -620,8 +648,16 @@
|
|
|
</view>
|
|
|
<view v-if="bankType == 1 && bank.ques[ansIndex]">
|
|
|
<view class="pad_8 answer">
|
|
|
- <view>题目答案:{{ ast[bank.ans[ansIndex] == 1 ? 0 : 1] }}</view>
|
|
|
- <view>我的答案:{{ ast[bank.ques[ansIndex] == 1 ? 0 : 1] }}</view>
|
|
|
+ <view
|
|
|
+ >题目答案:{{
|
|
|
+ ast[bank.ans[ansIndex] == 1 ? 0 : 1]
|
|
|
+ }}</view
|
|
|
+ >
|
|
|
+ <view
|
|
|
+ >我的答案:{{
|
|
|
+ ast[bank.ques[ansIndex] == 1 ? 0 : 1]
|
|
|
+ }}</view
|
|
|
+ >
|
|
|
</view>
|
|
|
<view class="pad_8 answerInfos">
|
|
|
<view class="answerTitle">答案解析</view>
|
|
@@ -647,10 +683,11 @@
|
|
|
<view
|
|
|
class="ans_input"
|
|
|
v-if="
|
|
|
- bankType == 2 || (bankType == 1 &&
|
|
|
- (!bank.ques[ansIndex] ||
|
|
|
- (!bank.ques[ansIndex].text &&
|
|
|
- !bank.ques[ansIndex].imageList.length)))
|
|
|
+ bankType == 2 ||
|
|
|
+ (bankType == 1 &&
|
|
|
+ (!bank.ques[ansIndex] ||
|
|
|
+ (!bank.ques[ansIndex].text &&
|
|
|
+ !bank.ques[ansIndex].imageList.length)))
|
|
|
"
|
|
|
>
|
|
|
<view class="top flex">
|
|
@@ -697,7 +734,8 @@
|
|
|
<view
|
|
|
class="ans_submit answerInfos"
|
|
|
v-if="
|
|
|
- bankType == 1 && bank.ques[ansIndex] &&
|
|
|
+ bankType == 1 &&
|
|
|
+ bank.ques[ansIndex] &&
|
|
|
(bank.ques[ansIndex].imageList.length ||
|
|
|
bank.ques[ansIndex].text)
|
|
|
"
|
|
@@ -718,8 +756,9 @@
|
|
|
</view>
|
|
|
<view
|
|
|
v-if="
|
|
|
- bankType == 1 && (bank.ques[ansIndex].imageList.length ||
|
|
|
- bank.ques[ansIndex].text)
|
|
|
+ bankType == 1 &&
|
|
|
+ (bank.ques[ansIndex].imageList.length ||
|
|
|
+ bank.ques[ansIndex].text)
|
|
|
"
|
|
|
>
|
|
|
<view class="pad_8 answerInfos">
|
|
@@ -918,13 +957,14 @@ export default {
|
|
|
orderGoodsId: "",
|
|
|
cgType: 0, //对应设计稿弹窗编码
|
|
|
// courseId: '',
|
|
|
- entryType: '', // 进入做题页面的入口类型,daily-每日一练进来,random-随机练习, 其他的-题库做题进入
|
|
|
+ entryType: "", // 进入做题页面的入口类型,daily-每日一练进来,random-随机练习, 其他的-题库做题进入
|
|
|
bankNum: 5, // 随机练习的题目数量
|
|
|
+ simulateExamId: undefined,
|
|
|
};
|
|
|
},
|
|
|
async onLoad(option) {
|
|
|
- this.entryType = option.entryType || ''
|
|
|
- this.bankNum = option.bankNum
|
|
|
+ this.entryType = option.entryType || "";
|
|
|
+ this.bankNum = option.bankNum;
|
|
|
// this.courseId = option.courseId || ''
|
|
|
this.orderGoodsId = option.orderGoodsId || 0;
|
|
|
this.current = +option.current || 0;
|
|
@@ -971,15 +1011,15 @@ export default {
|
|
|
this.lastTime--;
|
|
|
}, 1000);
|
|
|
} else {
|
|
|
- if (this.entryType == 'random') {
|
|
|
- this.bankType = 1 // 随机练习全部都是练习类型
|
|
|
- this.randomQuestionList()
|
|
|
+ if (this.entryType == "random") {
|
|
|
+ this.bankType = 1; // 随机练习全部都是练习类型
|
|
|
+ this.randomQuestionList();
|
|
|
} else {
|
|
|
- //进入页面
|
|
|
- await this.bankExam();
|
|
|
- // 请求题目列表
|
|
|
- this.goodsQuestionList();
|
|
|
- }
|
|
|
+ //进入页面
|
|
|
+ await this.bankExam();
|
|
|
+ // 请求题目列表
|
|
|
+ this.goodsQuestionList();
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
onUnload() {
|
|
@@ -1022,8 +1062,9 @@ export default {
|
|
|
bankExam() {
|
|
|
return new Promise((resolve) => {
|
|
|
this.$api.bankExam(this.id).then((res) => {
|
|
|
- if (this.entryType == 'daily') { // 每日一练类型都是为练习
|
|
|
- this.bankType = 1
|
|
|
+ if (this.entryType == "daily") {
|
|
|
+ // 每日一练类型都是为练习
|
|
|
+ this.bankType = 1;
|
|
|
} else {
|
|
|
this.bankType = res.data.data.doType;
|
|
|
}
|
|
@@ -1332,7 +1373,7 @@ export default {
|
|
|
.then((res) => {
|
|
|
this.isSubmit = true;
|
|
|
if (res.data.code == 200) {
|
|
|
- this.entryType == 'daily' && this.dailyExam()
|
|
|
+ this.entryType == "daily" && this.dailyExam();
|
|
|
}
|
|
|
});
|
|
|
|
|
@@ -1347,7 +1388,7 @@ export default {
|
|
|
questionIds: doWrongQuestionIds,
|
|
|
recordId: this.recordId,
|
|
|
type: 1, // 题库试卷传1
|
|
|
- doMode: this.entryType == 'random' ? 2 : 1, // 做题模式 1章卷 2随机练习
|
|
|
+ doMode: this.doMode,
|
|
|
})
|
|
|
.then((res) => {});
|
|
|
},
|
|
@@ -1474,7 +1515,7 @@ export default {
|
|
|
})
|
|
|
.then((res) => {
|
|
|
if (res.data.code == 200) {
|
|
|
- this.entryType == 'daily' && this.dailyExam()
|
|
|
+ this.entryType == "daily" && this.dailyExam();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@@ -1504,9 +1545,8 @@ export default {
|
|
|
goodsId: this.goodsId,
|
|
|
totalQuestionNum: questionList,
|
|
|
allQuestionNum: this.questionList.length,
|
|
|
- doMode: this.entryType == 'random' ? 2 : 1, // 做题模式 1章卷 2随机练习
|
|
|
- // courseId: this.courseId,
|
|
|
- // type: ''
|
|
|
+ doMode: this.doMode,
|
|
|
+ simulateExamId: this.simulateExamId,
|
|
|
})
|
|
|
.then((res) => {
|
|
|
this.recordId = res.data.data;
|
|
@@ -1541,17 +1581,17 @@ export default {
|
|
|
// 请求随机练习题目列表
|
|
|
randomQuestionList() {
|
|
|
this.$http({
|
|
|
- url: '/bank/exam/temp',
|
|
|
- method: 'post',
|
|
|
+ url: "/bank/exam/temp",
|
|
|
+ method: "post",
|
|
|
data: {
|
|
|
goodsId: this.goodsId,
|
|
|
orderGoodsId: this.orderGoodsId,
|
|
|
- number: this.bankNum
|
|
|
- }
|
|
|
+ number: this.bankNum,
|
|
|
+ },
|
|
|
}).then((res) => {
|
|
|
- if(res.data.code == 200) {
|
|
|
- this.examData = res.data.data || {}
|
|
|
- this.id = this.examData.examId
|
|
|
+ if (res.data.code == 200) {
|
|
|
+ this.examData = res.data.data || {};
|
|
|
+ this.id = this.examData.examId;
|
|
|
if (!this.examData.questionList.length) {
|
|
|
this.hideDialog();
|
|
|
uni.showModal({
|
|
@@ -1566,196 +1606,202 @@ export default {
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
- this.dataAnlyze(this.examData.questionList || [])
|
|
|
+ this.dataAnlyze(this.examData.questionList || []);
|
|
|
} else {
|
|
|
- this.$u.toast(res.data.msg)
|
|
|
+ this.$u.toast(res.data.msg);
|
|
|
setTimeout(() => {
|
|
|
- uni.navigateBack()
|
|
|
- }, 2000)
|
|
|
+ uni.navigateBack();
|
|
|
+ }, 2000);
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
},
|
|
|
/**
|
|
|
* 请求题目列表 app/common/bank/question/list
|
|
|
*/
|
|
|
goodsQuestionList() {
|
|
|
- this.$api
|
|
|
- .goodsQuestionList({
|
|
|
- examId: this.id,
|
|
|
- })
|
|
|
- .then((res) => {
|
|
|
- if (!res.data.data.length) {
|
|
|
- this.hideDialog();
|
|
|
- uni.showModal({
|
|
|
- showCancel: false,
|
|
|
- content: "该试卷暂无题目",
|
|
|
- success: (k) => {
|
|
|
- if (k.confirm) {
|
|
|
- this.isSubmit = true;
|
|
|
- uni.navigateBack();
|
|
|
- }
|
|
|
- },
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
- this.allTimes = res.data.data[0].answerTime * 60;
|
|
|
- this.lastTime =
|
|
|
- res.data.data[0].answerTime && res.data.data[0].answerTime * 60;
|
|
|
- //考试时间到了自动交卷
|
|
|
- if (this.lastTime) {
|
|
|
- this.timer = setInterval(() => {
|
|
|
- if (this.lastTime <= 0) {
|
|
|
- clearInterval(this.timer);
|
|
|
- uni.showToast({
|
|
|
- icon: "none",
|
|
|
- mask: true,
|
|
|
- title: "考试时间已到,系统将自动交卷",
|
|
|
- duration: 10000,
|
|
|
- });
|
|
|
-
|
|
|
- this.submit();
|
|
|
- return;
|
|
|
+ this.$api[
|
|
|
+ this.doMode == 3 ? "goodsRandomQuestionList" : "goodsQuestionList"
|
|
|
+ ]({
|
|
|
+ examId: this.id,
|
|
|
+ goodsId: this.goodsId,
|
|
|
+ orderGoodsId: this.orderGoodsId,
|
|
|
+ }).then((res) => {
|
|
|
+ let data = res.data.data;
|
|
|
+ if (this.doMode == 3) {
|
|
|
+ this.simulateExamId = data.simulateExamId;
|
|
|
+ data = data.questionList;
|
|
|
+ }
|
|
|
+ if (!data.length) {
|
|
|
+ this.hideDialog();
|
|
|
+ uni.showModal({
|
|
|
+ showCancel: false,
|
|
|
+ content: "该试卷暂无题目",
|
|
|
+ success: (k) => {
|
|
|
+ if (k.confirm) {
|
|
|
+ this.isSubmit = true;
|
|
|
+ uni.navigateBack();
|
|
|
}
|
|
|
- this.lastTime--;
|
|
|
- }, 1000);
|
|
|
- } else {
|
|
|
- }
|
|
|
- this.dataAnlyze(res.data.data)
|
|
|
- });
|
|
|
+ },
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.allTimes = data[0].answerTime * 60;
|
|
|
+ this.lastTime = data[0].answerTime && data[0].answerTime * 60;
|
|
|
+ //考试时间到了自动交卷
|
|
|
+ if (this.lastTime) {
|
|
|
+ this.timer = setInterval(() => {
|
|
|
+ if (this.lastTime <= 0) {
|
|
|
+ clearInterval(this.timer);
|
|
|
+ uni.showToast({
|
|
|
+ icon: "none",
|
|
|
+ mask: true,
|
|
|
+ title: "考试时间已到,系统将自动交卷",
|
|
|
+ duration: 10000,
|
|
|
+ });
|
|
|
+
|
|
|
+ this.submit();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.lastTime--;
|
|
|
+ }, 1000);
|
|
|
+ } else {
|
|
|
+ }
|
|
|
+ this.dataAnlyze(data);
|
|
|
+ });
|
|
|
},
|
|
|
dataAnlyze(datas = []) {
|
|
|
- console.log('datas:', datas)
|
|
|
+ console.log("datas:", datas);
|
|
|
datas.forEach((item, index) => {
|
|
|
- // if (typeof item.jsonStr == 'string') {
|
|
|
- item.jsonStr = JSON.parse(item.jsonStr);
|
|
|
+ // if (typeof item.jsonStr == 'string') {
|
|
|
+ item.jsonStr = JSON.parse(item.jsonStr);
|
|
|
+
|
|
|
+ if (item.type == 2) {
|
|
|
+ //多选
|
|
|
+ item.jsonStr.forEach((str) => {
|
|
|
+ str.optionsId = "" + str.optionsId;
|
|
|
+ });
|
|
|
+ let arr = item.answerQuestion.split(",");
|
|
|
+ arr.forEach((a, i) => {
|
|
|
+ arr[i] = "" + a;
|
|
|
+ });
|
|
|
+ item.ans = arr;
|
|
|
+ item.analysisContent &&
|
|
|
+ (item.analysisContent = item.analysisContent.replace(
|
|
|
+ /<img/gi,
|
|
|
+ '<img style="max-width:100%;"'
|
|
|
+ ));
|
|
|
+ item.content &&
|
|
|
+ (item.content = item.content.replace(
|
|
|
+ /<img/gi,
|
|
|
+ '<img style="max-width:100%;"'
|
|
|
+ ));
|
|
|
+ return;
|
|
|
+ } else if (item.type == 5) {
|
|
|
+ //简答题
|
|
|
+ item.ansText = {
|
|
|
+ text: "",
|
|
|
+ imageList: [],
|
|
|
+ };
|
|
|
+
|
|
|
+ item.ques = {
|
|
|
+ text: "",
|
|
|
+ imageList: [],
|
|
|
+ };
|
|
|
+ item.analysisContent &&
|
|
|
+ (item.analysisContent = item.analysisContent.replace(
|
|
|
+ /<img/gi,
|
|
|
+ '<img style="max-width:100%;"'
|
|
|
+ ));
|
|
|
+ item.content &&
|
|
|
+ (item.content = item.content.replace(
|
|
|
+ /<img/gi,
|
|
|
+ '<img style="max-width:100%;"'
|
|
|
+ ));
|
|
|
+ } else if (item.type == 4) {
|
|
|
+ //案例题
|
|
|
|
|
|
- if (item.type == 2) {
|
|
|
- //多选
|
|
|
- item.jsonStr.forEach((str) => {
|
|
|
+ item.ques = [];
|
|
|
+ item.current = 0;
|
|
|
+ let ansArr = [];
|
|
|
+ item.jsonStr.forEach((json, index) => {
|
|
|
+ if (json.type == 1) {
|
|
|
+ ansArr[index] = json.answerQuestion;
|
|
|
+ json.content &&
|
|
|
+ (json.content = json.content.replace(
|
|
|
+ /<img/gi,
|
|
|
+ '<img style="max-width:100%;"'
|
|
|
+ ));
|
|
|
+ } else if (json.type == 2) {
|
|
|
+ json.optionsList.forEach((str) => {
|
|
|
str.optionsId = "" + str.optionsId;
|
|
|
});
|
|
|
- let arr = item.answerQuestion.split(",");
|
|
|
+ let arr = json.answerQuestion.split(",");
|
|
|
arr.forEach((a, i) => {
|
|
|
arr[i] = "" + a;
|
|
|
});
|
|
|
- item.ans = arr;
|
|
|
- item.analysisContent &&
|
|
|
- (item.analysisContent = item.analysisContent.replace(
|
|
|
+ ansArr[index] = arr;
|
|
|
+ json.content &&
|
|
|
+ (json.content = json.content.replace(
|
|
|
/<img/gi,
|
|
|
'<img style="max-width:100%;"'
|
|
|
));
|
|
|
- item.content &&
|
|
|
- (item.content = item.content.replace(
|
|
|
+ } else if (json.type == 3) {
|
|
|
+ ansArr[index] = json.answerQuestion;
|
|
|
+ json.content &&
|
|
|
+ (json.content = json.content.replace(
|
|
|
/<img/gi,
|
|
|
'<img style="max-width:100%;"'
|
|
|
));
|
|
|
- return;
|
|
|
- } else if (item.type == 5) {
|
|
|
- //简答题
|
|
|
- item.ansText = {
|
|
|
- text: "",
|
|
|
+ } else if (json.type == 5) {
|
|
|
+ ansArr[index] = {
|
|
|
+ text: json.answerQuestion,
|
|
|
imageList: [],
|
|
|
};
|
|
|
-
|
|
|
- item.ques = {
|
|
|
+ json.ansText = {
|
|
|
text: "",
|
|
|
imageList: [],
|
|
|
};
|
|
|
- item.analysisContent &&
|
|
|
- (item.analysisContent = item.analysisContent.replace(
|
|
|
- /<img/gi,
|
|
|
- '<img style="max-width:100%;"'
|
|
|
- ));
|
|
|
- item.content &&
|
|
|
- (item.content = item.content.replace(
|
|
|
- /<img/gi,
|
|
|
- '<img style="max-width:100%;"'
|
|
|
- ));
|
|
|
- } else if (item.type == 4) {
|
|
|
- //案例题
|
|
|
-
|
|
|
- item.ques = [];
|
|
|
- item.current = 0;
|
|
|
- let ansArr = [];
|
|
|
- item.jsonStr.forEach((json, index) => {
|
|
|
- if (json.type == 1) {
|
|
|
- ansArr[index] = json.answerQuestion;
|
|
|
- json.content &&
|
|
|
- (json.content = json.content.replace(
|
|
|
- /<img/gi,
|
|
|
- '<img style="max-width:100%;"'
|
|
|
- ));
|
|
|
- } else if (json.type == 2) {
|
|
|
- json.optionsList.forEach((str) => {
|
|
|
- str.optionsId = "" + str.optionsId;
|
|
|
- });
|
|
|
- let arr = json.answerQuestion.split(",");
|
|
|
- arr.forEach((a, i) => {
|
|
|
- arr[i] = "" + a;
|
|
|
- });
|
|
|
- ansArr[index] = arr;
|
|
|
- json.content &&
|
|
|
- (json.content = json.content.replace(
|
|
|
- /<img/gi,
|
|
|
- '<img style="max-width:100%;"'
|
|
|
- ));
|
|
|
- } else if (json.type == 3) {
|
|
|
- ansArr[index] = json.answerQuestion;
|
|
|
- json.content &&
|
|
|
- (json.content = json.content.replace(
|
|
|
- /<img/gi,
|
|
|
- '<img style="max-width:100%;"'
|
|
|
- ));
|
|
|
- } else if (json.type == 5) {
|
|
|
- ansArr[index] = {
|
|
|
- text: json.answerQuestion,
|
|
|
- imageList: [],
|
|
|
- };
|
|
|
- json.ansText = {
|
|
|
- text: "",
|
|
|
- imageList: [],
|
|
|
- };
|
|
|
- json.content &&
|
|
|
- (json.content = json.content.replace(
|
|
|
- /<img/gi,
|
|
|
- '<img style="max-width:100%;"'
|
|
|
- ));
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- item.analysisContent &&
|
|
|
- (item.analysisContent = item.analysisContent.replace(
|
|
|
- /<img/gi,
|
|
|
- '<img style="max-width:100%;"'
|
|
|
- ));
|
|
|
- item.content &&
|
|
|
- (item.content = item.content.replace(
|
|
|
+ json.content &&
|
|
|
+ (json.content = json.content.replace(
|
|
|
/<img/gi,
|
|
|
'<img style="max-width:100%;"'
|
|
|
));
|
|
|
- item.ans = ansArr;
|
|
|
- return;
|
|
|
}
|
|
|
-
|
|
|
- item.analysisContent &&
|
|
|
- (item.analysisContent = item.analysisContent.replace(
|
|
|
- /<img/gi,
|
|
|
- '<img style="max-width:100%;"'
|
|
|
- ));
|
|
|
- item.content &&
|
|
|
- (item.content = item.content.replace(
|
|
|
- /<img/gi,
|
|
|
- '<img style="max-width:100%;"'
|
|
|
- ));
|
|
|
- item.ans = item.answerQuestion;
|
|
|
- // }
|
|
|
});
|
|
|
|
|
|
- this.questionList = datas;
|
|
|
+ item.analysisContent &&
|
|
|
+ (item.analysisContent = item.analysisContent.replace(
|
|
|
+ /<img/gi,
|
|
|
+ '<img style="max-width:100%;"'
|
|
|
+ ));
|
|
|
+ item.content &&
|
|
|
+ (item.content = item.content.replace(
|
|
|
+ /<img/gi,
|
|
|
+ '<img style="max-width:100%;"'
|
|
|
+ ));
|
|
|
+ item.ans = ansArr;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ item.analysisContent &&
|
|
|
+ (item.analysisContent = item.analysisContent.replace(
|
|
|
+ /<img/gi,
|
|
|
+ '<img style="max-width:100%;"'
|
|
|
+ ));
|
|
|
+ item.content &&
|
|
|
+ (item.content = item.content.replace(
|
|
|
+ /<img/gi,
|
|
|
+ '<img style="max-width:100%;"'
|
|
|
+ ));
|
|
|
+ item.ans = item.answerQuestion;
|
|
|
+ // }
|
|
|
+ });
|
|
|
+
|
|
|
+ this.questionList = datas;
|
|
|
|
|
|
- this.lastCount = this.questionList.length;
|
|
|
- this.examRecord();
|
|
|
- this.getCollectInfo(this.current);
|
|
|
+ this.lastCount = this.questionList.length;
|
|
|
+ this.examRecord();
|
|
|
+ this.getCollectInfo(this.current);
|
|
|
},
|
|
|
/**
|
|
|
* @param {Object} e单选点击
|
|
@@ -1763,7 +1809,7 @@ export default {
|
|
|
radioSelect(optionsId, bindex) {
|
|
|
// if (this.questionList[bindex].ques) return;
|
|
|
if (this.questionList[bindex].ques && this.bankType == 1) {
|
|
|
- return
|
|
|
+ return;
|
|
|
}
|
|
|
this.$set(this.questionList[bindex], "ques", optionsId);
|
|
|
// if ((bindex + 1) < this.questionList.length) {
|
|
@@ -1773,7 +1819,7 @@ export default {
|
|
|
|
|
|
// 回答错误
|
|
|
// if (this.questionList[bindex].ques != this.questionList[bindex].ans) {
|
|
|
- // // /exam/wwrong/record
|
|
|
+ // // /exam/wwrong/record
|
|
|
// this.$api
|
|
|
// .examWrongRecord({
|
|
|
// orderGoodsId: this.orderGoodsId,
|
|
@@ -1804,7 +1850,7 @@ export default {
|
|
|
radioSelectChild(optionsId, ansIndex, bindex) {
|
|
|
// if (this.questionList[bindex].ques[ansIndex]) return;
|
|
|
if (this.questionList[bindex].ques[ansIndex] && this.bankType == 1) {
|
|
|
- return
|
|
|
+ return;
|
|
|
}
|
|
|
this.$set(this.questionList[bindex].ques, ansIndex, optionsId);
|
|
|
this.isDoOver();
|
|
@@ -1815,7 +1861,7 @@ export default {
|
|
|
*/
|
|
|
checkboxSelect(optionsId, bindex, index) {
|
|
|
if (this.questionList[bindex].ques && this.bankType == 1) {
|
|
|
- return
|
|
|
+ return;
|
|
|
}
|
|
|
this.$set(
|
|
|
this.questionList[bindex].jsonStr[index],
|
|
@@ -1829,7 +1875,7 @@ export default {
|
|
|
*/
|
|
|
checkboxSelectChild(bindex, ansIndex, childIndex) {
|
|
|
if (this.questionList[bindex].ques[ansIndex] && this.bankType == 1) {
|
|
|
- return
|
|
|
+ return;
|
|
|
}
|
|
|
this.$set(
|
|
|
this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex],
|
|
@@ -1854,7 +1900,7 @@ export default {
|
|
|
// console.log('')
|
|
|
// if (this.questionList[bindex].ques) return;
|
|
|
if (this.questionList[bindex].ques && this.bankType == 1) {
|
|
|
- return
|
|
|
+ return;
|
|
|
}
|
|
|
let arr = [];
|
|
|
this.questionList[bindex].jsonStr.forEach((item) => {
|
|
@@ -1864,7 +1910,7 @@ export default {
|
|
|
});
|
|
|
|
|
|
if (!arr.length) {
|
|
|
- delete this.questionList[bindex].ques
|
|
|
+ delete this.questionList[bindex].ques;
|
|
|
uni.showToast({
|
|
|
title: "请选择答案",
|
|
|
icon: "none",
|
|
@@ -1873,7 +1919,7 @@ export default {
|
|
|
}
|
|
|
|
|
|
this.$set(this.questionList[bindex], "ques", arr);
|
|
|
- this.$u.toast('已确认答案')
|
|
|
+ this.$u.toast("已确认答案");
|
|
|
this.isDoOver();
|
|
|
|
|
|
// let isWrong = this.questionList[bindex].ques.some((item, i) => {
|
|
@@ -1911,7 +1957,7 @@ export default {
|
|
|
checkboxSubmitChild(bindex, ansIndex) {
|
|
|
// if (this.questionList[bindex].ques[ansIndex]) return;
|
|
|
if (this.questionList[bindex].ques[ansIndex] && this.bankType == 1) {
|
|
|
- return
|
|
|
+ return;
|
|
|
}
|
|
|
let arr = [];
|
|
|
this.questionList[bindex].jsonStr[ansIndex].optionsList.forEach(
|
|
@@ -1923,7 +1969,7 @@ export default {
|
|
|
);
|
|
|
|
|
|
if (!arr.length) {
|
|
|
- delete this.questionList[bindex].ques[ansIndex]
|
|
|
+ delete this.questionList[bindex].ques[ansIndex];
|
|
|
uni.showToast({
|
|
|
title: "请选择答案",
|
|
|
icon: "none",
|
|
@@ -1932,7 +1978,7 @@ export default {
|
|
|
}
|
|
|
|
|
|
this.$set(this.questionList[bindex].ques, ansIndex, arr);
|
|
|
- this.$u.toast('已确认答案')
|
|
|
+ this.$u.toast("已确认答案");
|
|
|
this.isDoOver();
|
|
|
},
|
|
|
|
|
@@ -1944,10 +1990,14 @@ export default {
|
|
|
judgeSelect(index, bindex) {
|
|
|
// if (this.questionList[bindex].ques) return;
|
|
|
if (this.questionList[bindex].ques && this.bankType == 1) {
|
|
|
- return
|
|
|
- }// 答案: 判断题1正确 0错误
|
|
|
- this.$set(this.questionList[bindex], "ques", index == 0 ? '1' : '0');
|
|
|
- console.log('this.questionList[bindex]:', this.questionList[bindex].ques, this.questionList[bindex].ans)
|
|
|
+ return;
|
|
|
+ } // 答案: 判断题1正确 0错误
|
|
|
+ this.$set(this.questionList[bindex], "ques", index == 0 ? "1" : "0");
|
|
|
+ console.log(
|
|
|
+ "this.questionList[bindex]:",
|
|
|
+ this.questionList[bindex].ques,
|
|
|
+ this.questionList[bindex].ans
|
|
|
+ );
|
|
|
this.isDoOver();
|
|
|
// 回答错误
|
|
|
// if (this.questionList[bindex].ques != this.questionList[bindex].ans) {
|
|
@@ -1984,9 +2034,13 @@ export default {
|
|
|
judgeSelectChild(ansindex, childindex, bindex) {
|
|
|
// if (this.questionList[bindex].ques[ansindex]) return;
|
|
|
if (this.questionList[bindex].ques[ansindex] && this.bankType == 1) {
|
|
|
- return
|
|
|
+ return;
|
|
|
}
|
|
|
- this.$set(this.questionList[bindex].ques, ansindex, childindex == 0 ? '1' : '0');
|
|
|
+ this.$set(
|
|
|
+ this.questionList[bindex].ques,
|
|
|
+ ansindex,
|
|
|
+ childindex == 0 ? "1" : "0"
|
|
|
+ );
|
|
|
this.isDoOver();
|
|
|
},
|
|
|
|
|
@@ -2225,7 +2279,7 @@ export default {
|
|
|
.then((res) => {
|
|
|
this.isSubmit = true;
|
|
|
if (res.data.code == 200) {
|
|
|
- this.entryType == 'daily' && this.dailyExam()
|
|
|
+ this.entryType == "daily" && this.dailyExam();
|
|
|
uni.showToast({
|
|
|
title: "交卷成功",
|
|
|
duration: 1000,
|
|
@@ -2246,7 +2300,11 @@ export default {
|
|
|
"&id=" +
|
|
|
this.recordId +
|
|
|
"&orderGoodsId=" +
|
|
|
- this.orderGoodsId + '&entryType=' + this.entryType + '&bankNum=' + this.bankNum,
|
|
|
+ this.orderGoodsId +
|
|
|
+ "&entryType=" +
|
|
|
+ this.entryType +
|
|
|
+ "&bankNum=" +
|
|
|
+ this.bankNum,
|
|
|
});
|
|
|
}, 1000);
|
|
|
}
|
|
@@ -2261,28 +2319,30 @@ export default {
|
|
|
questionIds: doWrongQuestionIds,
|
|
|
recordId: this.recordId,
|
|
|
type: 1, // 题库试卷传1
|
|
|
- doMode: this.entryType == 'random' ? 2 : 1, // 做题模式 1章卷 2随机练习
|
|
|
+ doMode: this.doMode,
|
|
|
})
|
|
|
.then((res) => {});
|
|
|
},
|
|
|
// 每日一练试卷打卡
|
|
|
dailyExam() {
|
|
|
- const dateStamp = parseInt(new Date(new Date().toLocaleDateString()).getTime()/1000)
|
|
|
+ const dateStamp = parseInt(
|
|
|
+ new Date(new Date().toLocaleDateString()).getTime() / 1000
|
|
|
+ );
|
|
|
this.$http({
|
|
|
- url: '/bank/question/special/exam/record',
|
|
|
- method: 'post',
|
|
|
+ url: "/bank/question/special/exam/record",
|
|
|
+ method: "post",
|
|
|
data: {
|
|
|
examId: this.id,
|
|
|
chapterExamId: this.chapterId, // 章卷ID
|
|
|
- moduleExamId: this.moduleId, //模块卷ID
|
|
|
+ moduleExamId: this.moduleId, //模块卷ID
|
|
|
goodsId: this.goodsId,
|
|
|
recordTime: dateStamp, // 传当天0点时间戳(秒)
|
|
|
- }
|
|
|
+ },
|
|
|
}).then((res) => {
|
|
|
if (res.data.code == 200) {
|
|
|
}
|
|
|
- })
|
|
|
- },
|
|
|
+ });
|
|
|
+ },
|
|
|
/**
|
|
|
* @param {Object} state
|
|
|
* @param {Object} index
|
|
@@ -2296,7 +2356,7 @@ export default {
|
|
|
questionId: this.questionList[index].questionId,
|
|
|
goodsId: this.goodsId || "",
|
|
|
orderGoodsId: this.orderGoodsId,
|
|
|
- doMode: this.entryType == 'random' ? 2 : 1, //做题模式 1章卷 2随机练习,只限题库,视频课程里面的不用传这个参数
|
|
|
+ doMode: this.doMode,
|
|
|
})
|
|
|
.then((res) => {
|
|
|
if (res.data.code == 200) {
|
|
@@ -2490,7 +2550,7 @@ export default {
|
|
|
},
|
|
|
success: (result) => {
|
|
|
// if (result.statusCode === 200) {
|
|
|
- resolve(ossToken.dir);
|
|
|
+ resolve(ossToken.dir);
|
|
|
// } else {
|
|
|
// uni.showToast({
|
|
|
// title: "上传失败",
|
|
@@ -2564,7 +2624,7 @@ export default {
|
|
|
},
|
|
|
isCheck(item, index) {
|
|
|
if (this.questionList[index].ques) {
|
|
|
- return true
|
|
|
+ return true;
|
|
|
}
|
|
|
},
|
|
|
isRight(item, index) {
|
|
@@ -2761,6 +2821,16 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ doMode() {
|
|
|
+ // 做题模式 1章卷 2随机练习 3模拟组卷
|
|
|
+ return this.examData.simulateStatus
|
|
|
+ ? 3
|
|
|
+ : this.entryType == "random"
|
|
|
+ ? 2
|
|
|
+ : 1;
|
|
|
+ },
|
|
|
+ },
|
|
|
};
|
|
|
</script>
|
|
|
|
|
@@ -2807,7 +2877,8 @@ export default {
|
|
|
background: #ff3b30;
|
|
|
}
|
|
|
|
|
|
- &.checked, &.user_choose {
|
|
|
+ &.checked,
|
|
|
+ &.user_choose {
|
|
|
color: #fff;
|
|
|
background: #007aff;
|
|
|
}
|