wrongBank.vue 57 KB

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