| | |
| | | total: 0, // 题目总数 |
| | | cardList: [], // 提交项, |
| | | questionDataList: [], // 显示题目列表 |
| | | noData: false, |
| | | mockid: 0, |
| | | uuid: 0, |
| | | mockData: { |
| | |
| | | sliderValue: 0, // 字体滑块 |
| | | startTime: "", //进入页面当前时间 |
| | | pauseTime: 0, //暂停时间 |
| | | |
| | | }, |
| | | |
| | | /** |
| | |
| | | // 监听watch |
| | | watch(context, variableName, callback) { |
| | | let value = context.data[variableName]; // 获取被监听属性的当前值 |
| | | |
| | | // 使用 Object.defineProperty 方法在数据对象上定义属性的 getter 和 setter |
| | | Object.defineProperty(context.data, variableName, { |
| | | configurable: true, // 可配置 |
| | |
| | | }, |
| | | }); |
| | | }, |
| | | |
| | | // 正则找出听力src |
| | | extractSourceSrc(htmlString) { |
| | | // 正则表达式匹配<source>标签中的src属性值 |
| | | var srcRegex = /<source\s+src="([^"]+)"/i; |
| | | var srcTwo = /<audio\s+src="([^"]+)"/i; |
| | | |
| | | // 执行正则匹配 |
| | | var match = srcRegex.exec(htmlString); |
| | | const local = srcTwo.exec(htmlString) |
| | | // 如果匹配成功,返回第一个捕获组的内容(src属性的值) |
| | | if (match && match[1]) { |
| | | return match[1].replace( '../file', app.config.requestCtx + '/file'); |
| | | } else if (local && local[1]) { |
| | | return local[1].replace( '../file', app.config.requestCtx + '/file') |
| | | } else { |
| | | // 如果没有匹配到,返回null |
| | | return null; |
| | | } |
| | | }, |
| | | |
| | | // 拿到听力题除audio标签外其他内容 |
| | | removeVideoAndAudioTags(htmlString) { |
| | | // 使用正则表达式匹配并移除所有的 <video> 和 <audio> 标签 |
| | | var cleanedHtml = htmlString.replace(/<video[^>]*>[\s\S]*?<\/video>|<audio[^>]*>[\s\S]*?<\/audio>/gi, ''); |
| | | |
| | | return cleanedHtml; |
| | | }, |
| | | |
| | | // 改变loading状态 |
| | | changeLoadingState() { |
| | | this.setData({ |
| | |
| | | async getQuestionList(oldData) { |
| | | // 清空正确题数记录 |
| | | this.setData({ |
| | | noData: false, |
| | | cardList: [], |
| | | correctNum: 0, |
| | | }); |
| | |
| | | }, |
| | | }; |
| | | await app.MG.store.getProductDetail(query).then((res) => { |
| | | if (!res.datas.cmsDatas[0].datas.length) return this.setData({ |
| | | noData: true |
| | | }) |
| | | this.setData({ |
| | | total: res.datas.cmsDatas[0].datas.length, |
| | | }); |
| | |
| | | /\<img/gi, |
| | | '<img style="max-width: 300rpx !important;object-fit: contain;" class="stem-rich-img" ' |
| | | ); |
| | | } |
| | | // 听力题修改 |
| | | if (questionObj.questionType == 'singleChoice') { |
| | | const src = this.extractSourceSrc(questionObj.stem.stemTxt) |
| | | if (src) { |
| | | questionObj.src = src |
| | | questionObj.stem.stemTxt = this.removeVideoAndAudioTags(questionObj.stem.stemTxt) |
| | | } |
| | | } |
| | | // 获取图片 |
| | | if ( |
| | |
| | | } else { |
| | | this.setData({ |
| | | loading: false, |
| | | noData: true |
| | | }); |
| | | wx.showModal({ |
| | | title: "提示", |
| | |
| | | '<img style="max-width: 300rpx !important;object-fit: contain;" class="stem-rich-img" ' |
| | | ); |
| | | } |
| | | // 听力题修改 |
| | | if (questionObj.questionType == 'singleChoice') { |
| | | const src = this.extractSourceSrc(questionObj.stem.stemTxt) |
| | | if (src) { |
| | | questionObj.src = src |
| | | questionObj.stem.stemTxt = this.removeVideoAndAudioTags(questionObj.stem.stemTxt) |
| | | } |
| | | } |
| | | if (item.Embedded_QuestionBank_QuestionType == "judge") { |
| | | questionObj.type = "判断题"; |
| | | judgeArr.push(questionObj); |
| | |
| | | this.getErrorDataList(); |
| | | } else { |
| | | this.setData({ |
| | | loading: true, |
| | | loading: false, |
| | | noData: true |
| | | }); |
| | | wx.showModal({ |
| | | title: "提示", |
| | |
| | | /\<img/gi, |
| | | '<img style="max-width: 300rpx !important;object-fit: contain;" class="stem-rich-img" ' |
| | | ); |
| | | } |
| | | // 听力题修改 |
| | | if (questionObj.questionType == 'singleChoice') { |
| | | const src = this.extractSourceSrc(questionObj.stem.stemTxt) |
| | | if (src) { |
| | | questionObj.src = src |
| | | questionObj.stem.stemTxt = this.removeVideoAndAudioTags(questionObj.stem.stemTxt) |
| | | console.log('题干', questionObj.stem.stemTxt); |
| | | } |
| | | } |
| | | if (item.Embedded_QuestionBank_QuestionType == "judge") { |
| | | questionObj.type = "判断题"; |
| | |
| | | ); |
| | | }); |
| | | } |
| | | // 听力题修改 |
| | | if (questionObj.questionType == 'singleChoice') { |
| | | const src = this.extractSourceSrc(questionObj.stem.stemTxt) |
| | | if (src) { |
| | | questionObj.src = src |
| | | questionObj.stem.stemTxt = this.removeVideoAndAudioTags(questionObj.stem.stemTxt) |
| | | } |
| | | } |
| | | // 获取图片 |
| | | if ( |
| | | questionObj.stemStyle == "Image" || |