| | |
| | | // 正则表达式匹配<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]; |
| | | return match[1].replace( '../file', app.config.requestCtx + '/file'); |
| | | } else if (local && local[1]) { |
| | | return local[1] |
| | | return local[1].replace( '../file', app.config.requestCtx + '/file') |
| | | } else { |
| | | // 如果没有匹配到,返回null |
| | | return null; |
| | |
| | | if (src) { |
| | | questionObj.src = src |
| | | questionObj.stem.stemTxt = this.removeVideoAndAudioTags(questionObj.stem.stemTxt) |
| | | console.log('题干', questionObj.stem.stemTxt); |
| | | } |
| | | } |
| | | // 获取图片 |
| | |
| | | '<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); |
| | |
| | | /\<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" || |