|
@@ -918,13 +918,15 @@ export default {
|
|
|
examData: {},
|
|
|
orderGoodsId: "",
|
|
|
cgType: 0, //对应设计稿弹窗编码
|
|
|
- courseId: '',
|
|
|
- entryType: '', // 进入做题页面的入口类型,daily-每日一练进来,其他的-题库做题进入
|
|
|
+ // courseId: '',
|
|
|
+ entryType: '', // 进入做题页面的入口类型,daily-每日一练进来,random-随机练习, 其他的-题库做题进入
|
|
|
+ bankNum: 5, // 随机练习的题目数量
|
|
|
};
|
|
|
},
|
|
|
async onLoad(option) {
|
|
|
this.entryType = option.entryType || ''
|
|
|
- this.courseId = option.courseId
|
|
|
+ this.bankNum = option.bankNum
|
|
|
+ // this.courseId = option.courseId || ''
|
|
|
this.orderGoodsId = option.orderGoodsId || 0;
|
|
|
this.current = +option.current || 0;
|
|
|
this.id = option.id;
|
|
@@ -970,11 +972,16 @@ export default {
|
|
|
this.lastTime--;
|
|
|
}, 1000);
|
|
|
} else {
|
|
|
+ if (this.entryType == 'random') {
|
|
|
+ this.bankType = 1 // 随机练习全部都是练习类型
|
|
|
+ this.randomQuestionList()
|
|
|
+ } else {
|
|
|
//进入页面
|
|
|
await this.bankExam();
|
|
|
// 请求题目列表
|
|
|
this.goodsQuestionList();
|
|
|
}
|
|
|
+ }
|
|
|
},
|
|
|
onUnload() {
|
|
|
if (this.isSubmit) {
|
|
@@ -1337,6 +1344,7 @@ export default {
|
|
|
questionIds: doWrongQuestionIds,
|
|
|
recordId: this.recordId,
|
|
|
type: 1, // 题库试卷传1
|
|
|
+ doMode: this.entryType == 'random' ? 2 : 1, // 做题模式 1章卷 2随机练习
|
|
|
})
|
|
|
.then((res) => {});
|
|
|
},
|
|
@@ -1493,7 +1501,8 @@ export default {
|
|
|
goodsId: this.goodsId,
|
|
|
totalQuestionNum: questionList,
|
|
|
allQuestionNum: this.questionList.length,
|
|
|
- courseId: this.courseId,
|
|
|
+ doMode: this.entryType == 'random' ? 2 : 1, // 做题模式 1章卷 2随机练习
|
|
|
+ // courseId: this.courseId,
|
|
|
// type: ''
|
|
|
})
|
|
|
.then((res) => {
|
|
@@ -1526,6 +1535,43 @@ export default {
|
|
|
hideDialog() {
|
|
|
this.showDialog = false;
|
|
|
},
|
|
|
+ // 请求随机练习题目列表
|
|
|
+ randomQuestionList() {
|
|
|
+ this.$http({
|
|
|
+ url: '/bank/exam/temp',
|
|
|
+ method: 'post',
|
|
|
+ data: {
|
|
|
+ goodsId: this.goodsId,
|
|
|
+ orderGoodsId: this.orderGoodsId,
|
|
|
+ number: this.bankNum
|
|
|
+ }
|
|
|
+ }).then((res) => {
|
|
|
+ if(res.data.code == 200) {
|
|
|
+ this.examData = res.data.data || {}
|
|
|
+ this.id = this.examData.examId
|
|
|
+ if (!this.examData.questionList.length) {
|
|
|
+ this.hideDialog();
|
|
|
+ uni.showModal({
|
|
|
+ showCancel: false,
|
|
|
+ content: "该试卷暂无题目",
|
|
|
+ success: (k) => {
|
|
|
+ if (k.confirm) {
|
|
|
+ this.isSubmit = true;
|
|
|
+ uni.navigateBack();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.dataAnlyze(this.examData.questionList || [])
|
|
|
+ } else {
|
|
|
+ this.$u.toast(res.data.msg)
|
|
|
+ setTimeout(() => {
|
|
|
+ uni.navigateBack()
|
|
|
+ }, 2000)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
/**
|
|
|
* 请求题目列表 app/common/bank/question/list
|
|
|
*/
|
|
@@ -1571,7 +1617,12 @@ export default {
|
|
|
}, 1000);
|
|
|
} else {
|
|
|
}
|
|
|
- res.data.data.forEach((item, index) => {
|
|
|
+ this.dataAnlyze(res.data.data)
|
|
|
+ });
|
|
|
+ },
|
|
|
+ dataAnlyze(datas = []) {
|
|
|
+ console.log('datas:', datas)
|
|
|
+ datas.forEach((item, index) => {
|
|
|
// if (typeof item.jsonStr == 'string') {
|
|
|
item.jsonStr = JSON.parse(item.jsonStr);
|
|
|
|
|
@@ -1697,12 +1748,11 @@ export default {
|
|
|
// }
|
|
|
});
|
|
|
|
|
|
- this.questionList = res.data.data;
|
|
|
+ this.questionList = datas;
|
|
|
|
|
|
this.lastCount = this.questionList.length;
|
|
|
this.examRecord();
|
|
|
this.getCollectInfo(this.current);
|
|
|
- });
|
|
|
},
|
|
|
/**
|
|
|
* @param {Object} e单选点击
|
|
@@ -2148,7 +2198,7 @@ export default {
|
|
|
//交卷
|
|
|
this.$api
|
|
|
.examRecordEdit({
|
|
|
- courseId: this.courseId,
|
|
|
+ // courseId: this.courseId,
|
|
|
examId: this.id,
|
|
|
goodsId: this.goodsId,
|
|
|
reportStatus: reportStatus,
|
|
@@ -2193,7 +2243,7 @@ export default {
|
|
|
"&id=" +
|
|
|
this.recordId +
|
|
|
"&orderGoodsId=" +
|
|
|
- this.orderGoodsId + '&entryType=daily',
|
|
|
+ this.orderGoodsId + '&entryType=' + this.entryType,
|
|
|
});
|
|
|
}, 1000);
|
|
|
}
|
|
@@ -2208,6 +2258,7 @@ export default {
|
|
|
questionIds: doWrongQuestionIds,
|
|
|
recordId: this.recordId,
|
|
|
type: 1, // 题库试卷传1
|
|
|
+ doMode: this.entryType == 'random' ? 2 : 1, // 做题模式 1章卷 2随机练习
|
|
|
})
|
|
|
.then((res) => {});
|
|
|
},
|
|
@@ -2242,6 +2293,7 @@ export default {
|
|
|
questionId: this.questionList[index].questionId,
|
|
|
goodsId: this.goodsId || "",
|
|
|
orderGoodsId: this.orderGoodsId,
|
|
|
+ doMode: this.entryType == 'random' ? 2 : 1, //做题模式 1章卷 2随机练习
|
|
|
})
|
|
|
.then((res) => {
|
|
|
if (res.data.code == 200) {
|