| | |
| | | countdownInterval: null, // 计时器 |
| | | isCountdownRunning: true, // 是否倒计时 |
| | | countdownTime: 0, // 倒计时时间 |
| | | storeInfo: '', |
| | | bookId: "", |
| | | productLinkPath: "", |
| | | rootCmsItemId: "", |
| | |
| | | sliderValue: 0, // 字体滑块 |
| | | startTime: "", //进入页面当前时间 |
| | | pauseTime: 0, //暂停时间 |
| | | showDialog: false // 未提交退出拦截弹窗 |
| | | showDialog: false, // 未提交退出拦截弹窗 |
| | | showId: '' |
| | | }, |
| | | |
| | | /** |
| | |
| | | rootCmsItemId: options.rootCmsItemId, |
| | | idPathList: options.idPathList ? JSON.parse(options.idPathList) : [], |
| | | answerType: options.answerType, |
| | | storeInfo: options.storeInfo, |
| | | }); |
| | | // wx.setNavigationBarTitle({ |
| | | // title: options.answerTitle, |
| | | // }) |
| | | wx.setNavigationBarTitle({ |
| | | title: options.answerTitle, |
| | | }) |
| | | if (this.data.answerType == "mock") { |
| | | this.setData({ |
| | | uuid: options.uuid, |
| | |
| | | }, |
| | | }); |
| | | }, |
| | | |
| | | // 修改nav颜色 |
| | | changeNavBarColor(e) { |
| | | if (type == 'night') { |
| | | wx.setNavigationBarColor({ |
| | | backgroundColor: '#000000', |
| | | frontColor: '#ffffff', |
| | | }) |
| | | } else { |
| | | wx.setNavigationBarColor({ |
| | | backgroundColor: '#ffffff', |
| | | frontColor: '#000000', |
| | | }) |
| | | } |
| | | }, |
| | | // 正则找出听力src |
| | | extractSourceSrc(htmlString) { |
| | | // 正则表达式匹配<source>标签中的src属性值 |
| | |
| | | }, |
| | | // 返回拦截 |
| | | beforeleave() { |
| | | wx.showModal({ |
| | | title: "提示", |
| | | content: "未提交,是否退出答题", |
| | | confirmColor: "#ff6c00", |
| | | cancelColor: "#949494", |
| | | complete: (res) => { |
| | | if (res.cancel) { |
| | | this.setData({ |
| | | showDialog: true |
| | | }) |
| | | } |
| | | if (res.confirm) { |
| | | this.setData({ |
| | | submitStatus: true, |
| | | showDialog: false |
| | | }); |
| | | wx.navigateBack(); |
| | | } |
| | | }, |
| | | }); |
| | | if ((this.data.answerType == 'option' || this.data.answerType == 'mock') && !this.data.submitStatus) { |
| | | wx.showModal({ |
| | | title: "提示", |
| | | content: "未提交,是否退出答题", |
| | | confirmColor: "#ff6c00", |
| | | cancelColor: "#949494", |
| | | complete: (res) => { |
| | | if (res.cancel) { |
| | | this.setData({ |
| | | showDialog: true |
| | | }) |
| | | } |
| | | if (res.confirm) { |
| | | this.setData({ |
| | | submitStatus: true, |
| | | showDialog: false |
| | | }); |
| | | wx.navigateBack(); |
| | | } |
| | | }, |
| | | }); |
| | | } |
| | | }, |
| | | onChangeSlider(e) { |
| | | this.setData({ |
| | |
| | | }, |
| | | //设置背景色 |
| | | changeBGColor(e) { |
| | | const flag = e.detail.value |
| | | this.setData({ |
| | | isNight: e.detail.value, |
| | | isNight: flag, |
| | | }); |
| | | if (flag) { |
| | | wx.setNavigationBarColor({ |
| | | backgroundColor: '#000000', |
| | | frontColor: '#ffffff', |
| | | }) |
| | | } else { |
| | | wx.setNavigationBarColor({ |
| | | backgroundColor: '#ffffff', |
| | | frontColor: '#000000', |
| | | }) |
| | | } |
| | | }, |
| | | // 获取保存的倒计时时间 |
| | | getSavedTime() { |
| | |
| | | }, |
| | | // 切换题目 |
| | | changeSwiper(e) { |
| | | this.setData({ |
| | | currentIndex: e.detail.index, |
| | | }); |
| | | let index = e.detail.index - 1 >= 0 ? e.detail.index - 1 : 0; |
| | | const item = this.data.questionDataList[index]; |
| | | const lastItem = this.data.questionDataList[index + 1]; |
| | | this.setData({ |
| | | currentIndex: e.detail.index, |
| | | showId: lastItem.id |
| | | }); |
| | | if ( |
| | | (this.data.answerType == "collectQuestion" || |
| | | this.data.answerType == "errorQuestion") && |
| | |
| | | // 提交逻辑 |
| | | submitPaper() { |
| | | this.setData({ |
| | | showDialog: false, |
| | | submitStatus: true, |
| | | loading: true, |
| | | }); |
| | |
| | | } |
| | | this.setData({ |
| | | loading: false, |
| | | showDialog: false, |
| | | }); |
| | | }, |
| | | // 初始化函数 |
| | |
| | | subjectiveNum: 0, |
| | | currentIndex: 0, |
| | | submitStatus: false, |
| | | showDialog: true |
| | | }); |
| | | if (this.data.answerType == "option") { |
| | | this.setData({ |
| | |
| | | let query = { |
| | | path: "*", |
| | | queryType: "*", |
| | | storeInfo: this.data.storeInfo, |
| | | productId: this.data.bookId, |
| | | cmsPath: pathitem.productLinkPath, |
| | | itemFields: { |
| | |
| | | }); |
| | | } |
| | | res.datas.cmsDatas[0].datas.forEach((item, index) => { |
| | | if (this.data.storeInfo) { |
| | | if (item.Embedded_QuestionBank_QuestionType == 'singleChoice') { |
| | | pathitem.name = "单选题" |
| | | } else if (item.Embedded_QuestionBank_QuestionType == 'shortAnswer') { |
| | | pathitem.name = "简答题" |
| | | } else if (item.Embedded_QuestionBank_QuestionType == "completion") { |
| | | pathitem.name = "填空题"; |
| | | } else if (item.Embedded_QuestionBank_QuestionType == "multipleChoice") { |
| | | pathitem.name = "多选题"; |
| | | } else if (item.Embedded_QuestionBank_QuestionType == "judge") { |
| | | pathitem.name = "判断题"; |
| | | } |
| | | } |
| | | let oldObj = ""; |
| | | if (oldList) |
| | | oldObj = oldList.find((oldItem) => oldItem.id == item.id); |
| | |
| | | } |
| | | this.setData({ |
| | | loading: false, |
| | | showId: this.data.questionDataList[0].id |
| | | }); |
| | | }, |
| | | // 批改题目 (练习,我的错题,我的收藏,,组卷) |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | this.setAnswerInfo(setInfoData); |
| | | }, |
| | | // 提交答题数据 |
| | |
| | | for (let qindex = 0; qindex < this.data.collectList.length; qindex++) { |
| | | const qitem = this.data.collectList[qindex]; |
| | | let query = { |
| | | storeInfo: this.data.storeInfo, |
| | | path: "*", |
| | | cmsPath: this.data.rootCmsItemId, |
| | | cmsType: "*", |
| | |
| | | } |
| | | this.setData({ |
| | | questionDataList: questionArr, |
| | | showId: questionArr[0].id, |
| | | cardList: cardList, |
| | | loading: false, |
| | | }); |
| | |
| | | let multipleChoiceArr = []; // 多选 |
| | | let completionArr = []; // 填空 |
| | | let query = { |
| | | storeInfo: this.data.storeInfo, |
| | | path: "*", |
| | | cmsPath: this.data.rootCmsItemId, |
| | | cmsType: "*", |
| | |
| | | } |
| | | this.setData({ |
| | | questionDataList: questionArr, |
| | | showId: questionArr[0].id, |
| | | cardList: cardList, |
| | | loading: false, |
| | | }); |
| | | }); |
| | | // loadings.value = false |
| | | }, |
| | | // 获取组卷结果 |
| | | async getEduQuizConfig() { |
| | |
| | | itemIds.push(item.id + ""); |
| | | }); |
| | | let query = { |
| | | storeInfo: this.data.storeInfo, |
| | | path: "*", |
| | | cmsPath: this.data.rootCmsItemId, |
| | | cmsType: "*", |
| | |
| | | } |
| | | this.setData({ |
| | | loading: false, |
| | | showId: this.data.questionDataList[0].id |
| | | }); |
| | | }, |
| | | // 获取组卷数据 |