From 6f5904aabf18277a09e1990d9e2ec4db8b5d8f1e Mon Sep 17 00:00:00 2001 From: litian <C21AF165> Date: 星期一, 16 十二月 2024 09:32:29 +0800 Subject: [PATCH] 题库 --- packageBookService/pages/bookServices/examination/examination.js | 52 ++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 40 insertions(+), 12 deletions(-) diff --git a/packageBookService/pages/bookServices/examination/examination.js b/packageBookService/pages/bookServices/examination/examination.js index 7e2f406..038bc76 100644 --- a/packageBookService/pages/bookServices/examination/examination.js +++ b/packageBookService/pages/bookServices/examination/examination.js @@ -1,6 +1,9 @@ import { getPublicImage } from "../../../../assets/js/middleGround/tool"; +import { + loginInfo +} from '../../../../assets/js/login'; const app = getApp(); Page({ /** @@ -15,6 +18,7 @@ isCountdownRunning: true, // 鏄惁鍊掕鏃� countdownTime: 0, // 鍊掕鏃舵椂闂� storeInfo: '', + jslx: '', bookId: "", productLinkPath: "", rootCmsItemId: "", @@ -49,7 +53,8 @@ startTime: "", //杩涘叆椤甸潰褰撳墠鏃堕棿 pauseTime: 0, //鏆傚仠鏃堕棿 showDialog: false, // 鏈彁浜ら��鍑烘嫤鎴脊绐� - showId: '' + showId: '', + isShowDialog: false, // 娴嬭瘯鎶ュ憡寮圭獥鏄惁鏄剧ず }, /** @@ -70,6 +75,7 @@ idPathList: options.idPathList ? JSON.parse(options.idPathList) : [], answerType: options.answerType, storeInfo: options.storeInfo, + jslx: options.jslx, }); wx.setNavigationBarTitle({ title: options.answerTitle, @@ -80,7 +86,21 @@ mockid: options.mockid, }); } - this.init(); + + const token = wx.getStorageSync(app.config.tokenKey) + + if (!token) { + loginInfo(app, (data) => { + if (data) { + this.init(); + } else { + this.init(); + } + }) + } else { + this.init() + } + }, /** @@ -183,6 +203,7 @@ * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜� */ onShareAppMessage() {}, + onShareTimeline() {}, // 鐩戝惉watch watch(context, variableName, callback) { @@ -278,11 +299,9 @@ this.setData({ sliderValue: e.detail.value, }); - console.log(e.detail.value); }, // 杩斿洖 goBack() { - console.log(this.data.submitStatus); wx.navigateBack(); }, //璁剧疆鑳屾櫙鑹� @@ -464,7 +483,6 @@ const inputData = e.detail.value.detail.value; const id = e.detail.value.currentTarget.dataset.id; const index = Number(e.detail.value.currentTarget.dataset.index); - console.log(index); const questionList = this.data.questionDataList; questionList.forEach((item) => { if (item.id == id) { @@ -531,7 +549,8 @@ submitStatus: true, loading: true, }); - const child = this.selectComponent("#question-options"); + const child = this.selectComponent('#question-options'); + if ( this.data.answerType == "option" || this.data.answerType == "errorQuestion" || @@ -547,7 +566,11 @@ if (this.data.answerType == "option") { this.toggleCountdown(); this.recordAnswerData(); - child.openTestReportDialog(); + // this.selectComponent 鎷夸笉鍒� 缁勪欢浜嗭紝 鏀逛负鐩戝惉缁勪欢浼犲�� 鎵撳紑寮圭獥 + // child.openTestReportDialog(); + this.setData({ + isShowDialog: true + }) } else if ( this.data.answerType == "collectQuestion" || this.data.answerType == "errorQuestion" @@ -590,7 +613,10 @@ }), }, ], }); - child.openTestReportDialog(); + // child.openTestReportDialog(); + this.setData({ + isShowDialog: true + }) } this.setData({ loading: false, @@ -859,7 +885,7 @@ }); } res.datas.cmsDatas[0].datas.forEach((item, index) => { - if (this.data.storeInfo) { + if (this.data.storeInfo || this.data.jslx) { if (item.Embedded_QuestionBank_QuestionType == 'singleChoice') { pathitem.name = "鍗曢�夐" } else if (item.Embedded_QuestionBank_QuestionType == 'shortAnswer') { @@ -907,7 +933,8 @@ questionObj.questionType == "multipleChoice" ) { try { - questionObj.answer = JSON.parse(questionObj.answer).toString(); + // questionObj.answer = JSON.parse(questionObj.answer).toString(); + questionObj.answer = JSON.parse(questionObj.answer) } catch (error) { questionObj.answer = item.Embedded_QuestionBank_Answer; } @@ -1051,7 +1078,6 @@ } // 鏈夐鐩啀寮�濮嬪�掕鏃� if (this.data.questionDataList.length) { - console.log(this.data.questionDataList); this.startCountdown(); } else { this.setData({ @@ -1094,7 +1120,7 @@ // 绠�绛� 缈昏瘧 questionList[index].isRight = null; } else if (item.questionType == "completion") { - if (item.answer == "string") { + if (typeof item.answer == "string") { item.isRight = item.answer == item.userAnswer[0]; } else { if (item.answer.length != item.userAnswer.length) { @@ -1413,6 +1439,7 @@ questionObj.questionType == "completion" || questionObj.questionType == "multipleChoice" ) { + console.log(questionObj.answer, "111") try { questionObj.answer = JSON.parse(questionObj.answer).toString(); } catch (error) { @@ -1792,6 +1819,7 @@ cardList: cardList, loading: false, }); + console.log(this.data.questionDataList, "questionDataList"); }); }, // 鑾峰彇缁勫嵎缁撴灉 -- Gitblit v1.9.1