questionBankExplainDetail.vue 66 KB

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