| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484 | <template>	<view id="questionBank">		<nav-bar title="错题"></nav-bar>		<swiper class="swiper" :current="current" @change="swiperChange" :interval="interval">			<swiper-item v-for="(bank,bankIndex) in questionList" :key="bankIndex">				<view class="pageContent">					<view class="pad_8 titBox" >						<view class="firstLetter">							<view class="leftLetters">								<view class="btnType">									<text v-if="bank.type==1">单选</text>									<text v-if="bank.type==2">多选</text>									<text v-if="bank.type==3">判断</text>									<text v-if="bank.type==4">案例题</text>									<text v-if="bank.type==5">简答题</text>								</view>								<text>{{bankIndex+1}}/{{questionList.length}}</text>							</view>							<view style="color: #666;font-size: 28rpx;"></view>							<view class="leftLetters"></view>						</view>						<view class="titles">							<rich-text :nodes="bank.content"></rich-text>						</view>							</view>					<template v-if="bank.type == 1">						<view class="pad_8 titBox no-margin">							<view v-if="!bank.ques">								<view v-for="(item, index) in bank.jsonStr" :key="index" class="lisSty" @click="radioSelect(item.optionsId,bankIndex)">									<view class="activeTI">{{ ast[index] }}</view>									<view class="flex_auto">{{ item.content }}</view>								</view>							</view>							<view v-if="bank.ques">								<view v-for="(item, index) in bank.jsonStr" :key="index" class="lisSty">									<text :class="{right:(item.optionsId == bank.ques) || (item.optionsId == bank.ans),wrong:(item.optionsId == bank.ques) && (bank.ques != bank.ans)}"  class="activeTI">{{ ast[index] }}</text>									<view class="flex_auto">{{ item.content }}</view>								</view>							</view> 						</view>						<view v-if="bank.ques">							<view class="pad_8 answer">								<view>正确答案:{{ast[bank.ans-1]}}</view>								<view v-if="!explain">我的答案:{{ast[bank.ques-1]}}</view>							</view>							<view class="pad_8 answerInfos">								<view class="answerTitle">答案解析</view>								<view class="answerContent">									<rich-text :nodes="bank.analysisContent"></rich-text>								</view>							</view>						</view>					</template>										<template v-if="bank.type == 2"> 						<view class="pad_8 titBox no-margin">							<view v-if="!bank.ques">								<view v-for="(item, index) in bank.jsonStr" :key="index" class="lisSty" @click="checkboxSelect(item.optionsId,bankIndex,index)">									<view :class="{checked:item.checked}" class="activeTI">{{ ast[index] }}</view>									<view class="flex_auto">{{ item.content }}</view>								</view>							</view>							<view v-if="!bank.ques" class="submit_checkbox" :class="{disabled:!isCheckboxChecked(bank.jsonStr)}"  @click="checkboxSubmit(bankIndex)">								确认答案							</view>							<view v-if="bank.ques">								<view v-for="(item, index) in bank.jsonStr" :key="index" class="lisSty">									<text :class="{right:(bank.ques.indexOf(item.optionsId) != -1 ) || (bank.ans.indexOf(item.optionsId) != -1),wrong:(bank.ques.indexOf(item.optionsId) != -1 ) && (bank.ans.indexOf(item.optionsId) == -1)}"  class="activeTI">{{ ast[index] }}</text>									<view class="flex_auto">{{ item.content }}</view>								</view>							</view> 						</view>						<view v-if="bank.ques">							<view class="pad_8 answer">								<view>正确答案:									<text :key="ansIndex" v-for="(ansItem,ansIndex) in bank.ans">{{ast[ansItem-1]}}</text>								</view>								<view v-if="!explain">我的答案:									<text v-for="quesItem in bank.ques">{{ast[quesItem-1]}}</text>								</view>							</view>							<view class="pad_8 answerInfos">								<view class="answerTitle">答案解析</view>								<view class="answerContent">									<rich-text :nodes="bank.analysisContent"></rich-text>								</view>							</view>						</view>					</template>										<template v-if="bank.type == 3">						<view class="pad_8 titBox no-margin">							<view v-if="!bank.ques">								<view v-for="(item, index) in judge" :key="index" class="lisSty" @click="judgeSelect(index,bankIndex)">									<view class="activeTI">{{ ast[index] }}</view>									<view class="flex_auto">										{{ item }}									</view>								</view>							</view>							<view v-if="bank.ques">								<view v-for="(item, index) in judge" :key="index" class="lisSty">									<text :class="{right:(index == bank.ques) || (index == bank.ans),wrong:(index == bank.ques) && (bank.ques != bank.ans)}"  class="activeTI">{{ ast[index] }}</text>									<view class="flex_auto">										{{ item }}									</view>																	</view>							</view> 						</view>						<view v-if="bank.ques">							<view class="pad_8 answer">								<view>正确答案:{{ast[bank.ans]}}</view>								<view v-if="!explain">我的答案:{{ast[bank.ques]}}</view>							</view>							<view class="pad_8 answerInfos">								<view class="answerTitle">答案解析</view>								<view class="answerContent">									<rich-text :nodes="bank.analysisContent"></rich-text>								</view>							</view>						</view>					</template>															<!-- 简答题 -->					<template v-if="bank.type == 5">						<view class="pad_8 titBox">							<view class="ans">								<view class="ans_input" v-if="!bank.ques">									<view class="top flex">										<image :data-index="bankIndex" class="icon" @click="chooseImg(bankIndex)" src="/static/08-10_032.jpg" mode=""></image>										<view class="progress">{{bank.ansText.imageList.length || '0'}}/4</view>										<view class="submit"  @click="submitAns(bankIndex)" >确认答案</view>									</view>									<view class="textarea">										<textarea v-model="bank.ansText.text" placeholder="在此输入答案"></textarea>									</view>									<view class="imgs">										<view class="img" v-for="(img,imgIndex) in bank.ansText.imageList" >											<text @click="deleteImg(imgIndex,bankIndex)">x</text>											<image :src="$method.splitImgHost(img, true)"></image>										</view>									</view>								</view>								<view class="ans_submit answerInfos" v-if="bank.ques && !explain">									<view class="answerTitle">我的答案:</view>									{{bank.ques.text}}									<view class="imgs">										<image class="img" :key="quesIndex" v-for="(ques,quesIndex) in bank.ques.imageList" :src="$method.splitImgHost(ques,true)"></image>									</view>								</view>							</view>						</view>						<view v-if="bank.ques">							<view class="pad_8 answerInfos">								<view class="answerTitle">答案解析:</view>								<view class="answerContent">									<rich-text :nodes="bank.analysisContent"></rich-text>								</view>							</view>						</view>					</template>										<!-- 案例题 -->					<template v-if="bank.type == 4">						<view class="tabs">							<view class="tab" :class="{current:tabIndex == bank.current}" :key="tabIndex" v-for="(tab,tabIndex) in bank.jsonStr" @click="tabSelect(tabIndex,bankIndex)">问题{{tabIndex+1}}</view>						</view>						<view v-for="(ansItem,ansIndex) in bank.jsonStr" v-if="bank.current == ansIndex" :key="ansIndex">							<template v-if="ansItem.type == 1">								<view class="pad_8 titBox">									<view class="titles">										<rich-text :nodes="ansItem.content"></rich-text>									</view>									<view v-if="!bank.ques[ansIndex]">										<view v-for="(option, childIndex) in ansItem.optionsList" :key="childIndex" class="lisSty" @click="radioSelectChild(option.optionsId,ansIndex,bankIndex)">											<view class="activeTI">{{ ast[childIndex] }}</view>											<view class="flex_auto">												<rich-text class="textChild" :nodes="option.content"></rich-text>											</view>																					</view>									</view>									<view v-if="bank.ques[ansIndex]">										<view v-for="(option, childIndex) in ansItem.optionsList" :key="index" class="lisSty">											<text :class="{right:(option.optionsId == bank.ques[ansIndex]) || (option.optionsId == bank.ans[ansIndex]),wrong:(option.optionsId == bank.ques[ansIndex]) && (bank.ques[ansIndex] != bank.ans[ansIndex])}"  class="activeTI">{{ ast[childIndex] }}</text>											<view class="flex_auto">												<rich-text :nodes="option.content"></rich-text>											</view>																					</view>									</view> 								</view>								<view v-if="bank.ques[ansIndex]">									<view class="pad_8 answer">										<view>正确答案:{{ast[bank.ans[ansIndex]-1]}}</view>										<view v-if="!explain">我的答案:{{ast[bank.ques[ansIndex]-1]}}</view>									</view>									<view class="pad_8 answerInfos">										<view class="answerTitle">答案解析</view>										<view class="answerContent">											<rich-text :nodes="option.analysisContent"></rich-text>										</view>									</view>								</view>							</template>														<template v-if="ansItem.type == 2">								<view class="pad_8 titBox">									<view class="titles">										<rich-text :nodes="ansItem.content"></rich-text>									</view>									<view v-if="!bank.ques[ansIndex]">										<view v-for="(option, childindex) in ansItem.optionsList" :key="childindex" class="lisSty" @click="checkboxSelectChild(bankIndex,ansIndex,childindex)">											<view :class="{checked:option.checked}" class="activeTI">{{ ast[childindex] }}</view>											<view class="flex_auto">												<rich-text :nodes="option.content"></rich-text>											</view>																					</view>									</view>									<view v-if="!bank.ques[ansIndex]" class="submit_checkbox" :class="{disabled:!isCheckboxChecked(ansItem.optionsList)}" @click="checkboxSubmitChild(bankIndex,ansIndex)">										确认答案									</view>									<view v-if="bank.ques && bank.ques[ansIndex]">										<view v-for="(option, childindex) in ansItem.optionsList" :key="childindex" class="lisSty">											<text :class="{right:right(bankIndex,ansIndex,option),wrong:wrong(bankIndex,ansIndex,option)}"  class="activeTI">{{ ast[childindex] }}</text>											<view class="flex_auto">												<rich-text :nodes="option.content"></rich-text>											</view>																					</view>									</view> 								</view>								<view v-if="bank.ques[ansIndex]">									<view class="pad_8 answer">										<view>正确答案:											<text :key="ansItemIndex1" v-for="(ansItem1,ansItemIndex1) in bank.ans[ansIndex]">{{ast[ansItem1-1]}}</text>										</view>										<view v-if="!explain">我的答案:											<text :key="quesItemIndex" v-for="(quesItem,quesItemIndex) in bank.ques[ansIndex]">{{ast[quesItem-1]}}</text>										</view>									</view>									<view class="pad_8 answerInfos">										<view class="answerTitle">答案解析</view>										<view class="answerContent">											<rich-text :nodes="ansItem.analysisContent"></rich-text>										</view>									</view>								</view>							</template>														<template v-if="ansItem.type == 3">								<view class="pad_8 titBox">									<view class="titles">										<rich-text :nodes="ansItem.content"></rich-text>									</view>									<view v-if="!bank.ques[ansIndex]">										<view v-for="(option, childindex) in judge" :key="childindex" class="lisSty" @click="judgeSelectChild(ansIndex,childindex,bankIndex)">											<view class="activeTI">{{ ast[childindex] }}</view>											<view class="flex_auto">												{{ option }}											</view>																					</view>									</view>									<view v-if="bank.ques[ansIndex]">										<view v-for="(option, childindex) in judge" :key="childindex" class="lisSty">											<text :class="{right:(childindex == bank.ques[ansIndex]) || (childindex == bank.ans[ansIndex]),wrong:(childindex == bank.ques[ansIndex]) && (bank.ques[ansIndex] != bank.ans[ansIndex])}"  class="activeTI">{{ ast[childindex] }}</text>											<view class="flex_auto">												{{ option }}											</view>																					</view>									</view> 								</view>								<view v-if="bank.ques[ansIndex]">									<view class="pad_8 answer">										<view>正确答案:{{ast[bank.ans[ansIndex]]}}</view>										<view v-if="!explain">我的答案:{{ast[bank.ques[ansIndex]]}}</view>									</view>									<view class="pad_8 answerInfos">										<view class="answerTitle">答案解析</view>										<view class="answerContent">											<rich-text :nodes="ansItem.analysisContent"></rich-text>										</view>									</view>								</view>							</template>																					<!-- 简答题 -->							<template v-if="ansItem.type == 5">								<view class="pad_8 titBox_title">									<view class="titles">										<rich-text :nodes="ansItem.content"></rich-text>									</view>								</view>								<view class="pad_8 titBox_title">									<view class="ans">										<view class="ans_input" v-if="!bank.ques[ansIndex]">											<view class="top flex">												<image class="icon" @click="chooseImgChild(bankIndex,ansIndex)" src="/static/08-10_032.jpg" mode=""></image>												<view class="progress">{{ansItem.ansText.imageList.length || '0'}}/4</view>												<view class="submit"  @click="submitAnsChild(bankIndex,ansIndex)">确认答案</view>											</view>											<view class="textarea">												<textarea v-model="ansItem.ansText.text" placeholder="在此输入答案"></textarea>											</view>											<view class="imgs">												<view class="img" v-for="(img,imgIndex) in ansItem.ansText.imageList" :key="imgIndex">													<text @click="deleteImgChild(imgIndex,bankIndex,ansIndex)">x</text>													<image :src="$method.splitImgHost(img, true)"></image>												</view>											</view>										</view>										<view class="ans_submit answerInfos" v-if="bank.ques[ansIndex] && !explain">											<view class="answerTitle">我的答案</view>											{{bank.ques[ansIndex].text}}											<view class="imgs">												<image class="img" :key="quesIndex" v-for="(ques,quesIndex) in bank.ques[ansIndex].imageList" :src="$method.splitImgHost(ques,true)"></image>											</view>										</view>									</view>								</view>								<view v-if="bank.ques[ansIndex]">									<view class="pad_8 answerInfos">										<view class="answerTitle">答案解析</view>										<view class="answerContent">											<rich-text :nodes="ansItem.analysisContent"></rich-text>										</view>									</view>								</view>							</template>																				</view>					</template>									<view class="footer_btn">						<view class="flex_center" @click="openFooterTab">							<view class="up-icon">								<image src="/static/up.png"></image>							</view>							答题卡						</view>						<view class="collect" :class="{show:!explain}" @click="pdsubmit">							<view>								<image src="/static/jj.png" mode=""></image>								<view>交卷</view>							</view>						</view>					</view>				</view>			</swiper-item>		</swiper>				<u-popup v-model="show" mode="bottom" border-radius="14" height="680rpx">			<view class="popupView">				<view class="popupTops">					<view class="topIcon"></view>					点击编号即可跳转至对应题目				</view>				<view class="popupContent">					<scroll-view scroll-y="true" style="height: 506rpx;">						<view class="boxSty">							<view v-for="(item, index) in questionList" :key="index" @click="changeIndex(index)" :class="{isRight:isRight(item,index),isWrong:isWrong(item,index)}" class="liListSty">{{ index + 1 }}</view>						</view>					</scroll-view>				</view>			</view>		</u-popup>				<view class="dialog" v-if="showDialog">			<image src="/static/pointer.png" class="pointer" mode=""></image>			<view class="text">左右滑动切换上下题</view>			<view class="btn" @click="hideDialog">我知道了</view>		</view>	</view></template><script>export default {	data() {		return {			id:'',			current:0,			questionList:[],			ast: ['A', 'B', 'C', 'D','E','F','G'],			judge:['错误','正确'],			show: false,			showDialog:false,			isFromReport:'',  //来自答题报告			bankList: [],			collectList:[],			goodsId:'',			examId:'',			explain:'',		};	},	onLoad(option){		this.id = option.id || '';		this.examId = option.examId || '';		this.isFromReport = option.isFromReport;		this.explain = option.explain || '';				let showDialog = uni.getStorageSync('showDialog');				if(showDialog) {			this.showDialog = false;		} else {			this.showDialog = true;			uni.setStorageSync('showDialog','1');		}				// if(this.isFromReport) { //通过答题报告查询错题列表		// 	console.log(2)		// 	this.wrongRecordList();		// } else { //通过错题集查询错题列表		// 	console.log(1)			this.wrongRecordExamQuestionList();		// }			},	onUnload() {			},	methods: {		/**		 * 通过答题报告查询错题列表		 */		wrongRecordList() {			this.$api.wrongRecordList({				recordId:this.id,			}).then(res => {				res.data.rows.forEach((item,index) => {					if(typeof item.jsonStr == 'string') {						item.jsonStr = JSON.parse(item.jsonStr)												if(item.type == 2) { //多选							item.jsonStr.forEach(str => {								str.optionsId = ''+str.optionsId;							})							let arr = item.answerQuestion.split(',');							arr.forEach((a,i) => {								arr[i] = ''+a;							})							item.ans = arr;							if(this.explain) {								item.ques = item.ans;							}							item.analysisContent && (item.analysisContent = item.analysisContent.replace(/<img/gi, '<img style="max-width:100%;"'));							return;						} else if(item.type == 5) {							item.ansText = {								text: '',								imageList: []							}							item.analysisContent && (item.analysisContent = item.analysisContent.replace(/<img/gi, '<img style="max-width:100%;"'));							if(this.explain) {								item.ques = {									text:item.analysisContent								}																return;							}																				} else if(item.type == 4) {							console.log(item.jsonStr)							item.ques = []							item.current = 0;							let ansArr = []; 							item.jsonStr.forEach((json,index) => {								if(json.type == 1) {									ansArr[index] = json.answerQuestion;									json.content && (json.content = json.content.replace(/<img/gi, '<img style="max-width:100%;"'));								} else if(json.type == 2) {									json.optionsList.forEach(str => {										str.optionsId = ''+str.optionsId;									})									let arr = json.answerQuestion.split(',');									arr.forEach((a,i) => {										arr[i] = ''+a;									})									ansArr[index] = arr									json.content && (json.content = json.content.replace(/<img/gi, '<img style="max-width:100%;"'));								} else if(json.type == 3) {									ansArr[index] = json.answerQuestion;									json.content && (json.content = json.content.replace(/<img/gi, '<img style="max-width:100%;"'));								} else if(json.type == 5) {									ansArr[index] = {										text: '',										imageList: []									}									json.ansText = {										text: '',										imageList: []									}									json.content && (json.content = json.content.replace(/<img/gi, '<img style="max-width:100%;"'));								}							})														item.ans = ansArr							item.analysisContent && (item.analysisContent = item.analysisContent.replace(/<img/gi, '<img style="max-width:100%;"'));							if(this.explain) {								item.ques = item.ans;							}							return;													}												item.ans = item.answerQuestion						if(this.explain) {							item.ques = item.ans;						}					} else {						if(this.explain) {							item.ques = item.ans;						}					}									})								this.questionList = res.data.rows;			})		},		/**		 * 通过错题集查询错题列表		 */		wrongRecordExamQuestionList() {			this.$api.wrongRecordExamQuestionList({				examId:this.examId,				recordId:this.id,			}).then(res => {								res.data.rows.forEach((item,index) => { 					if(typeof item.jsonStr == 'string') {						item.jsonStr = JSON.parse(item.jsonStr)												if(item.type == 2) { //多选							item.jsonStr.forEach(str => {								str.optionsId = ''+str.optionsId;							})							let arr = item.answerQuestion.split(',');							arr.forEach((a,i) => {								arr[i] = ''+a;							})							item.ans = arr;							item.analysisContent && (item.analysisContent = item.analysisContent.replace(/<img/gi, '<img style="max-width:100%;"'));							item.content && (item.content = item.content.replace(/<img/gi, '<img style="max-width:100%;"'));							if(this.explain) {								item.ques = item.ans;							}							return;						} else if(item.type == 5) {							item.ansText = {								text: '',								imageList: []							}							item.analysisContent && (item.analysisContent = item.analysisContent.replace(/<img/gi, '<img style="max-width:100%;"'));							item.content && (item.content = item.content.replace(/<img/gi, '<img style="max-width:100%;"'));							if(this.explain) {								item.ques = {									text:item.analysisContent								}																return;							}																				} else if(item.type == 4) {							console.log(item.jsonStr)							item.ques = []							item.current = 0;							let ansArr = []; 							item.jsonStr.forEach((json,index) => {								if(json.type == 1) {									ansArr[index] = json.answerQuestion;								} else if(json.type == 2) {									json.optionsList.forEach(str => {										str.optionsId = ''+str.optionsId;									})									let arr = json.answerQuestion.split(',');									arr.forEach((a,i) => {										arr[i] = ''+a;									})									ansArr[index] = arr								} else if(json.type == 3) {									ansArr[index] = json.answerQuestion;								} else if(json.type == 5) {									ansArr[index] = {										text: '',										imageList: []									}									json.ansText = {										text: '',										imageList: []									}								}							})														item.ans = ansArr							item.analysisContent && (item.analysisContent = item.analysisContent.replace(/<img/gi, '<img style="max-width:100%;"'));							item.content && (item.content = item.content.replace(/<img/gi, '<img style="max-width:100%;"'));							if(this.explain) {								item.ques = item.ans;							}							return;													}												item.analysisContent && (item.analysisContent = item.analysisContent.replace(/<img/gi, '<img style="max-width:100%;"'));						item.content && (item.content = item.content.replace(/<img/gi, '<img style="max-width:100%;"'));						item.ans = item.answerQuestion						if(this.explain) {							item.ques = item.ans;						}					} else {						if(this.explain) {							item.ques = item.ans;						}					}									})								this.questionList = res.data.rows;							})		},		/**		 * @param {Object} e单选点击		 */		radioSelect(optionsId,bindex) {			if(this.questionList[bindex].ques) return;			this.$set(this.questionList[bindex],'ques',optionsId)						// 回答错误			if(this.questionList[bindex].ques != this.questionList[bindex].ans) {							} else {				this.$api.wrongRecordDelete({					"examId": this.questionList[bindex].examId,					"goodsId": this.questionList[bindex].goodsId,					"questionId": this.questionList[bindex].questionId,				}).then(res => {									})							}		},				/**		 * @param {Object} e单选点击		 */		radioSelectChild(optionsId,ansIndex,bindex) {			if(this.questionList[bindex].ques[ansIndex]) return;			this.$set(this.questionList[bindex].ques,ansIndex,optionsId)					},						/**		 * @param {Object} 多选点击		 */		checkboxSelect(optionsId,bindex,index) {						this.$set(this.questionList[bindex].jsonStr[index],'checked',!this.questionList[bindex].jsonStr[index].checked)		},				/**		 * @param {Object} 多选点击		 */		checkboxSelectChild(bindex,ansIndex,childIndex) {						this.$set(this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex],'checked',!this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex].checked)		},				isCheckboxChecked(arr) {			return arr.some(item => {				if (item.checked) {					return true;				}			});		},						/**		 * @param {Object} 多选确认		 */		checkboxSubmit(bindex) {						if(this.questionList[bindex].ques) return;			let arr = [];			this.questionList[bindex].jsonStr.forEach(item => {				if(item.checked) {					arr.push(item.optionsId)				}			})						if(!arr.length) {				uni.showToast({					title:'请选择答案',					icon:'none'				})				return;			}						this.$set(this.questionList[bindex],'ques',arr)						let isWrong = this.questionList[bindex].ques.some((quesItem,quesIndex) => {				return this.questionList[bindex].ques[quesIndex] != this.questionList[bindex].ans[quesIndex]			})						// 回答错误			if(isWrong) {							} else {				let question = this.questionList.find(item => item.questionId == this.questionList[bindex].questionId);				if(question) {					this.$api.wrongRecordDelete({						"examId": question.examId,						"goodsId": question.goodsId,						"questionId": question.questionId,					}).then(res => {											})				}			}					},				/**		 * @param {Object} 多选确认		 */		checkboxSubmitChild(bindex,ansIndex) {						if(this.questionList[bindex].ques[ansIndex]) return;			let arr = [];			this.questionList[bindex].jsonStr[ansIndex].optionsList.forEach(item => {				if(item.checked) {					arr.push(item.optionsId)				}			})						if(!arr.length) {				uni.showToast({					title:'请选择答案',					icon:'none'				})				return;			}						this.$set(this.questionList[bindex].ques,ansIndex,arr)		},				judgeSelect(index,bindex) {			if(this.questionList[bindex].ques) return;			this.$set(this.questionList[bindex],'ques',index+'')						// 回答错误			if(this.questionList[bindex].ques != this.questionList[bindex].ans) {							} else {					this.$api.wrongRecordDelete({						"examId": this.questionList[bindex].examId,						"goodsId": this.questionList[bindex].goodsId,						"questionId": this.questionList[bindex].questionId,					}).then(res => {											})			}					},				judgeSelectChild(ansindex,childindex,bindex) {			if(this.questionList[bindex].ques[ansindex]) return;			this.$set(this.questionList[bindex].ques,ansindex,childindex+'')		},				openFooterTab() {			this.show = true;		},		hideDialog() {			this.showDialog = false		},		changeIndex(index) {			this.current = index		},				swiperChange(e) {			this.current = e.detail.current;		},						deleteImg(imgIndex,bankIndex) {									this.questionList[bankIndex].ansText.imageList.splice(imgIndex,1)		},						deleteImgChild(imgIndex,bankIndex,ansIndex) {									this.questionList[bankIndex].jsonStr[ansIndex].ansText.imageList.splice(imgIndex,1)		},				chooseImg(bankindex) {			uni.chooseImage({				count: 1, //默认9				sizeType: ['compressed', ], //可以指定是原图还是压缩图,默认二者都有				sourceType: ['album','camera'], //从相册选择				success: (res) => {					let self = this;					// console.log(JSON.stringify(res.tempFilePaths));					let img = res.tempFilePaths[0];					uni.getImageInfo({						src: img,						success: async res => {							let canvasWidth = res.width; //图片原始长宽							let canvasHeight = res.height;							if (canvasWidth > 1000 || canvasHeight > 1000) {								uni.compressImage({									src: img,									quality: 75,									width: '50%',									height: '50%',									success: async rest => {										const dir = await self.uploadFile(rest.tempFilePath, 0);										this.questionList[bankindex].ansText.imageList.push(dir)									} 								});							} else {								const dir = await self.uploadFile(img, 0);								this.questionList[bankindex].ansText.imageList.push(dir)							}						}					});				}			})		},				chooseImgChild(bankindex,ansindex) {			uni.chooseImage({				count: 1, //默认9				sizeType: ['compressed', ], //可以指定是原图还是压缩图,默认二者都有				sourceType: ['album','camera'], //从相册选择				success: (res) => {					let self = this;					// console.log(JSON.stringify(res.tempFilePaths));					let img = res.tempFilePaths[0];					uni.getImageInfo({						src: img,						success: async res => {							let canvasWidth = res.width; //图片原始长宽							let canvasHeight = res.height;							if (canvasWidth > 1000 || canvasHeight > 1000) {								uni.compressImage({									src: img,									quality: 75,									width: '50%',									height: '50%',									success: async rest => {										const dir = await self.uploadFile(rest.tempFilePath, 0);										this.questionList[bankindex].jsonStr[ansindex].ansText.imageList.push(dir)									} 								});							} else {								const dir = await self.uploadFile(img, 0);								this.questionList[bankindex].jsonStr[ansindex].ansText.imageList.push(dir)							}						}					});				}			})		},				uploadFile(options, int) {			var self = this;			return new Promise((resolve, reject) => {				var data = {					imageStatus: int				};				self.$api.aliyunpolicy(data).then(res => {					console.log(res.data,6)					if(res.data.code!=200){						self.$method.showToast('签名错误'+JSON.stringify(res.data))						return					}					var ossToken = res.data.data.resultContent;					if(ossToken.host==null||ossToken.host==undefined){						self.$method.showToast('上传路径报错'+JSON.stringify(res.data))						return					}					uni.uploadFile({						url: ossToken.host,						name: 'file',						filePath: options,						fileType: 'image',						header: {							AuthorizationToken: 'WX ' + uni.getStorageSync('token')						},						formData: {							key: ossToken.dir,							OSSAccessKeyId: ossToken.accessid,							policy: ossToken.policy,							Signature: ossToken.signature,							callback: ossToken.callback,							success_action_status: 200						},						success: result => {							if (result.statusCode === 200) {								resolve(ossToken.dir);							} else {								uni.showToast({									title: '上传失败',									icon: 'none'								});								return;							}						},						fail: error => {							uni.showToast({								title: '上传接口报错'+error,								icon: 'none'							});							return;						}					});				});			});		},		submitAns(bankindex) {							console.log(this.questionList[bankindex])			if(!this.questionList[bankindex].ansText.text && !this.questionList[bankindex].ansText.imageList.length) {				uni.showToast({					title: '请输入内容或上传图片',					duration: 2000,					icon:'none'				});				return			}						this.$set(this.questionList[bankindex],'ques',{				imageList:this.questionList[bankindex].ansText.imageList,				text:this.questionList[bankindex].ansText.text,			})					},				submitAnsChild(bankindex,ansindex) {							if(!this.questionList[bankindex].jsonStr[ansindex].ansText.text && !this.questionList[bankindex].jsonStr[ansindex].ansText.imageList.length) {				uni.showToast({					title: '请输入内容或上传图片',					duration: 2000,					icon:'none'				});				return			}						this.$set(this.questionList[bankindex].ques,ansindex,{				imageList:this.questionList[bankindex].jsonStr[ansindex].ansText.imageList,				text:this.questionList[bankindex].jsonStr[ansindex].ansText.text,			})					},				isRight(item,index) {			//单选			if(this.questionList[index].ques) {				if(item.type == 1) {					return this.questionList[index].ques == this.questionList[index].ans;				//多选				} else if(item.type == 2) {					//每一项都相等					return this.questionList[index].ans.every((item,i) => {						return item == this.questionList[index].ques[i];					})				//判断				} else if(item.type == 3) {					return this.questionList[index].ques == this.questionList[index].ans;				} else {					return false;				}			} else {				return false;			}					},						right(bankIndex,ansIndex,option) {			if(this.questionList[bankIndex].ques[ansIndex] && this.questionList[bankIndex].ans[ansIndex]) {								if((this.questionList[bankIndex].ques[ansIndex].indexOf(option.optionsId) != -1 ) || (this.questionList[bankIndex].ans[ansIndex].indexOf(option.optionsId) != -1)) {					return true				} else {					return false;				}			} else {				return false;			}					},				wrong(bankIndex,ansIndex,option) {			if(this.questionList[bankIndex].ques[ansIndex] && this.questionList[bankIndex].ans[ansIndex]) {								if((this.questionList[bankIndex].ques[ansIndex].indexOf(option.optionsId) != -1 ) && (this.questionList[bankIndex].ans[ansIndex].indexOf(option.optionsId) == -1)) {					return true;				} else {					return false;				}			} else {				return false;			}		},				isWrong(item,index) {			if(this.questionList[index].ques) {				//单选				if(item.type == 1) {					return this.questionList[index].ques != this.questionList[index].ans;				//多选				} else if(item.type == 2) {					//每一项都相等					return this.questionList[index].ans.some((item,i) => {						return item != this.questionList[index].ques[i];					})				//判断				} else if(item.type == 3) {					return this.questionList[index].ques != this.questionList[index].ans;				} else {					return false;				}			} else {				return false;			}					},				tabSelect(index,bankindex) {						this.$set(this.questionList[bankindex],'current',index)					},		pdsubmit() {			uni.showToast({				icon:'none',				title:'交卷成功',				duration:1000,			})						setTimeout(() => {				uni.navigateBack({					delta:1				})			},1000)		}	}};</script><style lang="scss" scoped>#questionBank {	width:100%;	height:100vh;	display: flex;	flex-direction: column;}.swiper {	width: 100%;	flex:1;}.lisSty {	margin-bottom: 16rpx;	display: flex;	align-items: center;		.flex_auto {		flex:1;	}}.activeTI {	vertical-align: middle;	display: inline-block;	border: 1rpx solid #eee;	border-radius: 50rpx;	height: 48rpx;	line-height: 46rpx;	text-align: center;	width: 48rpx;	margin-right: 15rpx;	color: #666;	font-size: 30rpx;			&.right {		color:#fff;		background:#36C75A;	}		&.wrong {		color:#fff;		background:#FF3B30;	}		&.checked {		color:#fff;		background:#007AFF;	}}.submit_checkbox {	position:fixed;	left:0;	right:0;	bottom:120rpx;	margin: 20rpx auto;	width: 526rpx;	height: 80rpx;	background: rgba(0, 122, 255, 1);	color:#fff;	text-align: center;	line-height: 80rpx;	font-size: 30rpx;	border-radius: 40rpx;		&.disabled {		opacity: 0.6;	}}.titles {	overflow: hidden;	margin-bottom: 24rpx;}.titBox {	padding: 41rpx 25rpx 24rpx 25rpx;}.titBox_title {	padding: 21rpx;}.tabs {	margin:10rpx;	display: flex;	.tab {		margin: 0 4rpx;		padding:10rpx 13rpx;		text-align: center;		color: #007aff;		font-size: 28rpx;		border-radius: 16rpx;		background:#fff;				&.current {			color:#fff;			background: #007AFF;		}	}}.ans {	margin:8rpx 8rpx 8rpx;		.ans_input {	    border-radius: 16rpx;		background:#fff;		.top {			border-bottom:1rpx solid #EEEEEE;			padding: 16rpx;			display: flex;			align-items: center;						.icon {				margin-right:20rpx;				width: 40rpx;				height: 38rpx;			}						.progress {				flex:1;			}						.submit {				width: 168rpx;				height: 48rpx;				line-height: 48rpx;				text-align: center;				color:#fff;				font-size: 30rpx;				background: #007AFF;				border-radius: 24rpx;			}		}				.textarea {			textarea {				width:100%;				height:287rpx;				padding:10rpx;			}		}				.imgs {			overflow: hidden;			display: flex;			width:100%;			.img {				width: 104rpx;				height: 104rpx;				border-radius: 8rpx;				position:relative;				margin:20rpx;												text {					position:absolute;					right:-15rpx;					top:-15rpx;					width:30rpx;					height:30rpx;					text-align: center;					line-height: 30rpx;					color:#fff;					background:#FF3B30;					border-radius:50%;				}								image {					width:100%;					height:100%;				}			}		}	}		.ans_submit {		padding:16rpx;		border-radius: 16rpx;		background:#fff;				.imgs {			overflow: hidden;			display: flex;			width:100%;			.img {				width: 104rpx;				height: 104rpx;				border-radius: 8rpx;				position:relative;				margin:20rpx;								image {					width:100%;					height:100%;				}			}		}	}}.firstLetter {	display: flex;	justify-content: space-between;	align-items: center;	margin-bottom: 30rpx;	.leftLetters {		display: flex;		align-items: center;		width: 220rpx;		.btnType {			padding: 5rpx 10rpx;			border: 1rpx solid #007aff;			border-radius: 10rpx;			background-color: rgba(0, 122, 255, 0.1);			font-size: 28rpx;			color: #007aff;			margin-right: 15rpx;		}	}}.popupView {	height: 100%;	padding-bottom: 100rpx;	.popupTops {		height: 77rpx;		border-bottom: 1rpx solid #eee;		text-align: center;		line-height: 77rpx;		font-size: 24rpx;		color: #999;		position: relative;		.topIcon {			position: absolute;			top: 10rpx;			left: 50%;			transform: translateX(-50%);			width: 80rpx;			height: 8rpx;			background-color: #999;			border-radius: 4rpx;		}	}	.popupContent {	}}.pageContent {	position:relative;	background-color: #eaeef1;	height: 100%;	overflow-y: scroll;	padding-top: 8rpx;	padding-bottom: 100rpx;}.pad_8 {	background-color: #fff;	margin: 0rpx 8rpx 8rpx;	border-radius: 16rpx;		&.no-margin {		margin-top:-16rpx;		border-radius: 0 0 16rpx 16rpx;	}}.answer {	height: 80rpx;	line-height: 80rpx;	padding: 0rpx 24rpx;	display: flex;	align-items: center;	justify-content: space-between;	color: #666;	font-size: 30rpx;}.footer_btn {	background-color: #fff;	z-index: 10078;	position: fixed;	bottom: 0rpx;	display: flex;	align-items: center;	justify-content: space-between;	width: 100%;	height: 98rpx;	padding: 0rpx 38rpx;	border-top: 1rpx solid #eee;		.flex_center {		flex:1;		display: flex;		justify-content: center;		align-items: center;		flex-direction: column;		margin:0 200rpx;		font-size: 24rpx;		color: #999999;						.up-icon {			margin-bottom:18rpx;			width:100%;			display: flex;			justify-content: center;			image {				width:58rpx;				height:21rpx;			}		}	}		.collect {		visibility: hidden;			&.show {			visibility: visible;		}				>view {			display: flex;			flex-direction: column;			align-items: center;			justify-content: center;						image {				width:32rpx;				height:32rpx;				margin-bottom:6rpx;			}						view {				font-size: 24rpx;				color: #999999;			}		}	}}.boxSty {	padding: 44rpx 41rpx 0rpx;}.liListSty {	border:1rpx solid #EEEEEE;	width: 88rpx;	height: 88rpx;	border-radius: 32rpx;	text-align: center;	line-height: 88rpx;	color: #333;	font-size: 32rpx;	float: left;	margin: 20rpx 23rpx;		&.isRight {		border:1rpx solid #EEEEEE;		color:#fff;		background: #36C75A;	}		&.isWrong {		border:1rpx solid #EEEEEE;		color:#fff;		background: #FF3B30;	}}.answerInfos {	padding: 25rpx 25rpx 25rpx 23rpx;}.answerTitle {	margin-bottom: 28rpx;	color: #666;	font-size: 30rpx;}.answerContent {	font-size: 30rpx;	color: #666;}.textChild {	display: inline-block;	vertical-align: middle;}.dialog {	position: fixed;	left:0;	top:0;	width:100%;	height:100%;	background-color: rgba(0,0,0,0.8);	display: flex;	flex-direction: column;	align-items: center;	justify-content: center;	z-index: 20000;		.pointer {		width:338rpx;		height:240rpx;	}		.text {		font-size: 32rpx;		color: #FFFFFF;		text-align: center;	}		.btn {		width: 242rpx;		height: 82rpx;		border: 2rpx solid #FFFFFF;		border-radius: 16rpx;		text-align: center;		line-height: 82rpx;		margin:41rpx auto;		color:#fff;		font-size: 32rpx;	}}</style>
 |