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