questionBankExplainDetail.vue 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832
  1. <template>
  2. <view class="questionBank">
  3. <nav-bar title="试卷解析"></nav-bar>
  4. <view class="tabs-top">
  5. <u-tabs :list="list" sticky :current="tabCurrent" @change="tabChange" active-color="#007AFF"></u-tabs>
  6. </view>
  7. <swiper class="swiper" :current="current" @change="swiperChange" :interval="interval">
  8. <swiper-item v-for="(bank,bankIndex) in questionList" :key="bankIndex">
  9. <view class="pageContent">
  10. <view class="pad_8 titBox" >
  11. <view class="firstLetter">
  12. <view class="leftLetters">
  13. <view class="btnType">
  14. <text v-if="bank.type==1">单选</text>
  15. <text v-if="bank.type==2">多选</text>
  16. <text v-if="bank.type==3">判断</text>
  17. <text v-if="bank.type==4">案例</text>
  18. <text v-if="bank.type==5">简答</text>
  19. </view>
  20. <text>{{bankIndex+1}}/{{questionList.length}}</text>
  21. </view>
  22. <view style="color: #666;font-size: 28rpx;"></view>
  23. <view class="leftLetters"></view>
  24. </view>
  25. <view class="titles">
  26. <rich-text :nodes="bank.content"></rich-text>
  27. </view>
  28. </view>
  29. <template v-if="bank.type == 1">
  30. <view class="pad_8 titBox no-margin">
  31. <view v-if="!bank.ques">
  32. <view v-for="(item, index) in bank.jsonStr" :key="index" class="lisSty" @click="radioSelect(item.optionsId,bankIndex)">
  33. <view class="activeTI">{{ ast[index] }}</view>
  34. <view class="flex_auto">{{ item.content }}</view>
  35. </view>
  36. </view>
  37. <view v-if="bank.ques">
  38. <view v-for="(item, index) in bank.jsonStr" :key="index" class="lisSty">
  39. <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>
  40. <view class="flex_auto">{{ item.content }}</view>
  41. </view>
  42. </view>
  43. </view>
  44. <view v-if="bank.ques">
  45. <view class="pad_8 answer">
  46. <view>正确答案:{{ast[bank.ans-1]}}</view>
  47. <view v-if="!explain">我的答案:{{ast[bank.ques-1]}}</view>
  48. </view>
  49. <view class="pad_8 answerInfos">
  50. <view class="answerTitle">答案解析</view>
  51. <view class="answerContent">
  52. <rich-text :nodes="bank.analysisContent"></rich-text>
  53. </view>
  54. </view>
  55. </view>
  56. </template>
  57. <template v-if="bank.type == 2">
  58. <view class="pad_8 titBox no-margin">
  59. <view v-if="!bank.ques">
  60. <view v-for="(item, index) in bank.jsonStr" :key="index" class="lisSty" @click="checkboxSelect(item.optionsId,bankIndex,index)">
  61. <view :class="{checked:item.checked}" class="activeTI">{{ ast[index] }}</view>
  62. <view class="flex_auto">{{ item.content }}</view>
  63. </view>
  64. </view>
  65. <view v-if="!bank.ques" class="submit_checkbox" @click="checkboxSubmit(bankIndex)">
  66. 确认答案
  67. </view>
  68. <view v-if="bank.ques">
  69. <view v-for="(item, index) in bank.jsonStr" :key="index" class="lisSty">
  70. <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>
  71. <view class="flex_auto">{{ item.content }}</view>
  72. </view>
  73. </view>
  74. </view>
  75. <view v-if="bank.ques">
  76. <view class="pad_8 answer">
  77. <view>正确答案:
  78. <text :key="ansItemIndex" v-for="(ansItem,ansItemIndex) in bank.ans">{{ast[ansItem-1]}}</text>
  79. </view>
  80. <view v-if="!explain">我的答案:
  81. <text :key="quesItemIndex" v-for="(quesItem,quesItemIndex) in bank.ques">{{ast[quesItem-1]}}</text>
  82. </view>
  83. </view>
  84. <view class="pad_8 answerInfos">
  85. <view class="answerTitle">答案解析</view>
  86. <view class="answerContent">
  87. <rich-text :nodes="bank.analysisContent"></rich-text>
  88. </view>
  89. </view>
  90. </view>
  91. </template>
  92. <template v-if="bank.type == 3">
  93. <view class="pad_8 titBox no-margin">
  94. <view v-if="!bank.ques">
  95. <view v-for="(item, index) in judge" :key="index" class="lisSty" @click="judgeSelect(index,bankIndex)">
  96. <view class="activeTI">{{ ast[index] }}</view>
  97. <view class="flex_auto">
  98. {{ item }}
  99. </view>
  100. </view>
  101. </view>
  102. <view v-if="bank.ques">
  103. <view v-for="(item, index) in judge" :key="index" class="lisSty">
  104. <text :class="{right:(index == bank.ques) || (index == bank.ans),wrong:(index == bank.ques) && (bank.ques != bank.ans)}" class="activeTI">{{ ast[index] }}</text>
  105. <view class="flex_auto">
  106. {{ item }}
  107. </view>
  108. </view>
  109. </view>
  110. </view>
  111. <view v-if="bank.ques">
  112. <view class="pad_8 answer">
  113. <view>正确答案:{{ast[bank.ans]}}</view>
  114. <view v-if="!explain">我的答案:{{ast[bank.ques]}}</view>
  115. </view>
  116. <view class="pad_8 answerInfos">
  117. <view class="answerTitle">答案解析</view>
  118. <view class="answerContent">
  119. <rich-text :nodes="bank.analysisContent"></rich-text>
  120. </view>
  121. </view>
  122. </view>
  123. </template>
  124. <!-- 简答题 -->
  125. <template v-if="bank.type == 5">
  126. <view class="pad_8 titBox">
  127. <view class="ans">
  128. <view class="ans_input" v-if="!bank.ques || (!bank.ques.text && !bank.ques.imageList.length)">
  129. <view class="top flex">
  130. <image :data-index="bankIndex" class="icon" @click="chooseImg(bankIndex)" src="/static/camera.png" mode=""></image>
  131. <view class="progress">{{bank.ansText.imageList.length || '0'}}/4</view>
  132. <view class="submit" :class="{disabled:!bank.ansText.text && hasImgs(bank)}" @click="submitAns(bankIndex)" >确认答案</view>
  133. </view>
  134. <view class="textarea">
  135. <textarea v-model="bank.ansText.text" placeholder="在此输入答案"></textarea>
  136. </view>
  137. <view class="imgs">
  138. <view class="img" v-for="(img,imgIndex) in bank.ansText.imageList" :key="imgIndex" >
  139. <text @click="deleteImg(imgIndex,bankIndex)">x</text>
  140. <image :src="$method.splitImgHost(img, true)"></image>
  141. </view>
  142. </view>
  143. </view>
  144. <view class="ans_submit answerInfos" v-if="bank.ques && !explain">
  145. <view class="answerTitle">我的答案:</view>
  146. {{bank.ques.text}}
  147. <view class="imgs">
  148. <image class="img" :key="quesIndex" v-for="(ques,quesIndex) in bank.ques.imageList" :src="$method.splitImgHost(ques,true)"></image>
  149. </view>
  150. </view>
  151. </view>
  152. </view>
  153. <view v-if="bank.ques">
  154. <view class="pad_8 answerInfos">
  155. <view class="answerTitle">答案解析:</view>
  156. <view class="answerContent">
  157. <rich-text :nodes="bank.analysisContent"></rich-text>
  158. </view>
  159. </view>
  160. </view>
  161. </template>
  162. <!-- 案例题 -->
  163. <template v-if="bank.type == 4">
  164. <view class="tabs">
  165. <view class="tab"
  166. :class="{current:tabIndex == bank.current}"
  167. :key="tabIndex" v-for="(tab,tabIndex) in bank.jsonStr"
  168. @click="tabSelect(tabIndex,bankIndex)"
  169. >
  170. 问题{{tabIndex+1}}
  171. </view>
  172. </view>
  173. <view v-for="(ansItem,ansIndex) in bank.jsonStr" v-if="bank.current == ansIndex" :key="ansIndex">
  174. <template v-if="ansItem.type == 1">
  175. <view class="pad_8 titBox">
  176. <view class="leftLetters">
  177. <view class="btnType">
  178. <text>单选</text>
  179. </view>
  180. </view>
  181. <view class="titles">
  182. <rich-text :nodes="ansItem.content"></rich-text>
  183. </view>
  184. <view v-if="!bank.ques[ansIndex]">
  185. <view v-for="(option, childIndex) in ansItem.optionsList" :key="childIndex" class="lisSty" @click="radioSelectChild(option.optionsId,ansIndex,bankIndex)">
  186. <view class="activeTI">{{ ast[childIndex] }}</view>
  187. <view class="flex_auto">
  188. <rich-text class="textChild" :nodes="option.content"></rich-text>
  189. </view>
  190. </view>
  191. </view>
  192. <view v-if="bank.ques[ansIndex]">
  193. <view v-for="(option, childIndex) in ansItem.optionsList" :key="childIndex" class="lisSty">
  194. <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>
  195. <view class="flex_auto">
  196. <rich-text :nodes="option.content"></rich-text>
  197. </view>
  198. </view>
  199. </view>
  200. </view>
  201. <view v-if="bank.ques[ansIndex]">
  202. <view class="pad_8 answer">
  203. <view>正确答案:{{ast[bank.ans[ansIndex]-1]}}</view>
  204. <view v-if="!explain">我的答案:{{ast[bank.ques[ansIndex]-1]}}</view>
  205. </view>
  206. <view class="pad_8 answerInfos">
  207. <view class="answerTitle">答案解析</view>
  208. <view class="answerContent">
  209. <rich-text :nodes="option.analysisContent"></rich-text>
  210. </view>
  211. </view>
  212. </view>
  213. </template>
  214. <template v-if="ansItem.type == 2">
  215. <view class="pad_8 titBox">
  216. <view class="leftLetters">
  217. <view class="btnType">
  218. <text>多选</text>
  219. </view>
  220. </view>
  221. <view class="titles">
  222. <rich-text :nodes="ansItem.content"></rich-text>
  223. </view>
  224. <view v-if="!bank.ques[ansIndex]">
  225. <view v-for="(option, childindex) in ansItem.optionsList" :key="childindex" class="lisSty" @click="checkboxSelectChild(bankIndex,ansIndex,childindex)">
  226. <view :class="{checked:option.checked}" class="activeTI">{{ ast[childindex] }}</view>
  227. <view class="flex_auto">
  228. <rich-text :nodes="option.content"></rich-text>
  229. </view>
  230. </view>
  231. </view>
  232. <view v-if="!bank.ques[ansIndex]" class="submit_checkbox" @click="checkboxSubmitChild(bankIndex,ansIndex)">
  233. 确认答案
  234. </view>
  235. <view v-if="bank.ques && bank.ques[ansIndex]">
  236. <view v-for="(option, childindex) in ansItem.optionsList" :key="childindex" class="lisSty">
  237. <text :class="{right:right(bankIndex,ansIndex,option),wrong:wrong(bankIndex,ansIndex,option)}" class="activeTI">{{ ast[childindex] }}</text>
  238. <view class="flex_auto">
  239. <rich-text :nodes="option.content"></rich-text>
  240. </view>
  241. </view>
  242. </view>
  243. </view>
  244. <view v-if="bank.ques[ansIndex]">
  245. <view class="pad_8 answer">
  246. <view>正确答案:
  247. <text :key="ansItemIndex1" v-for="(ansItem1,ansItemIndex1) in bank.ans[ansIndex]">{{ast[ansItem1-1]}}</text>
  248. </view>
  249. <view v-if="!explain">我的答案:
  250. <text :key="quesItemIndex" v-for="(quesItem,quesItemIndex) in bank.ques[ansIndex]">{{ast[quesItem-1]}}</text>
  251. </view>
  252. </view>
  253. <view class="pad_8 answerInfos">
  254. <view class="answerTitle">答案解析</view>
  255. <view class="answerContent">
  256. <rich-text :nodes="ansItem.analysisContent"></rich-text>
  257. </view>
  258. </view>
  259. </view>
  260. </template>
  261. <template v-if="ansItem.type == 3">
  262. <view class="pad_8 titBox">
  263. <view class="leftLetters">
  264. <view class="btnType">
  265. <text>判断</text>
  266. </view>
  267. </view>
  268. <view class="titles">
  269. <rich-text :nodes="ansItem.content"></rich-text>
  270. </view>
  271. <view v-if="!bank.ques[ansIndex]">
  272. <view v-for="(option, childindex) in judge" :key="childindex" class="lisSty" @click="judgeSelectChild(ansIndex,childindex,bankIndex)">
  273. <view class="activeTI">{{ ast[childindex] }}</view>
  274. <view class="flex_auto">
  275. {{ option }}
  276. </view>
  277. </view>
  278. </view>
  279. <view v-if="bank.ques[ansIndex]">
  280. <view v-for="(option, childindex) in judge" :key="childindex" class="lisSty">
  281. <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>
  282. <view class="flex_auto">
  283. {{ option }}
  284. </view>
  285. </view>
  286. </view>
  287. </view>
  288. <view v-if="bank.ques[ansIndex]">
  289. <view class="pad_8 answer">
  290. <view>正确答案:{{ast[bank.ans[ansIndex]]}}</view>
  291. <view v-if="!explain">我的答案:{{ast[bank.ques[ansIndex]]}}</view>
  292. </view>
  293. <view class="pad_8 answerInfos">
  294. <view class="answerTitle">答案解析</view>
  295. <view class="answerContent">
  296. <rich-text :nodes="ansItem.analysisContent"></rich-text>
  297. </view>
  298. </view>
  299. </view>
  300. </template>
  301. <!-- 简答题 -->
  302. <template v-if="ansItem.type == 5">
  303. <view class="pad_8 titBox_title">
  304. <view class="leftLetters">
  305. <view class="btnType">
  306. <text>简答</text>
  307. </view>
  308. </view>
  309. <view class="titles">
  310. <rich-text :nodes="ansItem.content"></rich-text>
  311. </view>
  312. </view>
  313. <view class="pad_8 titBox_title">
  314. <view class="ans">
  315. <view class="ans_input" v-if="!bank.ques[ansIndex] || (!bank.ques[ansIndex].text && !bank.ques[ansIndex].imageList.length)">
  316. <view class="top flex">
  317. <image class="icon" @click="chooseImgChild(bankIndex,ansIndex)" src="/static/08-10_032.jpg" mode=""></image>
  318. <view class="progress">{{ansItem.ansText.imageList.length || '0'}}/4</view>
  319. <view class="submit" :class="{disabled:!ansItem.ansText.text && hasImgs(ansItem)}" @click="submitAnsChild(bankIndex,ansIndex)">确认答案</view>
  320. </view>
  321. <view class="textarea">
  322. <textarea v-model="ansItem.ansText.text" placeholder="在此输入答案"></textarea>
  323. </view>
  324. <view class="imgs">
  325. <view class="img" v-for="(img,imgIndex) in ansItem.ansText.imageList" :key="imgIndex">
  326. <text @click="deleteImgChild(imgIndex,bankIndex,ansIndex)">x</text>
  327. <image :src="$method.splitImgHost(img, true)"></image>
  328. </view>
  329. </view>
  330. </view>
  331. <view class="ans_submit answerInfos" v-if="bank.ques[ansIndex] && !explain">
  332. <view class="answerTitle">我的答案</view>
  333. {{bank.ques[ansIndex].text}}
  334. <view class="imgs">
  335. <image class="img" :key="quesIndex" v-for="(ques,quesIndex) in bank.ques[ansIndex].imageList" :src="$method.splitImgHost(ques,true)"></image>
  336. </view>
  337. </view>
  338. </view>
  339. </view>
  340. <view v-if="bank.ques[ansIndex]">
  341. <view class="pad_8 answerInfos">
  342. <view class="answerTitle">答案解析</view>
  343. <view class="answerContent">
  344. <rich-text :nodes="ansItem.analysisContent"></rich-text>
  345. </view>
  346. </view>
  347. </view>
  348. </template>
  349. </view>
  350. </template>
  351. <view class="footer_btn">
  352. <view class="collect" @click="collect(collectList[bankIndex], bankIndex)">
  353. <view v-if="collectList[bankIndex]">
  354. <image src="/static/icon/collected.png" mode=""></image>
  355. <view>取消收藏</view>
  356. </view>
  357. <view v-if="!collectList[bankIndex]">
  358. <image src="/static/icon/collect.png" mode=""></image>
  359. <view>收藏</view>
  360. </view>
  361. </view>
  362. <view class="flex_center" @click="openFooterTab">
  363. <view class="up-icon">
  364. <image src="/static/up.png"></image>
  365. </view>
  366. 答题卡
  367. </view>
  368. <view class="collect" @click="submit">
  369. <view>
  370. <image src="/static/jj.png" mode=""></image>
  371. <view>交卷</view>
  372. </view>
  373. </view>
  374. </view>
  375. </view>
  376. </swiper-item>
  377. </swiper>
  378. <u-popup v-model="show" mode="bottom" border-radius="14" height="680rpx">
  379. <view class="popupView">
  380. <view class="popupTops">
  381. <view class="topIcon"></view>
  382. 点击编号即可跳转至对应题目
  383. </view>
  384. <view class="popupContent">
  385. <scroll-view scroll-y="true" style="height: 506rpx;">
  386. <view class="boxSty">
  387. <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>
  388. </view>
  389. </scroll-view>
  390. </view>
  391. </view>
  392. </u-popup>
  393. <view class="dialog" v-if="showDialog">
  394. <image class="pointer" src="/static/pointer.png"></image>
  395. <view class="text">左右滑动切换上下题</view>
  396. <view class="btn" @click="hideDialog">我知道了</view>
  397. </view>
  398. </view>
  399. </template>
  400. <script>
  401. export default {
  402. data() {
  403. return {
  404. examId:'',
  405. tabCurrent:0,
  406. current:0,
  407. questionList:[],
  408. ast: ['A', 'B', 'C', 'D','E','F','G'],
  409. judge:['错误','正确'],
  410. show: false,
  411. showDialog:false,
  412. bankList: [],
  413. collectList:[],
  414. goodsId:'',
  415. explain:'1', //是否显示答案
  416. chapterId:'',
  417. moduleId:'',
  418. list:[{
  419. name:'对题'
  420. },{
  421. name:'错题'
  422. }]
  423. };
  424. },
  425. onLoad(option){
  426. this.examId = option.examId;
  427. this.goodsId = option.goodsId;
  428. this.chapterId = option.chapterId;
  429. this.moduleId = option.moduleId;
  430. // this.goodsQuestionList();
  431. let showDialog = uni.getStorageSync('showDialog');
  432. if(showDialog) {
  433. this.showDialog = false;
  434. } else {
  435. this.showDialog = true;
  436. uni.setStorageSync('showDialog','1');
  437. }
  438. if(this.tabCurrent == 0) {
  439. this.examRecordRightList();
  440. } else {
  441. this.examRecordWrongList();
  442. }
  443. },
  444. onUnload() {
  445. },
  446. methods: {
  447. tabChange(e) {
  448. this.tabCurrent = e;
  449. if(this.tabCurrent == 0) {
  450. this.examRecordRightList();
  451. } else {
  452. this.examRecordWrongList();
  453. }
  454. },
  455. /**
  456. * 是否有上传图片
  457. */
  458. hasImgs(bank) {
  459. return bank.ansText.imageList.length == 0;
  460. },
  461. /**
  462. * 获取错题列表
  463. */
  464. examRecordWrongList() {
  465. this.$api.examRecordWrongList({
  466. examId:this.examId,
  467. goodsId:this.goodsId
  468. }).then(res => {
  469. res.data.rows.forEach((item,index) => {
  470. if(typeof item.jsonStr == 'string') {
  471. item.jsonStr = JSON.parse(item.jsonStr)
  472. if(item.type == 2) { //多选
  473. item.jsonStr.forEach(str => {
  474. str.optionsId = ''+str.optionsId;
  475. })
  476. let arr = item.answerQuestion.split(',');
  477. arr.forEach((a,i) => {
  478. arr[i] = ''+a;
  479. })
  480. item.ans = arr;
  481. if(this.explain) {
  482. item.ques = item.ans;
  483. }
  484. return;
  485. } else if(item.type == 5) {
  486. item.ansText = {
  487. text: '',
  488. imageList: []
  489. }
  490. if(this.explain) {
  491. item.ques = {
  492. text:item.analysisContent
  493. }
  494. return;
  495. }
  496. } else if(item.type == 4) {
  497. console.log(item.jsonStr)
  498. item.ques = []
  499. item.current = 0;
  500. let ansArr = [];
  501. item.jsonStr.forEach((json,index) => {
  502. if(json.type == 1) {
  503. ansArr[index] = json.answerQuestion;
  504. } else if(json.type == 2) {
  505. json.optionsList.forEach(str => {
  506. str.optionsId = ''+str.optionsId;
  507. })
  508. let arr = json.answerQuestion.split(',');
  509. arr.forEach((a,i) => {
  510. arr[i] = ''+a;
  511. })
  512. ansArr[index] = arr
  513. } else if(json.type == 3) {
  514. ansArr[index] = json.answerQuestion;
  515. } else if(json.type == 5) {
  516. ansArr[index] = {
  517. text: '',
  518. imageList: []
  519. }
  520. json.ansText = {
  521. text: '',
  522. imageList: []
  523. }
  524. }
  525. })
  526. item.ans = ansArr
  527. if(this.explain) {
  528. item.ques = item.ans;
  529. }
  530. return;
  531. }
  532. item.ans = item.answerQuestion
  533. if(this.explain) {
  534. item.ques = item.ans;
  535. }
  536. } else {
  537. if(this.explain) {
  538. item.ques = item.ans;
  539. }
  540. }
  541. })
  542. this.questionList = res.data.rows;
  543. })
  544. },
  545. /**
  546. * 获取对题列表
  547. */
  548. examRecordRightList() {
  549. this.$api.examRecordRightList({
  550. examId:this.examId,
  551. goodsId:this.goodsId
  552. }).then(res => {
  553. res.data.rows.forEach((item,index) => {
  554. if(typeof item.jsonStr == 'string') {
  555. item.jsonStr = JSON.parse(item.jsonStr)
  556. if(item.type == 2) { //多选
  557. item.jsonStr.forEach(str => {
  558. str.optionsId = ''+str.optionsId;
  559. })
  560. let arr = item.answerQuestion.split(',');
  561. arr.forEach((a,i) => {
  562. arr[i] = ''+a;
  563. })
  564. item.ans = arr;
  565. if(this.explain) {
  566. item.ques = item.ans;
  567. }
  568. return;
  569. } else if(item.type == 5) {
  570. item.ansText = {
  571. text: '',
  572. imageList: []
  573. }
  574. if(this.explain) {
  575. item.ques = {
  576. text:item.analysisContent
  577. }
  578. return;
  579. }
  580. } else if(item.type == 4) {
  581. console.log(item.jsonStr)
  582. item.ques = []
  583. item.current = 0;
  584. let ansArr = [];
  585. item.jsonStr.forEach((json,index) => {
  586. if(json.type == 1) {
  587. ansArr[index] = json.answerQuestion;
  588. } else if(json.type == 2) {
  589. json.optionsList.forEach(str => {
  590. str.optionsId = ''+str.optionsId;
  591. })
  592. let arr = json.answerQuestion.split(',');
  593. arr.forEach((a,i) => {
  594. arr[i] = ''+a;
  595. })
  596. ansArr[index] = arr
  597. } else if(json.type == 3) {
  598. ansArr[index] = json.answerQuestion;
  599. } else if(json.type == 5) {
  600. ansArr[index] = {
  601. text: '',
  602. imageList: []
  603. }
  604. json.ansText = {
  605. text: '',
  606. imageList: []
  607. }
  608. }
  609. })
  610. item.ans = ansArr
  611. if(this.explain) {
  612. item.ques = item.ans;
  613. }
  614. return;
  615. }
  616. item.ans = item.answerQuestion
  617. if(this.explain) {
  618. item.ques = item.ans;
  619. }
  620. } else {
  621. if(this.explain) {
  622. item.ques = item.ans;
  623. }
  624. }
  625. })
  626. this.questionList = res.data.rows;
  627. })
  628. },
  629. /**
  630. * @param {Object} state
  631. * @param {Object} index
  632. * 收藏
  633. */
  634. collect(state, index) {
  635. if (!state) {
  636. this.$api
  637. .collectQuestion({
  638. examId: this.id,
  639. questionId: this.questionList[index].questionId,
  640. goodsId: this.goodsId || ''
  641. })
  642. .then(res => {
  643. if (res.data.code == 200) {
  644. this.$set(this.collectList, index, true);
  645. uni.showToast({
  646. title: '收藏成功',
  647. duration: 2000,
  648. icon: 'none'
  649. });
  650. this.getCollectInfo(index)
  651. }
  652. });
  653. } else {
  654. this.$api.deleteCollectQuestion(this.collectList[index].collectQuestionId).then(res => {
  655. if (res.data.code == 200) {
  656. this.$set(this.collectList, index, false);
  657. uni.showToast({
  658. title: '取消收藏成功',
  659. duration: 2000,
  660. icon: 'none'
  661. });
  662. }
  663. });
  664. }
  665. return;
  666. },
  667. goodsQuestionList() {
  668. //继续答题
  669. if(this.isContinue || this.isHistory) {
  670. console.log(this.isHistory,"历史做题")
  671. console.log(this.isContinue,"继续做题")
  672. this.$api.examReport(this.recordId).then(res => {
  673. let json = JSON.parse(res.data.data.historyExamJson)
  674. this.questionList = json;
  675. })
  676. } else { //解析
  677. this.$api.goodsQuestionList({
  678. examId:this.id
  679. }).then(res => {
  680. res.data.data.forEach((item,index) => {
  681. if(typeof item.jsonStr == 'string') {
  682. item.jsonStr = JSON.parse(item.jsonStr)
  683. if(item.type == 2) { //多选
  684. item.jsonStr.forEach(str => {
  685. str.optionsId = ''+str.optionsId;
  686. })
  687. let arr = item.answerQuestion.split(',');
  688. arr.forEach((a,i) => {
  689. arr[i] = ''+a;
  690. })
  691. item.ans = arr;
  692. if(this.explain) {
  693. item.ques = item.ans;
  694. }
  695. return;
  696. } else if(item.type == 5) {
  697. item.ansText = {
  698. text: '',
  699. imageList: []
  700. }
  701. if(this.explain) {
  702. item.ques = {
  703. text:item.analysisContent
  704. }
  705. return;
  706. }
  707. } else if(item.type == 4) {
  708. console.log(item.jsonStr)
  709. item.ques = []
  710. item.current = 0;
  711. let ansArr = [];
  712. item.jsonStr.forEach((json,index) => {
  713. if(json.type == 1) {
  714. ansArr[index] = json.answerQuestion;
  715. } else if(json.type == 2) {
  716. json.optionsList.forEach(str => {
  717. str.optionsId = ''+str.optionsId;
  718. })
  719. let arr = json.answerQuestion.split(',');
  720. arr.forEach((a,i) => {
  721. arr[i] = ''+a;
  722. })
  723. ansArr[index] = arr
  724. } else if(json.type == 3) {
  725. ansArr[index] = json.answerQuestion;
  726. } else if(json.type == 5) {
  727. ansArr[index] = {
  728. text: '',
  729. imageList: []
  730. }
  731. json.ansText = {
  732. text: '',
  733. imageList: []
  734. }
  735. }
  736. })
  737. item.ans = ansArr
  738. if(this.explain) {
  739. item.ques = item.ans;
  740. }
  741. return;
  742. }
  743. item.ans = item.answerQuestion
  744. if(this.explain) {
  745. item.ques = item.ans;
  746. }
  747. } else {
  748. if(this.explain) {
  749. item.ques = item.ans;
  750. }
  751. }
  752. })
  753. this.questionList = res.data.data;
  754. this.getCollectInfo(this.current);
  755. console.log(this.questionList)
  756. })
  757. }
  758. },
  759. /**
  760. * @param {Object} current
  761. * 获取收藏信息
  762. */
  763. getCollectInfo(current) {
  764. this.$api
  765. .getCollectInfo({
  766. examId: this.id,
  767. questionId: this.questionList[current].questionId,
  768. goodsId: this.goodsId
  769. })
  770. .then(res => {
  771. if (res.data.code == 500) {
  772. this.$set(this.collectList, current, false);
  773. } else if (res.data.code == 200) {
  774. this.$set(this.collectList, current, res.data.data);
  775. }
  776. });
  777. },
  778. /**
  779. * @param {Object} e单选点击
  780. */
  781. radioSelect(optionsId,bindex) {
  782. if(this.questionList[bindex].ques) return;
  783. this.$set(this.questionList[bindex],'ques',optionsId)
  784. },
  785. examRecordEdit() {
  786. if(!this.isSubmit) {
  787. let number = 0;
  788. let score = 0;
  789. let doQuestionNum = 0;
  790. this.questionList.length && this.questionList.forEach((item,index) => {
  791. if(item.type == 1) {
  792. if(item.ques == item.ans) {
  793. score += item.score;
  794. number++
  795. }
  796. if (item.ques) {
  797. doQuestionNum++;
  798. }
  799. } else if(item.type == 2) {
  800. let isRight = item.ques && item.ques.every((quesItem,quesIndex) => {
  801. return item.ques[quesIndex] == item.ans[quesIndex]
  802. })
  803. if(isRight) {
  804. score += item.score;
  805. number++
  806. }
  807. if (item.ques && item.ques.length) {
  808. doQuestionNum++;
  809. }
  810. } else if(item.type == 3) {
  811. if(item.ques == item.ans) {
  812. score += item.score;
  813. number++
  814. }
  815. if (item.ques) {
  816. doQuestionNum++;
  817. }
  818. } else if (item == 4) {
  819. if (item.ques.length) {
  820. doQuestionNum++;
  821. }
  822. } else if (item.type == 5) {
  823. if (item.ques) {
  824. doQuestionNum++;
  825. }
  826. }
  827. })
  828. this.$api.examRecordEdit({
  829. examId:this.id,
  830. goodsId:this.goodsId,
  831. recordId: this.recordId,
  832. rightQuestionNum:number,
  833. status:0,
  834. moduleExamId:this.moduleId || 0,
  835. chapterExamId:this.chapterId || 0,
  836. doQuestionNum: doQuestionNum,
  837. historyExamJson:JSON.stringify(this.questionList)
  838. }).then(res => {
  839. })
  840. }
  841. },
  842. /**
  843. * @param {Object} e单选点击
  844. */
  845. radioSelectChild(optionsId,ansIndex,bindex) {
  846. if(this.questionList[bindex].ques[ansIndex]) return;
  847. this.$set(this.questionList[bindex].ques,ansIndex,optionsId)
  848. },
  849. /**
  850. * @param {Object} 多选点击
  851. */
  852. checkboxSelect(optionsId,bindex,index) {
  853. this.$set(this.questionList[bindex].jsonStr[index],'checked',!this.questionList[bindex].jsonStr[index].checked)
  854. },
  855. /**
  856. * @param {Object} 多选点击
  857. */
  858. checkboxSelectChild(bindex,ansIndex,childIndex) {
  859. this.$set(this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex],'checked',!this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex].checked)
  860. },
  861. /**
  862. * 提交数据
  863. */
  864. submit() {
  865. let score = 0; //计算总分
  866. let reportStatus = 0;
  867. let number = 0;
  868. let allScore = 0;
  869. let passScore = 0;
  870. let doWrongQuestionIds = []; //错题和未做题id(客观题)
  871. let doQuestionIds = []; //做过的题目id
  872. let rightQuestionIds = []; //做对的题目id
  873. this.questionList.forEach((item,index) => {
  874. passScore = item.passScore
  875. if(item.type == 1) {
  876. if(item.ques == item.ans) {
  877. score += item.score;
  878. number++
  879. rightQuestionIds.push(item.questionId)
  880. } else { //错误
  881. doWrongQuestionIds.push(item.questionId)
  882. }
  883. allScore += item.score
  884. if (item.ques) {
  885. doQuestionNum++;
  886. doQuestionIds.push(item.questionId)
  887. }
  888. } else if(item.type == 2) {
  889. let isRight = item.ans && item.ans.every((quesItem,quesIndex) => {
  890. if(item.ques) {
  891. return item.ques[quesIndex] == item.ans[quesIndex]
  892. } else {
  893. return false;
  894. }
  895. })
  896. if(isRight) {
  897. score += item.score;
  898. number++
  899. rightQuestionIds.push(item.questionId)
  900. } else {
  901. let checkboxScore = item.score; //获取单题总分数
  902. item.ques.forEach((ques,quesIndex) => {
  903. //选错一个全扣
  904. if(item.ques) {
  905. if(item.ans.indexOf(item.ques[quesIndex]) == -1) {
  906. checkboxScore = 0;
  907. }
  908. } else {
  909. checkboxScore = 0;
  910. }
  911. })
  912. console.log(checkboxScore)
  913. //没选错
  914. if(checkboxScore) {
  915. item.ans.forEach((ans,quesIndex) => {
  916. //漏选扣一部分
  917. if(item.ques) {
  918. if(item.ques.indexOf(item.ans[quesIndex]) == -1) {
  919. checkboxScore = item.partScore;
  920. }
  921. } else {
  922. checkboxScore = 0;
  923. }
  924. })
  925. }
  926. if(checkboxScore <= 0) { //0分
  927. item.scoreResult = 0;
  928. doWrongQuestionIds.push(item.questionId)
  929. } else { //部分分
  930. number++;
  931. item.scoreResult = checkboxScore;
  932. score += checkboxScore;
  933. rightQuestionIds.push(item.questionId)
  934. }
  935. }
  936. allScore += item.score;
  937. if (item.ques && item.ques.length) {
  938. doQuestionNum++;
  939. doQuestionIds.push(item.questionId)
  940. }
  941. } else if(item.type == 3) {
  942. if(item.ques == item.ans) {
  943. score += item.score;
  944. number++
  945. rightQuestionIds.push(item.questionId)
  946. } else {
  947. doWrongQuestionIds.push(item.questionId)
  948. }
  949. allScore += item.score;
  950. if (item.ques) {
  951. doQuestionNum++;
  952. doQuestionIds.push(item.questionId)
  953. }
  954. } else if (item.type == 4) {
  955. if (item.ques && item.ques.length) {
  956. doQuestionNum++;
  957. }
  958. } else if (item.type == 5) {
  959. if (item.ques) {
  960. doQuestionNum++;
  961. }
  962. }
  963. })
  964. //大于60分及格
  965. if(score >= passScore) {
  966. reportStatus = 1
  967. } else {
  968. reportStatus = 0
  969. }
  970. this.$api.examRecordEdit({
  971. examId:this.id,
  972. goodsId:this.goodsId,
  973. reportStatus:reportStatus,
  974. totalScore:allScore,
  975. recordId: this.recordId,
  976. rightQuestionNum:number,
  977. status:1,
  978. moduleExamId:this.moduleId || 0,
  979. chapterExamId:this.chapterId || 0,
  980. doQuestionIds:doQuestionIds.join(','),
  981. rightQuestionIds:rightQuestionIds.join(','),
  982. doQuestionNum: doQuestionNum,
  983. performance: score,
  984. historyExamJson:JSON.stringify(this.questionList)
  985. }).then(res => {
  986. this.isSubmit = true;
  987. if(res.data.code == 200) {
  988. uni.showToast({
  989. title: '交卷成功',
  990. duration: 2000,
  991. icon:'none'
  992. });
  993. setTimeout(() => {
  994. uni.redirectTo({
  995. url:'/pages2/bank/question_report?id='+this.recordId+'&examId='+this.id
  996. })
  997. },2000)
  998. }
  999. })
  1000. },
  1001. /**
  1002. * @param {Object} 多选确认
  1003. */
  1004. checkboxSubmit(bindex) {
  1005. if(this.questionList[bindex].ques) return;
  1006. let arr = [];
  1007. this.questionList[bindex].jsonStr.forEach(item => {
  1008. if(item.checked) {
  1009. arr.push(item.optionsId)
  1010. }
  1011. })
  1012. this.$set(this.questionList[bindex],'ques',arr)
  1013. },
  1014. /**
  1015. * @param {Object} 多选确认
  1016. */
  1017. checkboxSubmitChild(bindex,ansIndex) {
  1018. if(this.questionList[bindex].ques[ansIndex]) return;
  1019. let arr = [];
  1020. this.questionList[bindex].jsonStr[ansIndex].optionsList.forEach(item => {
  1021. if(item.checked) {
  1022. arr.push(item.optionsId)
  1023. }
  1024. })
  1025. this.$set(this.questionList[bindex].ques,ansIndex,arr)
  1026. },
  1027. judgeSelect(index,bindex) {
  1028. if(this.questionList[bindex].ques) return;
  1029. this.$set(this.questionList[bindex],'ques',index+'')
  1030. },
  1031. judgeSelectChild(ansindex,childindex,bindex) {
  1032. if(this.questionList[bindex].ques[ansindex]) return;
  1033. this.$set(this.questionList[bindex].ques,ansindex,childindex+'')
  1034. },
  1035. openFooterTab() {
  1036. this.show = true;
  1037. },
  1038. hideDialog() {
  1039. this.showDialog = false
  1040. },
  1041. changeIndex(index) {
  1042. this.current = index
  1043. },
  1044. swiperChange(e) {
  1045. this.current = e.detail.current;
  1046. },
  1047. deleteImg(imgIndex,bankIndex) {
  1048. this.questionList[bankIndex].ansText.imageList.splice(imgIndex,1)
  1049. },
  1050. deleteImgChild(imgIndex,bankIndex,ansIndex) {
  1051. this.questionList[bankIndex].jsonStr[ansIndex].ansText.imageList.splice(imgIndex,1)
  1052. },
  1053. chooseImg(bankindex) {
  1054. uni.chooseImage({
  1055. count: 1, //默认9
  1056. sizeType: ['compressed', ], //可以指定是原图还是压缩图,默认二者都有
  1057. sourceType: ['album','camera'], //从相册选择
  1058. success: (res) => {
  1059. let self = this;
  1060. // console.log(JSON.stringify(res.tempFilePaths));
  1061. let img = res.tempFilePaths[0];
  1062. uni.getImageInfo({
  1063. src: img,
  1064. success: async res => {
  1065. let canvasWidth = res.width; //图片原始长宽
  1066. let canvasHeight = res.height;
  1067. if (canvasWidth > 1000 || canvasHeight > 1000) {
  1068. uni.compressImage({
  1069. src: img,
  1070. quality: 75,
  1071. width: '50%',
  1072. height: '50%',
  1073. success: async rest => {
  1074. const dir = await self.uploadFile(rest.tempFilePath, 0);
  1075. this.questionList[bankindex].ansText.imageList.push(dir)
  1076. }
  1077. });
  1078. } else {
  1079. const dir = await self.uploadFile(img, 0);
  1080. this.questionList[bankindex].ansText.imageList.push(dir)
  1081. }
  1082. }
  1083. });
  1084. }
  1085. })
  1086. },
  1087. chooseImgChild(bankindex,ansindex) {
  1088. uni.chooseImage({
  1089. count: 1, //默认9
  1090. sizeType: ['compressed', ], //可以指定是原图还是压缩图,默认二者都有
  1091. sourceType: ['album','camera'], //从相册选择
  1092. success: (res) => {
  1093. let self = this;
  1094. // console.log(JSON.stringify(res.tempFilePaths));
  1095. let img = res.tempFilePaths[0];
  1096. uni.getImageInfo({
  1097. src: img,
  1098. success: async res => {
  1099. let canvasWidth = res.width; //图片原始长宽
  1100. let canvasHeight = res.height;
  1101. if (canvasWidth > 1000 || canvasHeight > 1000) {
  1102. uni.compressImage({
  1103. src: img,
  1104. quality: 75,
  1105. width: '50%',
  1106. height: '50%',
  1107. success: async rest => {
  1108. const dir = await self.uploadFile(rest.tempFilePath, 0);
  1109. this.questionList[bankindex].jsonStr[ansindex].ansText.imageList.push(dir)
  1110. }
  1111. });
  1112. } else {
  1113. const dir = await self.uploadFile(img, 0);
  1114. this.questionList[bankindex].jsonStr[ansindex].ansText.imageList.push(dir)
  1115. }
  1116. }
  1117. });
  1118. }
  1119. })
  1120. },
  1121. uploadFile(options, int) {
  1122. var self = this;
  1123. return new Promise((resolve, reject) => {
  1124. var data = {
  1125. imageStatus: int
  1126. };
  1127. self.$api.aliyunpolicy(data).then(res => {
  1128. console.log(res.data,6)
  1129. if(res.data.code!=200){
  1130. self.$method.showToast('签名错误'+JSON.stringify(res.data))
  1131. return
  1132. }
  1133. var ossToken = res.data.data.resultContent;
  1134. if(ossToken.host==null||ossToken.host==undefined){
  1135. self.$method.showToast('上传路径报错'+JSON.stringify(res.data))
  1136. return
  1137. }
  1138. uni.uploadFile({
  1139. url: ossToken.host,
  1140. name: 'file',
  1141. filePath: options,
  1142. fileType: 'image',
  1143. header: {
  1144. AuthorizationToken: 'WX ' + uni.getStorageSync('token')
  1145. },
  1146. formData: {
  1147. key: ossToken.dir,
  1148. OSSAccessKeyId: ossToken.accessid,
  1149. policy: ossToken.policy,
  1150. Signature: ossToken.signature,
  1151. callback: ossToken.callback,
  1152. success_action_status: 200
  1153. },
  1154. success: result => {
  1155. if (result.statusCode === 200) {
  1156. resolve(ossToken.dir);
  1157. } else {
  1158. uni.showToast({
  1159. title: '上传失败',
  1160. icon: 'none'
  1161. });
  1162. return;
  1163. }
  1164. },
  1165. fail: error => {
  1166. uni.showToast({
  1167. title: '上传接口报错'+error,
  1168. icon: 'none'
  1169. });
  1170. return;
  1171. }
  1172. });
  1173. });
  1174. });
  1175. },
  1176. submitAns(bankindex) {
  1177. console.log(this.questionList[bankindex])
  1178. if(!this.questionList[bankindex].ansText.text && !this.questionList[bankindex].ansText.imageList.length) {
  1179. uni.showToast({
  1180. title: '请输入内容或上传图片',
  1181. duration: 2000,
  1182. icon:'none'
  1183. });
  1184. return
  1185. }
  1186. this.$set(this.questionList[bankindex],'ques',{
  1187. imageList:this.questionList[bankindex].ansText.imageList,
  1188. text:this.questionList[bankindex].ansText.text,
  1189. })
  1190. },
  1191. submitAnsChild(bankindex,ansindex) {
  1192. if(!this.questionList[bankindex].jsonStr[ansindex].ansText.text && !this.questionList[bankindex].jsonStr[ansindex].ansText.imageList.length) {
  1193. uni.showToast({
  1194. title: '请输入内容或上传图片',
  1195. duration: 2000,
  1196. icon:'none'
  1197. });
  1198. return
  1199. }
  1200. this.$set(this.questionList[bankindex].ques,ansindex,{
  1201. imageList:this.questionList[bankindex].jsonStr[ansindex].ansText.imageList,
  1202. text:this.questionList[bankindex].jsonStr[ansindex].ansText.text,
  1203. })
  1204. },
  1205. isRight(item,index) {
  1206. //单选
  1207. if(this.questionList[index].ques) {
  1208. if(item.type == 1) {
  1209. return this.questionList[index].ques == this.questionList[index].ans;
  1210. //多选
  1211. } else if(item.type == 2) {
  1212. //每一项都相等
  1213. return this.questionList[index].ans.every((item,i) => {
  1214. return item == this.questionList[index].ques[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].ans.some((item,i) => {
  1257. return item != this.questionList[index].ques[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>