| | |
| | | import { |
| | | getPublicImage |
| | | } from "../../../../assets/js/middleGround/tool"; |
| | | import { |
| | | loginInfo |
| | | } from '../../../../assets/js/login'; |
| | | const app = getApp(); |
| | | Page({ |
| | | /** |
| | |
| | | isCountdownRunning: true, // 是否倒计时 |
| | | countdownTime: 0, // 倒计时时间 |
| | | storeInfo: '', |
| | | jslx: '', |
| | | bookId: "", |
| | | productLinkPath: "", |
| | | rootCmsItemId: "", |
| | |
| | | startTime: "", //进入页面当前时间 |
| | | pauseTime: 0, //暂停时间 |
| | | showDialog: false, // 未提交退出拦截弹窗 |
| | | showId: '' |
| | | showId: '', |
| | | isShowDialog: false, // 测试报告弹窗是否显示 |
| | | }, |
| | | |
| | | /** |
| | |
| | | idPathList: options.idPathList ? JSON.parse(options.idPathList) : [], |
| | | answerType: options.answerType, |
| | | storeInfo: options.storeInfo, |
| | | jslx: options.jslx, |
| | | }); |
| | | wx.setNavigationBarTitle({ |
| | | title: options.answerTitle, |
| | |
| | | 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() |
| | | } |
| | | |
| | | }, |
| | | |
| | | /** |
| | |
| | | * 用户点击右上角分享 |
| | | */ |
| | | onShareAppMessage() {}, |
| | | onShareTimeline() {}, |
| | | |
| | | // 监听watch |
| | | watch(context, variableName, callback) { |
| | |
| | | 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) { |
| | |
| | | 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" || |
| | |
| | | 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" |
| | |
| | | }), |
| | | }, ], |
| | | }); |
| | | child.openTestReportDialog(); |
| | | // child.openTestReportDialog(); |
| | | this.setData({ |
| | | isShowDialog: true |
| | | }) |
| | | } |
| | | this.setData({ |
| | | loading: false, |
| | |
| | | }); |
| | | } |
| | | 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') { |
| | |
| | | questionDataList: questionList, |
| | | cardList: cardUpdatedList, |
| | | }); |
| | | console.log( |
| | | '题目', this.data.questionDataList |
| | | ); |
| | | }); |
| | | }); |
| | | } |
| | |
| | | // 简答 翻译 |
| | | 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) { |