questionBankExplainDetail.vue 46 KB

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