questionBankExplainDetail.vue 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784
  1. <template>
  2. <view class="questionBank">
  3. <view class="tabs-top">
  4. <u-tabs :list="list" sticky :current="tabCurrent" @change="tabChange" active-color="#007AFF"></u-tabs>
  5. </view>
  6. <swiper class="swiper" :current="current" @change="swiperChange" :interval="interval">
  7. <swiper-item v-for="(bank,bankIndex) in questionList" :key="bankIndex">
  8. <view class="pageContent">
  9. <view class="pad_8 titBox" >
  10. <view class="firstLetter">
  11. <view class="leftLetters">
  12. <view class="btnType">
  13. <text v-if="bank.type==1">单选</text>
  14. <text v-if="bank.type==2">多选</text>
  15. <text v-if="bank.type==3">判断</text>
  16. <text v-if="bank.type==4">案例</text>
  17. <text v-if="bank.type==5">简答</text>
  18. </view>
  19. <text>{{bankIndex+1}}/{{questionList.length}}</text>
  20. </view>
  21. <view style="color: #666;font-size: 28rpx;"></view>
  22. <view class="leftLetters"></view>
  23. </view>
  24. <view class="titles">
  25. <rich-text :nodes="bank.content"></rich-text>
  26. </view>
  27. </view>
  28. <template v-if="bank.type == 1">
  29. <view class="pad_8 titBox no-margin">
  30. <view v-if="!bank.ques">
  31. <view v-for="(item, index) in bank.jsonStr" :key="index" class="lisSty" @click="radioSelect(item.optionsId,bankIndex)">
  32. <view class="activeTI">{{ ast[index] }}</view>
  33. <view class="flex_auto">{{ item.content }}</view>
  34. </view>
  35. </view>
  36. <view v-if="bank.ques">
  37. <view v-for="(item, index) in bank.jsonStr" :key="index" class="lisSty">
  38. <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>
  39. <view class="flex_auto">{{ item.content }}</view>
  40. </view>
  41. </view>
  42. </view>
  43. <view v-if="bank.ques">
  44. <view class="pad_8 answer">
  45. <view>正确答案:{{ast[bank.ans-1]}}</view>
  46. <view v-if="!explain">我的答案:{{ast[bank.ques-1]}}</view>
  47. </view>
  48. <view class="pad_8 answerInfos">
  49. <view class="answerTitle">答案解析</view>
  50. <view class="answerContent">
  51. <rich-text :nodes="bank.analysisContent"></rich-text>
  52. </view>
  53. </view>
  54. </view>
  55. </template>
  56. <template v-if="bank.type == 2">
  57. <view class="pad_8 titBox no-margin">
  58. <view v-if="!bank.ques">
  59. <view v-for="(item, index) in bank.jsonStr" :key="index" class="lisSty" @click="checkboxSelect(item.optionsId,bankIndex,index)">
  60. <view :class="{checked:item.checked}" class="activeTI">{{ ast[index] }}</view>
  61. <view class="flex_auto">{{ item.content }}</view>
  62. </view>
  63. </view>
  64. <view v-if="!bank.ques" class="submit_checkbox" @click="checkboxSubmit(bankIndex)">
  65. 确认答案
  66. </view>
  67. <view v-if="bank.ques">
  68. <view v-for="(item, index) in bank.jsonStr" :key="index" class="lisSty">
  69. <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>
  70. <view class="flex_auto">{{ item.content }}</view>
  71. </view>
  72. </view>
  73. </view>
  74. <view v-if="bank.ques">
  75. <view class="pad_8 answer">
  76. <view>正确答案:
  77. <text :key="ansItemIndex" v-for="(ansItem,ansItemIndex) in bank.ans">{{ast[ansItem-1]}}</text>
  78. </view>
  79. <view v-if="!explain">我的答案:
  80. <text :key="quesItemIndex" v-for="(quesItem,quesItemIndex) in bank.ques">{{ast[quesItem-1]}}</text>
  81. </view>
  82. </view>
  83. <view class="pad_8 answerInfos">
  84. <view class="answerTitle">答案解析</view>
  85. <view class="answerContent">
  86. <rich-text :nodes="bank.analysisContent"></rich-text>
  87. </view>
  88. </view>
  89. </view>
  90. </template>
  91. <template v-if="bank.type == 3">
  92. <view class="pad_8 titBox no-margin">
  93. <view v-if="!bank.ques">
  94. <view v-for="(item, index) in judge" :key="index" class="lisSty" @click="judgeSelect(index,bankIndex)">
  95. <view class="activeTI">{{ ast[index] }}</view>
  96. {{ item }}
  97. </view>
  98. </view>
  99. <view v-if="bank.ques">
  100. <view v-for="(item, index) in judge" :key="index" class="lisSty">
  101. <text :class="{right:(index == bank.ques) || (index == bank.ans),wrong:(index == bank.ques) && (bank.ques != bank.ans)}" class="activeTI">{{ ast[index] }}</text>
  102. {{ item }}
  103. </view>
  104. </view>
  105. </view>
  106. <view v-if="bank.ques">
  107. <view class="pad_8 answer">
  108. <view>正确答案:{{ast[bank.ans]}}</view>
  109. <view v-if="!explain">我的答案:{{ast[bank.ques]}}</view>
  110. </view>
  111. <view class="pad_8 answerInfos">
  112. <view class="answerTitle">答案解析</view>
  113. <view class="answerContent">
  114. <rich-text :nodes="bank.analysisContent"></rich-text>
  115. </view>
  116. </view>
  117. </view>
  118. </template>
  119. <!-- 简答题 -->
  120. <template v-if="bank.type == 5">
  121. <view class="pad_8 titBox">
  122. <view class="ans">
  123. <view class="ans_input" v-if="!bank.ques || (!bank.ques.text && !bank.ques.imageList.length)">
  124. <view class="top flex">
  125. <image :data-index="bankIndex" class="icon" @click="chooseImg(bankIndex)" src="/static/camera.png" mode=""></image>
  126. <view class="progress">{{bank.ansText.imageList.length || '0'}}/4</view>
  127. <view class="submit" :class="{disabled:!bank.ansText.text && hasImgs(bank)}" @click="submitAns(bankIndex)" >确认答案</view>
  128. </view>
  129. <view class="textarea">
  130. <textarea v-model="bank.ansText.text" placeholder="在此输入答案"></textarea>
  131. </view>
  132. <view class="imgs">
  133. <view class="img" v-for="(img,imgIndex) in bank.ansText.imageList" :key="imgIndex" >
  134. <text @click="deleteImg(imgIndex,bankIndex)">x</text>
  135. <image :src="$method.splitImgHost(img, true)"></image>
  136. </view>
  137. </view>
  138. </view>
  139. <view class="ans_submit answerInfos" v-if="bank.ques && !explain">
  140. <view class="answerTitle">我的答案:</view>
  141. {{bank.ques.text}}
  142. <view class="imgs">
  143. <image class="img" :key="quesIndex" v-for="(ques,quesIndex) in bank.ques.imageList" :src="$method.splitImgHost(ques,true)"></image>
  144. </view>
  145. </view>
  146. </view>
  147. </view>
  148. <view v-if="bank.ques">
  149. <view class="pad_8 answerInfos">
  150. <view class="answerTitle">答案解析:</view>
  151. <view class="answerContent">
  152. <rich-text :nodes="bank.analysisContent"></rich-text>
  153. </view>
  154. </view>
  155. </view>
  156. </template>
  157. <!-- 案例题 -->
  158. <template v-if="bank.type == 4">
  159. <view class="tabs">
  160. <view class="tab"
  161. :class="{current:tabIndex == bank.current}"
  162. :key="tabIndex" v-for="(tab,tabIndex) in bank.jsonStr"
  163. @click="tabSelect(tabIndex,bankIndex)"
  164. >
  165. 问题{{tabIndex+1}}
  166. </view>
  167. </view>
  168. <view v-for="(ansItem,ansIndex) in bank.jsonStr" v-if="bank.current == ansIndex" :key="ansIndex">
  169. <template v-if="ansItem.type == 1">
  170. <view class="pad_8 titBox">
  171. <view class="titles">
  172. <rich-text :nodes="ansItem.content"></rich-text>
  173. </view>
  174. <view v-if="!bank.ques[ansIndex]">
  175. <view v-for="(option, childIndex) in ansItem.optionsList" :key="childIndex" class="lisSty" @click="radioSelectChild(option.optionsId,ansIndex,bankIndex)">
  176. <view class="activeTI">{{ ast[childIndex] }}</view>
  177. <rich-text class="textChild" :nodes="option.content"></rich-text>
  178. </view>
  179. </view>
  180. <view v-if="bank.ques[ansIndex]">
  181. <view v-for="(option, childIndex) in ansItem.optionsList" :key="childIndex" class="lisSty">
  182. <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>
  183. <rich-text :nodes="option.content"></rich-text>
  184. </view>
  185. </view>
  186. </view>
  187. <view v-if="bank.ques[ansIndex]">
  188. <view class="pad_8 answer">
  189. <view>正确答案:{{ast[bank.ans[ansIndex]-1]}}</view>
  190. <view v-if="!explain">我的答案:{{ast[bank.ques[ansIndex]-1]}}</view>
  191. </view>
  192. <view class="pad_8 answerInfos">
  193. <view class="answerTitle">答案解析</view>
  194. <view class="answerContent">
  195. <rich-text :nodes="option.analysisContent"></rich-text>
  196. </view>
  197. </view>
  198. </view>
  199. </template>
  200. <template v-if="ansItem.type == 2">
  201. <view class="pad_8 titBox">
  202. <view class="titles">
  203. <rich-text :nodes="ansItem.content"></rich-text>
  204. </view>
  205. <view v-if="!bank.ques[ansIndex]">
  206. <view v-for="(option, childindex) in ansItem.optionsList" :key="childindex" class="lisSty" @click="checkboxSelectChild(bankIndex,ansIndex,childindex)">
  207. <view :class="{checked:option.checked}" class="activeTI">{{ ast[childindex] }}</view>
  208. <rich-text :nodes="option.content"></rich-text>
  209. </view>
  210. </view>
  211. <view v-if="!bank.ques[ansIndex]" class="submit_checkbox" @click="checkboxSubmitChild(bankIndex,ansIndex)">
  212. 确认答案
  213. </view>
  214. <view v-if="bank.ques && bank.ques[ansIndex]">
  215. <view v-for="(option, childindex) in ansItem.optionsList" :key="childindex" class="lisSty">
  216. <text :class="{right:right(bankIndex,ansIndex,option),wrong:wrong(bankIndex,ansIndex,option)}" class="activeTI">{{ ast[childindex] }}</text>
  217. <rich-text :nodes="option.content"></rich-text>
  218. </view>
  219. </view>
  220. </view>
  221. <view v-if="bank.ques[ansIndex]">
  222. <view class="pad_8 answer">
  223. <view>正确答案:
  224. <text :key="ansItemIndex1" v-for="(ansItem1,ansItemIndex1) in bank.ans[ansIndex]">{{ast[ansItem1-1]}}</text>
  225. </view>
  226. <view v-if="!explain">我的答案:
  227. <text :key="quesItemIndex" v-for="(quesItem,quesItemIndex) in bank.ques[ansIndex]">{{ast[quesItem-1]}}</text>
  228. </view>
  229. </view>
  230. <view class="pad_8 answerInfos">
  231. <view class="answerTitle">答案解析</view>
  232. <view class="answerContent">
  233. <rich-text :nodes="ansItem.analysisContent"></rich-text>
  234. </view>
  235. </view>
  236. </view>
  237. </template>
  238. <template v-if="ansItem.type == 3">
  239. <view class="pad_8 titBox">
  240. <view class="titles">
  241. <rich-text :nodes="ansItem.content"></rich-text>
  242. </view>
  243. <view v-if="!bank.ques[ansIndex]">
  244. <view v-for="(option, childindex) in judge" :key="childindex" class="lisSty" @click="judgeSelectChild(ansIndex,childindex,bankIndex)">
  245. <view class="activeTI">{{ ast[childindex] }}</view>
  246. {{ option }}
  247. </view>
  248. </view>
  249. <view v-if="bank.ques[ansIndex]">
  250. <view v-for="(option, childindex) in judge" :key="childindex" class="lisSty">
  251. <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>
  252. {{ option }}
  253. </view>
  254. </view>
  255. </view>
  256. <view v-if="bank.ques[ansIndex]">
  257. <view class="pad_8 answer">
  258. <view>正确答案:{{ast[bank.ans[ansIndex]]}}</view>
  259. <view v-if="!explain">我的答案:{{ast[bank.ques[ansIndex]]}}</view>
  260. </view>
  261. <view class="pad_8 answerInfos">
  262. <view class="answerTitle">答案解析</view>
  263. <view class="answerContent">
  264. <rich-text :nodes="ansItem.analysisContent"></rich-text>
  265. </view>
  266. </view>
  267. </view>
  268. </template>
  269. <!-- 简答题 -->
  270. <template v-if="ansItem.type == 5">
  271. <view class="pad_8 titBox_title">
  272. <view>
  273. <rich-text :nodes="ansItem.content"></rich-text>
  274. </view>
  275. </view>
  276. <view class="pad_8 titBox_title">
  277. <view class="ans">
  278. <view class="ans_input" v-if="!bank.ques[ansIndex] || (!bank.ques[ansIndex].text && !bank.ques[ansIndex].imageList.length)">
  279. <view class="top flex">
  280. <image class="icon" @click="chooseImgChild(bankIndex,ansIndex)" src="/static/08-10_032.jpg" mode=""></image>
  281. <view class="progress">{{ansItem.ansText.imageList.length || '0'}}/4</view>
  282. <view class="submit" :class="{disabled:!ansItem.ansText.text && hasImgs(ansItem)}" @click="submitAnsChild(bankIndex,ansIndex)">确认答案</view>
  283. </view>
  284. <view class="textarea">
  285. <textarea v-model="ansItem.ansText.text" placeholder="在此输入答案"></textarea>
  286. </view>
  287. <view class="imgs">
  288. <view class="img" v-for="(img,imgIndex) in ansItem.ansText.imageList" :key="imgIndex">
  289. <text @click="deleteImgChild(imgIndex,bankIndex,ansIndex)">x</text>
  290. <image :src="$method.splitImgHost(img, true)"></image>
  291. </view>
  292. </view>
  293. </view>
  294. <view class="ans_submit answerInfos" v-if="bank.ques[ansIndex] && !explain">
  295. <view class="answerTitle">我的答案</view>
  296. {{bank.ques[ansIndex].text}}
  297. <view class="imgs">
  298. <image class="img" :key="quesIndex" v-for="(ques,quesIndex) in bank.ques[ansIndex].imageList" :src="$method.splitImgHost(ques,true)"></image>
  299. </view>
  300. </view>
  301. </view>
  302. </view>
  303. <view v-if="bank.ques[ansIndex]">
  304. <view class="pad_8 answerInfos">
  305. <view class="answerTitle">答案解析</view>
  306. <view class="answerContent">
  307. <rich-text :nodes="ansItem.analysisContent"></rich-text>
  308. </view>
  309. </view>
  310. </view>
  311. </template>
  312. </view>
  313. </template>
  314. <view class="footer_btn">
  315. <view class="collect" @click="collect(collectList[bankIndex], bankIndex)">
  316. <view v-if="collectList[bankIndex]">
  317. <image src="/static/icon/collected.png" mode=""></image>
  318. <view>取消收藏</view>
  319. </view>
  320. <view v-if="!collectList[bankIndex]">
  321. <image src="/static/icon/collect.png" mode=""></image>
  322. <view>收藏</view>
  323. </view>
  324. </view>
  325. <view class="flex_center" @click="openFooterTab">
  326. <view class="up-icon">
  327. <image src="/static/up.png"></image>
  328. </view>
  329. 答题卡
  330. </view>
  331. <view class="collect" @click="submit">
  332. <view>
  333. <image src="/static/jj.png" mode=""></image>
  334. <view>交卷</view>
  335. </view>
  336. </view>
  337. </view>
  338. </view>
  339. </swiper-item>
  340. </swiper>
  341. <u-popup v-model="show" mode="bottom" border-radius="14" height="680rpx">
  342. <view class="popupView">
  343. <view class="popupTops">
  344. <view class="topIcon"></view>
  345. 点击编号即可跳转至对应题目
  346. </view>
  347. <view class="popupContent">
  348. <scroll-view scroll-y="true" style="height: 506rpx;">
  349. <view class="boxSty">
  350. <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>
  351. </view>
  352. </scroll-view>
  353. </view>
  354. </view>
  355. </u-popup>
  356. <view class="dialog" v-if="showDialog">
  357. <image class="pointer" src="/static/pointer.png"></image>
  358. <view class="text">左右滑动切换上下题</view>
  359. <view class="btn" @click="hideDialog">我知道了</view>
  360. </view>
  361. </view>
  362. </template>
  363. <script>
  364. export default {
  365. data() {
  366. return {
  367. examId:'',
  368. tabCurrent:0,
  369. current:0,
  370. questionList:[],
  371. ast: ['A', 'B', 'C', 'D','E','F','G'],
  372. judge:['错误','正确'],
  373. show: false,
  374. showDialog:false,
  375. bankList: [],
  376. collectList:[],
  377. goodsId:'',
  378. explain:'1', //是否显示答案
  379. chapterId:'',
  380. moduleId:'',
  381. list:[{
  382. name:'对题'
  383. },{
  384. name:'错题'
  385. }]
  386. };
  387. },
  388. onLoad(option){
  389. this.examId = option.examId;
  390. this.goodsId = option.goodsId;
  391. this.chapterId = option.chapterId;
  392. this.moduleId = option.moduleId;
  393. // this.goodsQuestionList();
  394. let showDialog = uni.getStorageSync('showDialog');
  395. if(showDialog) {
  396. this.showDialog = false;
  397. } else {
  398. this.showDialog = true;
  399. uni.setStorageSync('showDialog','1');
  400. }
  401. if(this.tabCurrent == 0) {
  402. this.examRecordRightList();
  403. } else {
  404. this.examRecordWrongList();
  405. }
  406. },
  407. onUnload() {
  408. },
  409. methods: {
  410. tabChange(e) {
  411. this.tabCurrent = e;
  412. if(this.tabCurrent == 0) {
  413. this.examRecordRightList();
  414. } else {
  415. this.examRecordWrongList();
  416. }
  417. },
  418. /**
  419. * 是否有上传图片
  420. */
  421. hasImgs(bank) {
  422. return bank.ansText.imageList.length == 0;
  423. },
  424. /**
  425. * 获取错题列表
  426. */
  427. examRecordWrongList() {
  428. this.$api.examRecordWrongList({
  429. examId:this.examId,
  430. goodsId:this.goodsId
  431. }).then(res => {
  432. res.data.rows.forEach((item,index) => {
  433. if(typeof item.jsonStr == 'string') {
  434. item.jsonStr = JSON.parse(item.jsonStr)
  435. if(item.type == 2) { //多选
  436. item.jsonStr.forEach(str => {
  437. str.optionsId = ''+str.optionsId;
  438. })
  439. let arr = item.answerQuestion.split(',');
  440. arr.forEach((a,i) => {
  441. arr[i] = ''+a;
  442. })
  443. item.ans = arr;
  444. if(this.explain) {
  445. item.ques = item.ans;
  446. }
  447. return;
  448. } else if(item.type == 5) {
  449. item.ansText = {
  450. text: '',
  451. imageList: []
  452. }
  453. if(this.explain) {
  454. item.ques = {
  455. text:item.analysisContent
  456. }
  457. return;
  458. }
  459. } else if(item.type == 4) {
  460. console.log(item.jsonStr)
  461. item.ques = []
  462. item.current = 0;
  463. let ansArr = [];
  464. item.jsonStr.forEach((json,index) => {
  465. if(json.type == 1) {
  466. ansArr[index] = json.answerQuestion;
  467. } else if(json.type == 2) {
  468. json.optionsList.forEach(str => {
  469. str.optionsId = ''+str.optionsId;
  470. })
  471. let arr = json.answerQuestion.split(',');
  472. arr.forEach((a,i) => {
  473. arr[i] = ''+a;
  474. })
  475. ansArr[index] = arr
  476. } else if(json.type == 3) {
  477. ansArr[index] = json.answerQuestion;
  478. } else if(json.type == 5) {
  479. ansArr[index] = {
  480. text: '',
  481. imageList: []
  482. }
  483. json.ansText = {
  484. text: '',
  485. imageList: []
  486. }
  487. }
  488. })
  489. item.ans = ansArr
  490. if(this.explain) {
  491. item.ques = item.ans;
  492. }
  493. return;
  494. }
  495. item.ans = item.answerQuestion
  496. if(this.explain) {
  497. item.ques = item.ans;
  498. }
  499. } else {
  500. if(this.explain) {
  501. item.ques = item.ans;
  502. }
  503. }
  504. })
  505. this.questionList = res.data.rows;
  506. })
  507. },
  508. /**
  509. * 获取对题列表
  510. */
  511. examRecordRightList() {
  512. this.$api.examRecordRightList({
  513. examId:this.examId,
  514. goodsId:this.goodsId
  515. }).then(res => {
  516. res.data.rows.forEach((item,index) => {
  517. if(typeof item.jsonStr == 'string') {
  518. item.jsonStr = JSON.parse(item.jsonStr)
  519. if(item.type == 2) { //多选
  520. item.jsonStr.forEach(str => {
  521. str.optionsId = ''+str.optionsId;
  522. })
  523. let arr = item.answerQuestion.split(',');
  524. arr.forEach((a,i) => {
  525. arr[i] = ''+a;
  526. })
  527. item.ans = arr;
  528. if(this.explain) {
  529. item.ques = item.ans;
  530. }
  531. return;
  532. } else if(item.type == 5) {
  533. item.ansText = {
  534. text: '',
  535. imageList: []
  536. }
  537. if(this.explain) {
  538. item.ques = {
  539. text:item.analysisContent
  540. }
  541. return;
  542. }
  543. } else if(item.type == 4) {
  544. console.log(item.jsonStr)
  545. item.ques = []
  546. item.current = 0;
  547. let ansArr = [];
  548. item.jsonStr.forEach((json,index) => {
  549. if(json.type == 1) {
  550. ansArr[index] = json.answerQuestion;
  551. } else if(json.type == 2) {
  552. json.optionsList.forEach(str => {
  553. str.optionsId = ''+str.optionsId;
  554. })
  555. let arr = json.answerQuestion.split(',');
  556. arr.forEach((a,i) => {
  557. arr[i] = ''+a;
  558. })
  559. ansArr[index] = arr
  560. } else if(json.type == 3) {
  561. ansArr[index] = json.answerQuestion;
  562. } else if(json.type == 5) {
  563. ansArr[index] = {
  564. text: '',
  565. imageList: []
  566. }
  567. json.ansText = {
  568. text: '',
  569. imageList: []
  570. }
  571. }
  572. })
  573. item.ans = ansArr
  574. if(this.explain) {
  575. item.ques = item.ans;
  576. }
  577. return;
  578. }
  579. item.ans = item.answerQuestion
  580. if(this.explain) {
  581. item.ques = item.ans;
  582. }
  583. } else {
  584. if(this.explain) {
  585. item.ques = item.ans;
  586. }
  587. }
  588. })
  589. this.questionList = res.data.rows;
  590. })
  591. },
  592. /**
  593. * @param {Object} state
  594. * @param {Object} index
  595. * 收藏
  596. */
  597. collect(state, index) {
  598. if (!state) {
  599. this.$api
  600. .collectQuestion({
  601. examId: this.id,
  602. questionId: this.questionList[index].questionId,
  603. goodsId: this.goodsId || ''
  604. })
  605. .then(res => {
  606. if (res.data.code == 200) {
  607. this.$set(this.collectList, index, true);
  608. uni.showToast({
  609. title: '收藏成功',
  610. duration: 2000,
  611. icon: 'none'
  612. });
  613. this.getCollectInfo(index)
  614. }
  615. });
  616. } else {
  617. this.$api.deleteCollectQuestion(this.collectList[index].collectQuestionId).then(res => {
  618. if (res.data.code == 200) {
  619. this.$set(this.collectList, index, false);
  620. uni.showToast({
  621. title: '取消收藏成功',
  622. duration: 2000,
  623. icon: 'none'
  624. });
  625. }
  626. });
  627. }
  628. return;
  629. },
  630. goodsQuestionList() {
  631. //继续答题
  632. if(this.isContinue || this.isHistory) {
  633. console.log(this.isHistory,"历史做题")
  634. console.log(this.isContinue,"继续做题")
  635. this.$api.examReport(this.recordId).then(res => {
  636. let json = JSON.parse(res.data.data.historyExamJson)
  637. this.questionList = json;
  638. })
  639. } else { //解析
  640. this.$api.goodsQuestionList({
  641. examId:this.id
  642. }).then(res => {
  643. res.data.data.forEach((item,index) => {
  644. if(typeof item.jsonStr == 'string') {
  645. item.jsonStr = JSON.parse(item.jsonStr)
  646. if(item.type == 2) { //多选
  647. item.jsonStr.forEach(str => {
  648. str.optionsId = ''+str.optionsId;
  649. })
  650. let arr = item.answerQuestion.split(',');
  651. arr.forEach((a,i) => {
  652. arr[i] = ''+a;
  653. })
  654. item.ans = arr;
  655. if(this.explain) {
  656. item.ques = item.ans;
  657. }
  658. return;
  659. } else if(item.type == 5) {
  660. item.ansText = {
  661. text: '',
  662. imageList: []
  663. }
  664. if(this.explain) {
  665. item.ques = {
  666. text:item.analysisContent
  667. }
  668. return;
  669. }
  670. } else if(item.type == 4) {
  671. console.log(item.jsonStr)
  672. item.ques = []
  673. item.current = 0;
  674. let ansArr = [];
  675. item.jsonStr.forEach((json,index) => {
  676. if(json.type == 1) {
  677. ansArr[index] = json.answerQuestion;
  678. } else if(json.type == 2) {
  679. json.optionsList.forEach(str => {
  680. str.optionsId = ''+str.optionsId;
  681. })
  682. let arr = json.answerQuestion.split(',');
  683. arr.forEach((a,i) => {
  684. arr[i] = ''+a;
  685. })
  686. ansArr[index] = arr
  687. } else if(json.type == 3) {
  688. ansArr[index] = json.answerQuestion;
  689. } else if(json.type == 5) {
  690. ansArr[index] = {
  691. text: '',
  692. imageList: []
  693. }
  694. json.ansText = {
  695. text: '',
  696. imageList: []
  697. }
  698. }
  699. })
  700. item.ans = ansArr
  701. if(this.explain) {
  702. item.ques = item.ans;
  703. }
  704. return;
  705. }
  706. item.ans = item.answerQuestion
  707. if(this.explain) {
  708. item.ques = item.ans;
  709. }
  710. } else {
  711. if(this.explain) {
  712. item.ques = item.ans;
  713. }
  714. }
  715. })
  716. this.questionList = res.data.data;
  717. this.getCollectInfo(this.current);
  718. console.log(this.questionList)
  719. })
  720. }
  721. },
  722. /**
  723. * @param {Object} current
  724. * 获取收藏信息
  725. */
  726. getCollectInfo(current) {
  727. this.$api
  728. .getCollectInfo({
  729. examId: this.id,
  730. questionId: this.questionList[current].questionId,
  731. goodsId: this.goodsId
  732. })
  733. .then(res => {
  734. if (res.data.code == 500) {
  735. this.$set(this.collectList, current, false);
  736. } else if (res.data.code == 200) {
  737. this.$set(this.collectList, current, res.data.data);
  738. }
  739. });
  740. },
  741. /**
  742. * @param {Object} e单选点击
  743. */
  744. radioSelect(optionsId,bindex) {
  745. if(this.questionList[bindex].ques) return;
  746. this.$set(this.questionList[bindex],'ques',optionsId)
  747. },
  748. examRecordEdit() {
  749. if(!this.isSubmit) {
  750. let number = 0;
  751. let score = 0;
  752. let doQuestionNum = 0;
  753. this.questionList.length && this.questionList.forEach((item,index) => {
  754. if(item.type == 1) {
  755. if(item.ques == item.ans) {
  756. score += item.score;
  757. number++
  758. }
  759. if (item.ques) {
  760. doQuestionNum++;
  761. }
  762. } else if(item.type == 2) {
  763. let isRight = item.ques && item.ques.every((quesItem,quesIndex) => {
  764. return item.ques[quesIndex] == item.ans[quesIndex]
  765. })
  766. if(isRight) {
  767. score += item.score;
  768. number++
  769. }
  770. if (item.ques && item.ques.length) {
  771. doQuestionNum++;
  772. }
  773. } else if(item.type == 3) {
  774. if(item.ques == item.ans) {
  775. score += item.score;
  776. number++
  777. }
  778. if (item.ques) {
  779. doQuestionNum++;
  780. }
  781. } else if (item == 4) {
  782. if (item.ques.length) {
  783. doQuestionNum++;
  784. }
  785. } else if (item.type == 5) {
  786. if (item.ques) {
  787. doQuestionNum++;
  788. }
  789. }
  790. })
  791. this.$api.examRecordEdit({
  792. examId:this.id,
  793. goodsId:this.goodsId,
  794. recordId: this.recordId,
  795. rightQuestionNum:number,
  796. status:0,
  797. moduleExamId:this.moduleId || 0,
  798. chapterExamId:this.chapterId || 0,
  799. doQuestionNum: doQuestionNum,
  800. historyExamJson:JSON.stringify(this.questionList)
  801. }).then(res => {
  802. })
  803. }
  804. },
  805. /**
  806. * @param {Object} e单选点击
  807. */
  808. radioSelectChild(optionsId,ansIndex,bindex) {
  809. if(this.questionList[bindex].ques[ansIndex]) return;
  810. this.$set(this.questionList[bindex].ques,ansIndex,optionsId)
  811. },
  812. /**
  813. * @param {Object} 多选点击
  814. */
  815. checkboxSelect(optionsId,bindex,index) {
  816. this.$set(this.questionList[bindex].jsonStr[index],'checked',!this.questionList[bindex].jsonStr[index].checked)
  817. },
  818. /**
  819. * @param {Object} 多选点击
  820. */
  821. checkboxSelectChild(bindex,ansIndex,childIndex) {
  822. this.$set(this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex],'checked',!this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex].checked)
  823. },
  824. /**
  825. * 提交数据
  826. */
  827. submit() {
  828. let score = 0; //计算总分
  829. let reportStatus = 0;
  830. let number = 0;
  831. let allScore = 0;
  832. let passScore = 0;
  833. let doWrongQuestionIds = []; //错题和未做题id(客观题)
  834. let doQuestionIds = []; //做过的题目id
  835. let rightQuestionIds = []; //做对的题目id
  836. this.questionList.forEach((item,index) => {
  837. passScore = item.passScore
  838. if(item.type == 1) {
  839. if(item.ques == item.ans) {
  840. score += item.score;
  841. number++
  842. rightQuestionIds.push(item.questionId)
  843. } else { //错误
  844. doWrongQuestionIds.push(item.questionId)
  845. }
  846. allScore += item.score
  847. if (item.ques) {
  848. doQuestionNum++;
  849. doQuestionIds.push(item.questionId)
  850. }
  851. } else if(item.type == 2) {
  852. let isRight = item.ans && item.ans.every((quesItem,quesIndex) => {
  853. if(item.ques) {
  854. return item.ques[quesIndex] == item.ans[quesIndex]
  855. } else {
  856. return false;
  857. }
  858. })
  859. if(isRight) {
  860. score += item.score;
  861. number++
  862. rightQuestionIds.push(item.questionId)
  863. } else {
  864. let checkboxScore = item.score; //获取单题总分数
  865. item.ques.forEach((ques,quesIndex) => {
  866. //选错一个全扣
  867. if(item.ques) {
  868. if(item.ans.indexOf(item.ques[quesIndex]) == -1) {
  869. checkboxScore = 0;
  870. }
  871. } else {
  872. checkboxScore = 0;
  873. }
  874. })
  875. console.log(checkboxScore)
  876. //没选错
  877. if(checkboxScore) {
  878. item.ans.forEach((ans,quesIndex) => {
  879. //漏选扣一部分
  880. if(item.ques) {
  881. if(item.ques.indexOf(item.ans[quesIndex]) == -1) {
  882. checkboxScore -= item.partScore;
  883. }
  884. } else {
  885. checkboxScore = 0;
  886. }
  887. })
  888. }
  889. if(checkboxScore <= 0) { //0分
  890. item.scoreResult = 0;
  891. doWrongQuestionIds.push(item.questionId)
  892. } else { //部分分
  893. number++;
  894. item.scoreResult = checkboxScore;
  895. score += checkboxScore;
  896. rightQuestionIds.push(item.questionId)
  897. }
  898. }
  899. allScore += item.score;
  900. if (item.ques && item.ques.length) {
  901. doQuestionNum++;
  902. doQuestionIds.push(item.questionId)
  903. }
  904. } else if(item.type == 3) {
  905. if(item.ques == item.ans) {
  906. score += item.score;
  907. number++
  908. rightQuestionIds.push(item.questionId)
  909. } else {
  910. doWrongQuestionIds.push(item.questionId)
  911. }
  912. allScore += item.score;
  913. if (item.ques) {
  914. doQuestionNum++;
  915. doQuestionIds.push(item.questionId)
  916. }
  917. } else if (item.type == 4) {
  918. if (item.ques && item.ques.length) {
  919. doQuestionNum++;
  920. }
  921. } else if (item.type == 5) {
  922. if (item.ques) {
  923. doQuestionNum++;
  924. }
  925. }
  926. })
  927. //大于60分及格
  928. if(score >= passScore) {
  929. reportStatus = 1
  930. } else {
  931. reportStatus = 0
  932. }
  933. this.$api.examRecordEdit({
  934. examId:this.id,
  935. goodsId:this.goodsId,
  936. reportStatus:reportStatus,
  937. totalScore:allScore,
  938. recordId: this.recordId,
  939. rightQuestionNum:number,
  940. status:1,
  941. moduleExamId:this.moduleId || 0,
  942. chapterExamId:this.chapterId || 0,
  943. doQuestionIds:doQuestionIds.join(','),
  944. rightQuestionIds:rightQuestionIds.join(','),
  945. doQuestionNum: doQuestionNum,
  946. performance: score,
  947. historyExamJson:JSON.stringify(this.questionList)
  948. }).then(res => {
  949. this.isSubmit = true;
  950. if(res.data.code == 200) {
  951. uni.showToast({
  952. title: '交卷成功',
  953. duration: 2000,
  954. icon:'none'
  955. });
  956. setTimeout(() => {
  957. uni.redirectTo({
  958. url:'/pages2/bank/question_report?id='+this.recordId+'&examId='+this.id
  959. })
  960. },2000)
  961. }
  962. })
  963. },
  964. /**
  965. * @param {Object} 多选确认
  966. */
  967. checkboxSubmit(bindex) {
  968. if(this.questionList[bindex].ques) return;
  969. let arr = [];
  970. this.questionList[bindex].jsonStr.forEach(item => {
  971. if(item.checked) {
  972. arr.push(item.optionsId)
  973. }
  974. })
  975. this.$set(this.questionList[bindex],'ques',arr)
  976. },
  977. /**
  978. * @param {Object} 多选确认
  979. */
  980. checkboxSubmitChild(bindex,ansIndex) {
  981. if(this.questionList[bindex].ques[ansIndex]) return;
  982. let arr = [];
  983. this.questionList[bindex].jsonStr[ansIndex].optionsList.forEach(item => {
  984. if(item.checked) {
  985. arr.push(item.optionsId)
  986. }
  987. })
  988. this.$set(this.questionList[bindex].ques,ansIndex,arr)
  989. },
  990. judgeSelect(index,bindex) {
  991. if(this.questionList[bindex].ques) return;
  992. this.$set(this.questionList[bindex],'ques',index+'')
  993. },
  994. judgeSelectChild(ansindex,childindex,bindex) {
  995. if(this.questionList[bindex].ques[ansindex]) return;
  996. this.$set(this.questionList[bindex].ques,ansindex,childindex+'')
  997. },
  998. openFooterTab() {
  999. this.show = true;
  1000. },
  1001. hideDialog() {
  1002. this.showDialog = false
  1003. },
  1004. changeIndex(index) {
  1005. this.current = index
  1006. },
  1007. swiperChange(e) {
  1008. this.current = e.detail.current;
  1009. },
  1010. deleteImg(imgIndex,bankIndex) {
  1011. this.questionList[bankIndex].ansText.imageList.splice(imgIndex,1)
  1012. },
  1013. deleteImgChild(imgIndex,bankIndex,ansIndex) {
  1014. this.questionList[bankIndex].jsonStr[ansIndex].ansText.imageList.splice(imgIndex,1)
  1015. },
  1016. chooseImg(bankindex) {
  1017. uni.chooseImage({
  1018. count: 1, //默认9
  1019. sizeType: ['compressed', ], //可以指定是原图还是压缩图,默认二者都有
  1020. sourceType: ['album','camera'], //从相册选择
  1021. success: (res) => {
  1022. let self = this;
  1023. // console.log(JSON.stringify(res.tempFilePaths));
  1024. let img = res.tempFilePaths[0];
  1025. uni.getImageInfo({
  1026. src: img,
  1027. success: async res => {
  1028. let canvasWidth = res.width; //图片原始长宽
  1029. let canvasHeight = res.height;
  1030. if (canvasWidth > 1000 || canvasHeight > 1000) {
  1031. uni.compressImage({
  1032. src: img,
  1033. quality: 75,
  1034. width: '50%',
  1035. height: '50%',
  1036. success: async rest => {
  1037. const dir = await self.uploadFile(rest.tempFilePath, 0);
  1038. this.questionList[bankindex].ansText.imageList.push(dir)
  1039. }
  1040. });
  1041. } else {
  1042. const dir = await self.uploadFile(img, 0);
  1043. this.questionList[bankindex].ansText.imageList.push(dir)
  1044. }
  1045. }
  1046. });
  1047. }
  1048. })
  1049. },
  1050. chooseImgChild(bankindex,ansindex) {
  1051. uni.chooseImage({
  1052. count: 1, //默认9
  1053. sizeType: ['compressed', ], //可以指定是原图还是压缩图,默认二者都有
  1054. sourceType: ['album','camera'], //从相册选择
  1055. success: (res) => {
  1056. let self = this;
  1057. // console.log(JSON.stringify(res.tempFilePaths));
  1058. let img = res.tempFilePaths[0];
  1059. uni.getImageInfo({
  1060. src: img,
  1061. success: async res => {
  1062. let canvasWidth = res.width; //图片原始长宽
  1063. let canvasHeight = res.height;
  1064. if (canvasWidth > 1000 || canvasHeight > 1000) {
  1065. uni.compressImage({
  1066. src: img,
  1067. quality: 75,
  1068. width: '50%',
  1069. height: '50%',
  1070. success: async rest => {
  1071. const dir = await self.uploadFile(rest.tempFilePath, 0);
  1072. this.questionList[bankindex].jsonStr[ansindex].ansText.imageList.push(dir)
  1073. }
  1074. });
  1075. } else {
  1076. const dir = await self.uploadFile(img, 0);
  1077. this.questionList[bankindex].jsonStr[ansindex].ansText.imageList.push(dir)
  1078. }
  1079. }
  1080. });
  1081. }
  1082. })
  1083. },
  1084. uploadFile(options, int) {
  1085. var self = this;
  1086. return new Promise((resolve, reject) => {
  1087. var data = {
  1088. imageStatus: int
  1089. };
  1090. self.$api.aliyunpolicy(data).then(res => {
  1091. console.log(res.data,6)
  1092. if(res.data.code!=200){
  1093. self.$method.showToast('签名错误'+JSON.stringify(res.data))
  1094. return
  1095. }
  1096. var ossToken = res.data.data.resultContent;
  1097. if(ossToken.host==null||ossToken.host==undefined){
  1098. self.$method.showToast('上传路径报错'+JSON.stringify(res.data))
  1099. return
  1100. }
  1101. uni.uploadFile({
  1102. url: ossToken.host,
  1103. name: 'file',
  1104. filePath: options,
  1105. fileType: 'image',
  1106. header: {
  1107. AuthorizationToken: 'WX ' + uni.getStorageSync('token')
  1108. },
  1109. formData: {
  1110. key: ossToken.dir,
  1111. OSSAccessKeyId: ossToken.accessid,
  1112. policy: ossToken.policy,
  1113. Signature: ossToken.signature,
  1114. callback: ossToken.callback,
  1115. success_action_status: 200
  1116. },
  1117. success: result => {
  1118. if (result.statusCode === 200) {
  1119. resolve(ossToken.dir);
  1120. } else {
  1121. uni.showToast({
  1122. title: '上传失败',
  1123. icon: 'none'
  1124. });
  1125. return;
  1126. }
  1127. },
  1128. fail: error => {
  1129. uni.showToast({
  1130. title: '上传接口报错'+error,
  1131. icon: 'none'
  1132. });
  1133. return;
  1134. }
  1135. });
  1136. });
  1137. });
  1138. },
  1139. submitAns(bankindex) {
  1140. console.log(this.questionList[bankindex])
  1141. if(!this.questionList[bankindex].ansText.text && !this.questionList[bankindex].ansText.imageList.length) {
  1142. uni.showToast({
  1143. title: '请输入内容或上传图片',
  1144. duration: 2000,
  1145. icon:'none'
  1146. });
  1147. return
  1148. }
  1149. this.$set(this.questionList[bankindex],'ques',{
  1150. imageList:this.questionList[bankindex].ansText.imageList,
  1151. text:this.questionList[bankindex].ansText.text,
  1152. })
  1153. },
  1154. submitAnsChild(bankindex,ansindex) {
  1155. if(!this.questionList[bankindex].jsonStr[ansindex].ansText.text && !this.questionList[bankindex].jsonStr[ansindex].ansText.imageList.length) {
  1156. uni.showToast({
  1157. title: '请输入内容或上传图片',
  1158. duration: 2000,
  1159. icon:'none'
  1160. });
  1161. return
  1162. }
  1163. this.$set(this.questionList[bankindex].ques,ansindex,{
  1164. imageList:this.questionList[bankindex].jsonStr[ansindex].ansText.imageList,
  1165. text:this.questionList[bankindex].jsonStr[ansindex].ansText.text,
  1166. })
  1167. },
  1168. isRight(item,index) {
  1169. //单选
  1170. if(this.questionList[index].ques) {
  1171. if(item.type == 1) {
  1172. return this.questionList[index].ques == this.questionList[index].ans;
  1173. //多选
  1174. } else if(item.type == 2) {
  1175. //每一项都相等
  1176. return this.questionList[index].ques.every((item,i) => {
  1177. console.log(item == this.questionList[index].ans[i])
  1178. return item == this.questionList[index].ans[i];
  1179. })
  1180. //判断
  1181. } else if(item.type == 3) {
  1182. return this.questionList[index].ques == this.questionList[index].ans;
  1183. } else {
  1184. return false;
  1185. }
  1186. } else {
  1187. return false;
  1188. }
  1189. },
  1190. right(bankIndex,ansIndex,option) {
  1191. if(this.questionList[bankIndex].ques[ansIndex] && this.questionList[bankIndex].ans[ansIndex]) {
  1192. if((this.questionList[bankIndex].ques[ansIndex].indexOf(option.optionsId) != -1 ) || (this.questionList[bankIndex].ans[ansIndex].indexOf(option.optionsId) != -1)) {
  1193. return true
  1194. } else {
  1195. return false;
  1196. }
  1197. } else {
  1198. return false;
  1199. }
  1200. },
  1201. wrong(bankIndex,ansIndex,option) {
  1202. if(this.questionList[bankIndex].ques[ansIndex] && this.questionList[bankIndex].ans[ansIndex]) {
  1203. if((this.questionList[bankIndex].ques[ansIndex].indexOf(option.optionsId) != -1 ) && (this.questionList[bankIndex].ans[ansIndex].indexOf(option.optionsId) == -1)) {
  1204. return true;
  1205. } else {
  1206. return false;
  1207. }
  1208. } else {
  1209. return false;
  1210. }
  1211. },
  1212. isWrong(item,index) {
  1213. if(this.questionList[index].ques) {
  1214. //单选
  1215. if(item.type == 1) {
  1216. return this.questionList[index].ques != this.questionList[index].ans;
  1217. //多选
  1218. } else if(item.type == 2) {
  1219. //每一项都相等
  1220. return this.questionList[index].ques.some((item,i) => {
  1221. return item != this.questionList[index].ans[i];
  1222. })
  1223. //判断
  1224. } else if(item.type == 3) {
  1225. return this.questionList[index].ques != this.questionList[index].ans;
  1226. } else {
  1227. return false;
  1228. }
  1229. } else {
  1230. return false;
  1231. }
  1232. },
  1233. tabSelect(index,bankindex) {
  1234. this.$set(this.questionList[bankindex],'current',index)
  1235. },
  1236. }
  1237. };
  1238. </script>
  1239. <style lang="scss" scoped>
  1240. .questionBank {
  1241. width:100%;
  1242. height:100vh;
  1243. display: flex;
  1244. flex-direction: column;
  1245. }
  1246. .tabs-top {
  1247. display: flex;
  1248. justify-content: center;
  1249. margin-bottom:10rpx;
  1250. }
  1251. .swiper {
  1252. width:100%;
  1253. flex:1;
  1254. }
  1255. .lisSty {
  1256. margin-bottom: 16rpx;
  1257. display: flex;
  1258. .flex_auto {
  1259. flex:1;
  1260. }
  1261. }
  1262. .activeTI {
  1263. vertical-align: middle;
  1264. display: inline-block;
  1265. border: 1rpx solid #eee;
  1266. border-radius: 50rpx;
  1267. height: 48rpx;
  1268. line-height: 46rpx;
  1269. text-align: center;
  1270. width: 48rpx;
  1271. margin-right: 15rpx;
  1272. color: #666;
  1273. font-size: 30rpx;
  1274. &.right {
  1275. color:#fff;
  1276. background:green;
  1277. }
  1278. &.wrong {
  1279. color:#fff;
  1280. background:red;
  1281. }
  1282. &.checked {
  1283. color:#fff;
  1284. background:#007AFF;
  1285. }
  1286. }
  1287. .submit_checkbox {
  1288. margin:20rpx auto;
  1289. width: 526rpx;
  1290. height: 80rpx;
  1291. background: rgba(0, 122, 255, 1);
  1292. color:#fff;
  1293. text-align: center;
  1294. line-height: 80rpx;
  1295. font-size: 30rpx;
  1296. border-radius: 40rpx;
  1297. }
  1298. .titles {
  1299. overflow: hidden;
  1300. margin-bottom: 24rpx;
  1301. }
  1302. .titBox {
  1303. padding: 41rpx 25rpx 24rpx 25rpx;
  1304. }
  1305. .titBox_title {
  1306. padding: 21rpx;
  1307. }
  1308. .tabs {
  1309. margin:10rpx;
  1310. display: flex;
  1311. .tab {
  1312. margin: 0 4rpx;
  1313. padding:10rpx 13rpx;
  1314. text-align: center;
  1315. color: #007aff;
  1316. font-size: 28rpx;
  1317. border-radius: 16rpx;
  1318. background:#fff;
  1319. &.current {
  1320. color:#fff;
  1321. background: #007AFF;
  1322. }
  1323. }
  1324. }
  1325. .ans {
  1326. margin:8rpx 8rpx 8rpx;
  1327. .ans_input {
  1328. border-radius: 16rpx;
  1329. background:#fff;
  1330. .top {
  1331. border-bottom:1rpx solid #EEEEEE;
  1332. padding: 16rpx;
  1333. display: flex;
  1334. align-items: center;
  1335. .icon {
  1336. margin-right:20rpx;
  1337. width: 40rpx;
  1338. height: 38rpx;
  1339. }
  1340. .progress {
  1341. flex:1;
  1342. }
  1343. .submit {
  1344. width: 168rpx;
  1345. height: 48rpx;
  1346. line-height: 48rpx;
  1347. text-align: center;
  1348. color:#fff;
  1349. font-size: 30rpx;
  1350. background: #007AFF;
  1351. border-radius: 24rpx;
  1352. &.disabled {
  1353. opacity: 0.6;
  1354. }
  1355. }
  1356. }
  1357. .textarea {
  1358. textarea {
  1359. width:100%;
  1360. height:287rpx;
  1361. padding:10rpx;
  1362. }
  1363. }
  1364. .imgs {
  1365. overflow: hidden;
  1366. display: flex;
  1367. width:100%;
  1368. .img {
  1369. width: 104rpx;
  1370. height: 104rpx;
  1371. border-radius: 8rpx;
  1372. position:relative;
  1373. margin:20rpx;
  1374. text {
  1375. position:absolute;
  1376. right:-15rpx;
  1377. top:-15rpx;
  1378. width:30rpx;
  1379. height:30rpx;
  1380. text-align: center;
  1381. line-height: 30rpx;
  1382. color:#fff;
  1383. background:red;
  1384. border-radius:50%;
  1385. }
  1386. image {
  1387. width:100%;
  1388. height:100%;
  1389. }
  1390. }
  1391. }
  1392. }
  1393. .ans_submit {
  1394. padding:16rpx;
  1395. border-radius: 16rpx;
  1396. background:#fff;
  1397. .imgs {
  1398. overflow: hidden;
  1399. display: flex;
  1400. width:100%;
  1401. .img {
  1402. width: 104rpx;
  1403. height: 104rpx;
  1404. border-radius: 8rpx;
  1405. position:relative;
  1406. margin:20rpx;
  1407. image {
  1408. width:100%;
  1409. height:100%;
  1410. }
  1411. }
  1412. }
  1413. }
  1414. }
  1415. .firstLetter {
  1416. display: flex;
  1417. justify-content: space-between;
  1418. align-items: center;
  1419. margin-bottom: 30rpx;
  1420. .leftLetters {
  1421. display: flex;
  1422. align-items: center;
  1423. width: 220rpx;
  1424. .btnType {
  1425. padding: 5rpx 10rpx;
  1426. border: 1rpx solid #007aff;
  1427. border-radius: 10rpx;
  1428. background-color: rgba(0, 122, 255, 0.1);
  1429. font-size: 28rpx;
  1430. color: #007aff;
  1431. margin-right: 15rpx;
  1432. }
  1433. }
  1434. }
  1435. .popupView {
  1436. height: 100%;
  1437. padding-bottom: 100rpx;
  1438. .popupTops {
  1439. height: 77rpx;
  1440. border-bottom: 1rpx solid #eee;
  1441. text-align: center;
  1442. line-height: 77rpx;
  1443. font-size: 24rpx;
  1444. color: #999;
  1445. position: relative;
  1446. .topIcon {
  1447. position: absolute;
  1448. top: 10rpx;
  1449. left: 50%;
  1450. transform: translateX(-50%);
  1451. width: 80rpx;
  1452. height: 8rpx;
  1453. background-color: #999;
  1454. border-radius: 4rpx;
  1455. }
  1456. }
  1457. .popupContent {
  1458. }
  1459. }
  1460. .pageContent {
  1461. position:relative;
  1462. background-color: #eaeef1;
  1463. height: 100%;
  1464. overflow-y: scroll;
  1465. padding-top: 8rpx;
  1466. padding-bottom: 100rpx;
  1467. }
  1468. .pad_8 {
  1469. background-color: #fff;
  1470. margin: 0rpx 8rpx 8rpx;
  1471. border-radius: 16rpx;
  1472. &.no-margin {
  1473. margin-top:-16rpx;
  1474. border-radius: 0 0 16rpx 16rpx;
  1475. }
  1476. }
  1477. .answer {
  1478. height: 80rpx;
  1479. line-height: 80rpx;
  1480. padding: 0rpx 24rpx;
  1481. display: flex;
  1482. align-items: center;
  1483. justify-content: space-between;
  1484. color: #666;
  1485. font-size: 30rpx;
  1486. }
  1487. .footer_btn {
  1488. background-color: #fff;
  1489. z-index: 10078;
  1490. position: fixed;
  1491. bottom: 0rpx;
  1492. display: flex;
  1493. align-items: center;
  1494. justify-content: space-between;
  1495. width: 100%;
  1496. height: 98rpx;
  1497. padding: 0rpx 38rpx;
  1498. border-top: 1rpx solid #eee;
  1499. .flex_center {
  1500. flex:1;
  1501. display: flex;
  1502. justify-content: center;
  1503. align-items: center;
  1504. flex-direction: column;
  1505. margin:0 200rpx;
  1506. font-size: 24rpx;
  1507. color: #999999;
  1508. .up-icon {
  1509. margin-bottom:18rpx;
  1510. width:100%;
  1511. display: flex;
  1512. justify-content: center;
  1513. image {
  1514. width:58rpx;
  1515. height:21rpx;
  1516. }
  1517. }
  1518. }
  1519. .collect {
  1520. visibility: hidden;
  1521. width:100rpx;
  1522. &.show {
  1523. visibility: visible;
  1524. }
  1525. >view {
  1526. display: flex;
  1527. flex-direction: column;
  1528. align-items: center;
  1529. justify-content: center;
  1530. image {
  1531. width:32rpx;
  1532. height:32rpx;
  1533. margin-bottom:6rpx;
  1534. }
  1535. view {
  1536. font-size: 24rpx;
  1537. color: #999999;
  1538. }
  1539. }
  1540. }
  1541. }
  1542. .boxSty {
  1543. padding: 44rpx 41rpx 0rpx;
  1544. }
  1545. .liListSty {
  1546. border:1rpx solid #EEEEEE;
  1547. width: 88rpx;
  1548. height: 88rpx;
  1549. border-radius: 32rpx;
  1550. text-align: center;
  1551. line-height: 88rpx;
  1552. color: #333;
  1553. font-size: 32rpx;
  1554. float: left;
  1555. margin: 20rpx 23rpx;
  1556. &.isRight {
  1557. border:1rpx solid #EEEEEE;
  1558. color:#fff;
  1559. background: green;
  1560. }
  1561. &.isWrong {
  1562. border:1rpx solid #EEEEEE;
  1563. color:#fff;
  1564. background: red;
  1565. }
  1566. }
  1567. .answerInfos {
  1568. padding: 25rpx 25rpx 25rpx 23rpx;
  1569. }
  1570. .answerTitle {
  1571. margin-bottom: 28rpx;
  1572. color: #666;
  1573. font-size: 30rpx;
  1574. }
  1575. .answerContent {
  1576. font-size: 30rpx;
  1577. color: #666;
  1578. }
  1579. .textChild {
  1580. display: inline-block;
  1581. vertical-align: middle;
  1582. }
  1583. .dialog {
  1584. position: fixed;
  1585. left:0;
  1586. top:0;
  1587. width:100%;
  1588. height:100%;
  1589. background-color: rgba(0,0,0,0.8);
  1590. display: flex;
  1591. flex-direction: column;
  1592. align-items: center;
  1593. justify-content: center;
  1594. z-index: 20000;
  1595. .pointer {
  1596. width:338rpx;
  1597. height:240rpx;
  1598. }
  1599. .text {
  1600. font-size: 32rpx;
  1601. color: #FFFFFF;
  1602. text-align: center;
  1603. }
  1604. .btn {
  1605. width: 242rpx;
  1606. height: 82rpx;
  1607. border: 2rpx solid #FFFFFF;
  1608. border-radius: 16rpx;
  1609. text-align: center;
  1610. line-height: 82rpx;
  1611. margin:41rpx auto;
  1612. color:#fff;
  1613. font-size: 32rpx;
  1614. }
  1615. }
  1616. </style>