Commit 40f49912 authored by linwenqing's avatar linwenqing

fix:考试bug修复

parent 6cc5e8e5
...@@ -18,8 +18,12 @@ let learnApiFun = function(vm){ ...@@ -18,8 +18,12 @@ let learnApiFun = function(vm){
/* 获取考试结果 */ /* 获取考试结果 */
let getExamResult = async (examId, params = {}) => await vm.$u.post(sysApiUrl + '/wxh-worker-rest/rest/exam/serviceRule/userExamInfo/' + vm.vuex_token + '?examId=' + examId, params); let getExamResult = async (examId, params = {}) => await vm.$u.post(sysApiUrl + '/wxh-worker-rest/rest/exam/serviceRule/userExamInfo/' + vm.vuex_token + '?examId=' + examId, params);
/* 申请考试 */
let applyExam = async (examId, params = {}) => await vm.$u.post(sysApiUrl + '/wxh-worker-rest/rest/exam/serviceRule/' + vm.vuex_token + '?examId=' + examId, params);
/* 获取下一题 */
let getNextQuestion = async (userExamId, questionId, userAnswerIds, params = {}) => await vm.$u.post(sysApiUrl + '/wxh-worker-rest/rest/exam/serviceRule/next/' + vm.vuex_token + '?userExamId=' + userExamId + '&questionId=' + questionId + '&userAnswerIds=' + (userAnswerIds || "9999"), params);
const learnApi = { const learnApi = {
getTrainingNoticeList,CourseList,ChapterDetails,CourseSection,updateLearnCourses,getExamResult getTrainingNoticeList,CourseList,ChapterDetails,CourseSection,updateLearnCourses,getExamResult,applyExam,getNextQuestion
} }
return learnApi return learnApi
} }
......
...@@ -695,8 +695,7 @@ export default { ...@@ -695,8 +695,7 @@ export default {
let length = this.examList.length; let length = this.examList.length;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; i++) {
let examId = this.examList[i].id; let examId = this.examList[i].id;
this.$u.api this.$u.api.getExamResult(examId)
.getExamResult(examId)
.then((res) => { .then((res) => {
if (res.code != 200) { if (res.code != 200) {
console.log("getUserExamInfo 200 err"); console.log("getUserExamInfo 200 err");
......
This diff is collapsed.
...@@ -39,9 +39,11 @@ export default { ...@@ -39,9 +39,11 @@ export default {
onLoad(param) { onLoad(param) {
getApp().trackPage('学习开始考试页') getApp().trackPage('学习开始考试页')
this.examId = param.examId; this.examId = param.examId;
this.getExamResult();
// this.getUserExamInfo(); // this.getUserExamInfo();
}, },
onShow() {
this.getExamResult();
},
onUnload() { onUnload() {
uni.switchTab({ uni.switchTab({
url: '/pages/index/learn' url: '/pages/index/learn'
...@@ -67,23 +69,14 @@ export default { ...@@ -67,23 +69,14 @@ export default {
}); });
}, },
getExamResult() { getExamResult() {
uni.request({ let examId = this.examId;
url: this.$u.api.getExamResult(examId)
process.uniEnv.systemUrl.apiUrl + .then((res) => {
"/wxh-worker-rest/rest/exam/serviceRule/userExamInfo/" +
this.vuex_token +
"?examId=" +
this.examId,
method: "POST",
header: {
"Content-Type": "application/x-www-from-urlencoded",
},
success: (res) => {
uni.hideLoading(); uni.hideLoading();
if (res.data.code == 200) { if (res.code == 200) {
if (res.data.data.ruleDisc) { if (res.data.ruleDisc) {
var str = res.data.data.ruleDisc; var str = res.data.ruleDisc;
this.userExamId = res.data.data.id; this.userExamId = res.data.id;
let strArr = str.split("(")[0].split(","); let strArr = str.split("(")[0].split(",");
this.title = strArr[0]; this.title = strArr[0];
...@@ -92,7 +85,13 @@ export default { ...@@ -92,7 +85,13 @@ export default {
this.ruleDisc = strArr[3]; this.ruleDisc = strArr[3];
} }
} }
}, })
.catch((err) => {
uni.hideLoading();
uni.showToast({
icon: "none",
title: "获取考试信息失败",
});
}); });
}, },
}, },
......
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