questionBankExplainDetail.vue 66 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221
  1. <template>
  2. <view class="questionBank">
  3. <nav-bar title="试卷解析"></nav-bar>
  4. <view class="tabs-top">
  5. <u-tabs
  6. :list="list"
  7. sticky
  8. :current="tabCurrent"
  9. @change="tabChange"
  10. active-color="#007AFF"
  11. ></u-tabs>
  12. </view>
  13. <swiper
  14. class="swiper"
  15. :current="current"
  16. @change="swiperChange"
  17. :interval="interval"
  18. >
  19. <swiper-item v-for="(bank, bankIndex) in questionList" :key="bankIndex">
  20. <view class="pageContent">
  21. <view class="pad_8 titBox">
  22. <view class="firstLetter">
  23. <view class="leftLetters">
  24. <view class="btnType">
  25. <text v-if="bank.type == 1">单选</text>
  26. <text v-if="bank.type == 2">多选</text>
  27. <text v-if="bank.type == 3">判断</text>
  28. <text v-if="bank.type == 4">案例</text>
  29. <text v-if="bank.type == 5">简答</text>
  30. </view>
  31. <text>{{ bankIndex + 1 }}/{{ questionList.length }}</text>
  32. </view>
  33. <view style="color: #666; font-size: 28rpx"></view>
  34. <view class="leftLetters"></view>
  35. </view>
  36. <view class="titles">
  37. <rich-text :nodes="bank.content"></rich-text>
  38. </view>
  39. </view>
  40. <template v-if="bank.type == 1">
  41. <view class="pad_8 titBox no-margin">
  42. <view v-if="!bank.ques">
  43. <view
  44. v-for="(item, index) in bank.jsonStr"
  45. :key="index"
  46. class="lisSty"
  47. @click="radioSelect(item.optionsId, bankIndex)"
  48. >
  49. <view class="activeTI">{{ ast[index] }}</view>
  50. <view class="flex_auto">
  51. {{ item.content }}
  52. <view v-if="item.imgUrl">
  53. <image
  54. style="width: 600rpx"
  55. mode="widthFix"
  56. :src="$method.splitImgHost(item.imgUrl)"
  57. ></image>
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. <view v-if="bank.ques">
  63. <view
  64. v-for="(item, index) in bank.jsonStr"
  65. :key="index"
  66. class="lisSty"
  67. >
  68. <text
  69. :class="{
  70. right:
  71. item.optionsId == bank.ques ||
  72. item.optionsId == bank.ans,
  73. wrong:
  74. item.optionsId == bank.ques && bank.ques != bank.ans,
  75. }"
  76. class="activeTI"
  77. >{{ ast[index] }}</text
  78. >
  79. <view class="flex_auto">
  80. {{ item.content }}
  81. <view v-if="item.imgUrl">
  82. <image
  83. style="width: 600rpx"
  84. mode="widthFix"
  85. :src="$method.splitImgHost(item.imgUrl)"
  86. ></image>
  87. </view>
  88. </view>
  89. </view>
  90. </view>
  91. </view>
  92. <view v-if="bank.ques">
  93. <view class="pad_8 answer">
  94. <view>正确答案:{{ ast[bank.ans - 1] }}</view>
  95. <view v-if="!explain">我的答案:{{ ast[bank.ques - 1] }}</view>
  96. </view>
  97. <view class="pad_8 answerInfos">
  98. <view class="answerTitle">答案解析</view>
  99. <view class="answerContent">
  100. <rich-text :nodes="bank.analysisContent"></rich-text>
  101. </view>
  102. </view>
  103. </view>
  104. </template>
  105. <template v-if="bank.type == 2">
  106. <view class="pad_8 titBox no-margin">
  107. <view v-if="!bank.ques">
  108. <view
  109. v-for="(item, index) in bank.jsonStr"
  110. :key="index"
  111. class="lisSty"
  112. @click="checkboxSelect(item.optionsId, bankIndex, index)"
  113. >
  114. <view :class="{ checked: item.checked }" class="activeTI">{{
  115. ast[index]
  116. }}</view>
  117. <view class="flex_auto">
  118. {{ item.content }}
  119. <view v-if="item.imgUrl">
  120. <image
  121. style="width: 600rpx"
  122. mode="widthFix"
  123. :src="$method.splitImgHost(item.imgUrl)"
  124. ></image>
  125. </view>
  126. </view>
  127. </view>
  128. </view>
  129. <view
  130. v-if="!bank.ques"
  131. class="submit_checkbox"
  132. @click="checkboxSubmit(bankIndex)"
  133. >
  134. 确认答案
  135. </view>
  136. <view v-if="bank.ques">
  137. <view
  138. v-for="(item, index) in bank.jsonStr"
  139. :key="index"
  140. class="lisSty"
  141. >
  142. <text
  143. :class="{
  144. right:
  145. bank.ques.indexOf(item.optionsId) != -1 ||
  146. bank.ans.indexOf(item.optionsId) != -1,
  147. wrong:
  148. bank.ques.indexOf(item.optionsId) != -1 &&
  149. bank.ans.indexOf(item.optionsId) == -1,
  150. }"
  151. class="activeTI"
  152. >{{ ast[index] }}</text
  153. >
  154. <view class="flex_auto">
  155. {{ item.content }}
  156. <view v-if="item.imgUrl">
  157. <image
  158. style="width: 600rpx"
  159. mode="widthFix"
  160. :src="$method.splitImgHost(item.imgUrl)"
  161. ></image>
  162. </view>
  163. </view>
  164. </view>
  165. </view>
  166. </view>
  167. <view v-if="bank.ques">
  168. <view class="pad_8 answer">
  169. <view
  170. >正确答案:
  171. <text
  172. :key="ansItemIndex"
  173. v-for="(ansItem, ansItemIndex) in bank.ans"
  174. >{{ ast[ansItem - 1] }}</text
  175. >
  176. </view>
  177. <view v-if="!explain"
  178. >我的答案:
  179. <text
  180. :key="quesItemIndex"
  181. v-for="(quesItem, quesItemIndex) in bank.ques"
  182. >{{ ast[quesItem - 1] }}</text
  183. >
  184. </view>
  185. </view>
  186. <view class="pad_8 answerInfos">
  187. <view class="answerTitle">答案解析</view>
  188. <view class="answerContent">
  189. <rich-text :nodes="bank.analysisContent"></rich-text>
  190. </view>
  191. </view>
  192. </view>
  193. </template>
  194. <template v-if="bank.type == 3">
  195. <view class="pad_8 titBox no-margin">
  196. <view v-if="!bank.ques">
  197. <view
  198. v-for="(item, index) in judge"
  199. :key="index"
  200. class="lisSty"
  201. @click="judgeSelect(index, bankIndex)"
  202. >
  203. <view class="activeTI">{{ ast[index] }}</view>
  204. <view class="flex_auto">
  205. {{ item }}
  206. <view v-if="item.imgUrl">
  207. <image
  208. style="width: 600rpx"
  209. mode="widthFix"
  210. :src="$method.splitImgHost(item.imgUrl)"
  211. ></image>
  212. </view>
  213. </view>
  214. </view>
  215. </view>
  216. <view v-if="bank.ques">
  217. <view
  218. v-for="(item, index) in judge"
  219. :key="index"
  220. class="lisSty"
  221. >
  222. <text
  223. :class="{
  224. right: index == (bank.ques == 1 ? 0 : 1) || index != bank.ans,
  225. wrong: index == (bank.ques == 1 ? 0 : 1) && bank.ques != bank.ans,
  226. }"
  227. class="activeTI"
  228. >{{ ast[index] }}</text
  229. >
  230. <view class="flex_auto">
  231. {{ item }}
  232. <view v-if="item.imgUrl">
  233. <image
  234. style="width: 600rpx"
  235. mode="widthFix"
  236. :src="$method.splitImgHost(item.imgUrl)"
  237. ></image>
  238. </view>
  239. </view>
  240. </view>
  241. </view>
  242. </view>
  243. <view v-if="bank.ques">
  244. <view class="pad_8 answer">
  245. <view>正确答案:{{ ast[bank.ans == 1 ? 0 : 1] }}</view>
  246. <view v-if="!explain">我的答案:{{ ast[bank.ques == 1 ? 0 : 1] }}</view>
  247. </view>
  248. <view class="pad_8 answerInfos">
  249. <view class="answerTitle">答案解析</view>
  250. <view class="answerContent">
  251. <rich-text :nodes="bank.analysisContent"></rich-text>
  252. </view>
  253. </view>
  254. </view>
  255. </template>
  256. <!-- 简答题 -->
  257. <template v-if="bank.type == 5">
  258. <view class="pad_8 titBox">
  259. <view class="ans">
  260. <view
  261. class="ans_input"
  262. v-if="
  263. !bank.ques ||
  264. (!bank.ques.text && !bank.ques.imageList.length)
  265. "
  266. >
  267. <view class="top flex">
  268. <image
  269. :data-index="bankIndex"
  270. class="icon"
  271. @click="chooseImg(bankIndex)"
  272. src="/static/camera.png"
  273. mode=""
  274. ></image>
  275. <view class="progress"
  276. >{{ bank.ansText.imageList.length || "0" }}/4</view
  277. >
  278. <view
  279. class="submit"
  280. :class="{ disabled: !bank.ansText.text && hasImgs(bank) }"
  281. @click="submitAns(bankIndex)"
  282. >确认答案</view
  283. >
  284. </view>
  285. <view class="textarea">
  286. <textarea
  287. v-model="bank.ansText.text"
  288. placeholder="在此输入答案"
  289. ></textarea>
  290. </view>
  291. <view class="imgs">
  292. <view
  293. class="img"
  294. v-for="(img, imgIndex) in bank.ansText.imageList"
  295. :key="imgIndex"
  296. >
  297. <text @click="deleteImg(imgIndex, bankIndex)">x</text>
  298. <image :src="$method.splitImgHost(img, true)"></image>
  299. </view>
  300. </view>
  301. </view>
  302. <view
  303. class="ans_submit answerInfos"
  304. v-if="bank.ques && !explain"
  305. >
  306. <view class="answerTitle">我的答案:</view>
  307. {{ bank.ques.text }}
  308. <view class="imgs">
  309. <image
  310. class="img"
  311. :key="quesIndex"
  312. v-for="(ques, quesIndex) in bank.ques.imageList"
  313. :src="$method.splitImgHost(ques, true)"
  314. ></image>
  315. </view>
  316. </view>
  317. </view>
  318. </view>
  319. <view v-if="bank.ques">
  320. <view class="pad_8 answerInfos">
  321. <view class="answerTitle">答案解析:</view>
  322. <view class="answerContent">
  323. <rich-text :nodes="bank.analysisContent"></rich-text>
  324. </view>
  325. </view>
  326. </view>
  327. </template>
  328. <!-- 案例题 -->
  329. <template v-if="bank.type == 4">
  330. <view class="tabs">
  331. <view
  332. class="tab"
  333. :class="{ current: tabIndex == bank.current }"
  334. :key="tabIndex"
  335. v-for="(tab, tabIndex) in bank.jsonStr"
  336. @click="tabSelect(tabIndex, bankIndex)"
  337. >
  338. 问题{{ tabIndex + 1 }}
  339. </view>
  340. </view>
  341. <view
  342. v-for="(ansItem, ansIndex) in bank.jsonStr"
  343. v-if="bank.current == ansIndex"
  344. :key="ansIndex"
  345. >
  346. <template v-if="ansItem.type == 1">
  347. <view class="pad_8 titBox">
  348. <view class="leftLetters">
  349. <view class="btnType">
  350. <text>单选</text>
  351. </view>
  352. </view>
  353. <view class="titles">
  354. <rich-text :nodes="ansItem.content"></rich-text>
  355. </view>
  356. <view v-if="!bank.ques[ansIndex]">
  357. <view
  358. v-for="(option, childIndex) in ansItem.optionsList"
  359. :key="childIndex"
  360. class="lisSty"
  361. @click="
  362. radioSelectChild(option.optionsId, ansIndex, bankIndex)
  363. "
  364. >
  365. <view class="activeTI">{{ ast[childIndex] }}</view>
  366. <view class="flex_auto">
  367. <rich-text
  368. class="textChild"
  369. :nodes="option.content"
  370. ></rich-text>
  371. <view v-if="option.imgUrl">
  372. <image
  373. style="width: 600rpx"
  374. mode="widthFix"
  375. :src="$method.splitImgHost(option.imgUrl)"
  376. ></image>
  377. </view>
  378. </view>
  379. </view>
  380. </view>
  381. <view v-if="bank.ques[ansIndex]">
  382. <view
  383. v-for="(option, childIndex) in ansItem.optionsList"
  384. :key="childIndex"
  385. class="lisSty"
  386. >
  387. <text
  388. :class="{
  389. right:
  390. option.optionsId == bank.ques[ansIndex] ||
  391. option.optionsId == bank.ans[ansIndex],
  392. wrong:
  393. option.optionsId == bank.ques[ansIndex] &&
  394. bank.ques[ansIndex] != bank.ans[ansIndex],
  395. }"
  396. class="activeTI"
  397. >{{ ast[childIndex] }}</text
  398. >
  399. <view class="flex_auto">
  400. <rich-text :nodes="option.content"></rich-text>
  401. <view v-if="option.imgUrl">
  402. <image
  403. style="width: 600rpx"
  404. mode="widthFix"
  405. :src="$method.splitImgHost(option.imgUrl)"
  406. ></image>
  407. </view>
  408. </view>
  409. </view>
  410. </view>
  411. </view>
  412. <view v-if="bank.ques[ansIndex]">
  413. <view class="pad_8 answer">
  414. <view>正确答案:{{ ast[bank.ans[ansIndex] - 1] }}</view>
  415. <view v-if="!explain"
  416. >我的答案:{{ ast[bank.ques[ansIndex] - 1] }}</view
  417. >
  418. </view>
  419. <view class="pad_8 answerInfos">
  420. <view class="answerTitle">答案解析</view>
  421. <view class="answerContent">
  422. <rich-text :nodes="option.analysisContent"></rich-text>
  423. </view>
  424. </view>
  425. </view>
  426. </template>
  427. <template v-if="ansItem.type == 2">
  428. <view class="pad_8 titBox">
  429. <view class="leftLetters">
  430. <view class="btnType">
  431. <text>多选</text>
  432. </view>
  433. </view>
  434. <view class="titles">
  435. <rich-text :nodes="ansItem.content"></rich-text>
  436. </view>
  437. <view v-if="!bank.ques[ansIndex]">
  438. <view
  439. v-for="(option, childindex) in ansItem.optionsList"
  440. :key="childindex"
  441. class="lisSty"
  442. @click="
  443. checkboxSelectChild(bankIndex, ansIndex, childindex)
  444. "
  445. >
  446. <view
  447. :class="{ checked: option.checked }"
  448. class="activeTI"
  449. >{{ ast[childindex] }}</view
  450. >
  451. <view class="flex_auto">
  452. <rich-text :nodes="option.content"></rich-text>
  453. <view v-if="option.imgUrl">
  454. <image
  455. style="width: 600rpx"
  456. mode="widthFix"
  457. :src="$method.splitImgHost(option.imgUrl)"
  458. ></image>
  459. </view>
  460. </view>
  461. </view>
  462. </view>
  463. <view
  464. v-if="!bank.ques[ansIndex]"
  465. class="submit_checkbox"
  466. @click="checkboxSubmitChild(bankIndex, ansIndex)"
  467. >
  468. 确认答案
  469. </view>
  470. <view v-if="bank.ques && bank.ques[ansIndex]">
  471. <view
  472. v-for="(option, childindex) in ansItem.optionsList"
  473. :key="childindex"
  474. class="lisSty"
  475. >
  476. <text
  477. :class="{
  478. right: right(bankIndex, ansIndex, option),
  479. wrong: wrong(bankIndex, ansIndex, option),
  480. }"
  481. class="activeTI"
  482. >{{ ast[childindex] }}</text
  483. >
  484. <view class="flex_auto">
  485. <rich-text :nodes="option.content"></rich-text>
  486. <view v-if="option.imgUrl">
  487. <image
  488. style="width: 600rpx"
  489. mode="widthFix"
  490. :src="$method.splitImgHost(option.imgUrl)"
  491. ></image>
  492. </view>
  493. </view>
  494. </view>
  495. </view>
  496. </view>
  497. <view v-if="bank.ques[ansIndex]">
  498. <view class="pad_8 answer">
  499. <view
  500. >正确答案:
  501. <text
  502. :key="ansItemIndex1"
  503. v-for="(ansItem1, ansItemIndex1) in bank.ans[ansIndex]"
  504. >{{ ast[ansItem1 - 1] }}</text
  505. >
  506. </view>
  507. <view v-if="!explain"
  508. >我的答案:
  509. <text
  510. :key="quesItemIndex"
  511. v-for="(quesItem, quesItemIndex) in bank.ques[ansIndex]"
  512. >{{ ast[quesItem - 1] }}</text
  513. >
  514. </view>
  515. </view>
  516. <view class="pad_8 answerInfos">
  517. <view class="answerTitle">答案解析</view>
  518. <view class="answerContent">
  519. <rich-text :nodes="ansItem.analysisContent"></rich-text>
  520. </view>
  521. </view>
  522. </view>
  523. </template>
  524. <template v-if="ansItem.type == 3">
  525. <view class="pad_8 titBox">
  526. <view class="leftLetters">
  527. <view class="btnType">
  528. <text>判断</text>
  529. </view>
  530. </view>
  531. <view class="titles">
  532. <rich-text :nodes="ansItem.content"></rich-text>
  533. </view>
  534. <view v-if="!bank.ques[ansIndex]">
  535. <view
  536. v-for="(option, childindex) in judge"
  537. :key="childindex"
  538. class="lisSty"
  539. @click="judgeSelectChild(ansIndex, childindex, bankIndex)"
  540. >
  541. <view class="activeTI">{{ ast[childindex] }}</view>
  542. <view class="flex_auto">
  543. {{ option }}
  544. <view v-if="option.imgUrl">
  545. <image
  546. style="width: 600rpx"
  547. mode="widthFix"
  548. :src="$method.splitImgHost(option.imgUrl)"
  549. ></image>
  550. </view>
  551. </view>
  552. </view>
  553. </view>
  554. <view v-if="bank.ques[ansIndex]">
  555. <view
  556. v-for="(option, childindex) in judge"
  557. :key="childindex"
  558. class="lisSty"
  559. >
  560. <text
  561. :class="{
  562. right:
  563. childindex == (bank.ques[ansIndex] == 1 ? 0 : 1) ||
  564. childindex != bank.ans[ansIndex],
  565. wrong:
  566. childindex == (bank.ques[ansIndex] == 1 ? 0 : 1) &&
  567. bank.ques[ansIndex] != bank.ans[ansIndex],
  568. }"
  569. class="activeTI"
  570. >{{ ast[childindex] }}</text
  571. >
  572. <view class="flex_auto">
  573. {{ option }}
  574. <view v-if="option.imgUrl">
  575. <image
  576. style="width: 600rpx"
  577. mode="widthFix"
  578. :src="$method.splitImgHost(option.imgUrl)"
  579. ></image>
  580. </view>
  581. </view>
  582. </view>
  583. </view>
  584. </view>
  585. <view v-if="bank.ques[ansIndex]">
  586. <view class="pad_8 answer">
  587. <view>正确答案:{{ ast[bank.ans[ansIndex] == 1 ? 0 : 1] }}</view>
  588. <view v-if="!explain"
  589. >我的答案:{{ ast[bank.ques[ansIndex] == 1 ? 0 : 1] }}</view
  590. >
  591. </view>
  592. <view class="pad_8 answerInfos">
  593. <view class="answerTitle">答案解析</view>
  594. <view class="answerContent">
  595. <rich-text :nodes="ansItem.analysisContent"></rich-text>
  596. </view>
  597. </view>
  598. </view>
  599. </template>
  600. <!-- 简答题 -->
  601. <template v-if="ansItem.type == 5">
  602. <view class="pad_8 titBox_title">
  603. <view class="leftLetters">
  604. <view class="btnType">
  605. <text>简答</text>
  606. </view>
  607. </view>
  608. <view class="titles">
  609. <rich-text :nodes="ansItem.content"></rich-text>
  610. </view>
  611. </view>
  612. <view class="pad_8 titBox_title">
  613. <view class="ans">
  614. <view
  615. class="ans_input"
  616. v-if="
  617. !bank.ques[ansIndex] ||
  618. (!bank.ques[ansIndex].text &&
  619. !bank.ques[ansIndex].imageList.length)
  620. "
  621. >
  622. <view class="top flex">
  623. <image
  624. class="icon"
  625. @click="chooseImgChild(bankIndex, ansIndex)"
  626. src="/static/08-10_032.jpg"
  627. mode=""
  628. ></image>
  629. <view class="progress"
  630. >{{ ansItem.ansText.imageList.length || "0" }}/4</view
  631. >
  632. <view
  633. class="submit"
  634. :class="{
  635. disabled: !ansItem.ansText.text && hasImgs(ansItem),
  636. }"
  637. @click="submitAnsChild(bankIndex, ansIndex)"
  638. >确认答案</view
  639. >
  640. </view>
  641. <view class="textarea">
  642. <textarea
  643. v-model="ansItem.ansText.text"
  644. placeholder="在此输入答案"
  645. ></textarea>
  646. </view>
  647. <view class="imgs">
  648. <view
  649. class="img"
  650. v-for="(img, imgIndex) in ansItem.ansText.imageList"
  651. :key="imgIndex"
  652. >
  653. <text
  654. @click="
  655. deleteImgChild(imgIndex, bankIndex, ansIndex)
  656. "
  657. >x</text
  658. >
  659. <image :src="$method.splitImgHost(img, true)"></image>
  660. </view>
  661. </view>
  662. </view>
  663. <view
  664. class="ans_submit answerInfos"
  665. v-if="bank.ques[ansIndex] && !explain"
  666. >
  667. <view class="answerTitle">我的答案</view>
  668. {{ bank.ques[ansIndex].text }}
  669. <view class="imgs">
  670. <image
  671. class="img"
  672. :key="quesIndex"
  673. v-for="(ques, quesIndex) in bank.ques[ansIndex]
  674. .imageList"
  675. :src="$method.splitImgHost(ques, true)"
  676. ></image>
  677. </view>
  678. </view>
  679. </view>
  680. </view>
  681. <view v-if="bank.ques[ansIndex]">
  682. <view class="pad_8 answerInfos">
  683. <view class="answerTitle">答案解析</view>
  684. <view class="answerContent">
  685. <rich-text :nodes="ansItem.analysisContent"></rich-text>
  686. </view>
  687. </view>
  688. </view>
  689. </template>
  690. </view>
  691. </template>
  692. <view class="footer_btn">
  693. <view
  694. class="collect"
  695. @click="collect(collectList[bankIndex], bankIndex)"
  696. >
  697. <view v-if="collectList[bankIndex]">
  698. <image src="/static/icon/collected.png" mode=""></image>
  699. <view>取消收藏</view>
  700. </view>
  701. <view v-if="!collectList[bankIndex]">
  702. <image src="/static/icon/collect.png" mode=""></image>
  703. <view>收藏</view>
  704. </view>
  705. </view>
  706. <view class="flex_center" @click="openFooterTab">
  707. <view class="up-icon">
  708. <image src="/static/up.png"></image>
  709. </view>
  710. 答题卡
  711. </view>
  712. <view class="collect" @click="submit">
  713. <view>
  714. <image src="/static/jj.png" mode=""></image>
  715. <view>交卷</view>
  716. </view>
  717. </view>
  718. </view>
  719. </view>
  720. </swiper-item>
  721. </swiper>
  722. <u-popup v-model="show" mode="bottom" border-radius="14" height="680rpx">
  723. <view class="popupView">
  724. <view class="popupTops">
  725. <view class="topIcon"></view>
  726. 点击编号即可跳转至对应题目
  727. </view>
  728. <view class="popupContent">
  729. <scroll-view scroll-y="true" style="height: 506rpx">
  730. <view class="boxSty">
  731. <view
  732. v-for="(item, index) in questionList"
  733. :key="index"
  734. @click="changeIndex(index)"
  735. :class="{
  736. isRight: isRight(item, index),
  737. isWrong: isWrong(item, index),
  738. isPart: isPart(item, index),
  739. }"
  740. class="liListSty"
  741. >{{ index + 1 }}</view
  742. >
  743. </view>
  744. </scroll-view>
  745. </view>
  746. </view>
  747. </u-popup>
  748. <view class="dialog" v-if="showDialog">
  749. <image class="pointer" src="/static/pointer.png"></image>
  750. <view class="text">左右滑动切换上下题</view>
  751. <view class="btn" @click="hideDialog">我知道了</view>
  752. </view>
  753. </view>
  754. </template>
  755. <script>
  756. export default {
  757. data() {
  758. return {
  759. examId: "",
  760. tabCurrent: 0,
  761. current: 0,
  762. questionList: [],
  763. ast: ["A", "B", "C", "D", "E", "F", "G"],
  764. judge: ["正确", "错误"],
  765. show: false,
  766. showDialog: false,
  767. bankList: [],
  768. collectList: [],
  769. orderGoodsId: 0,
  770. goodsId: "",
  771. explain: "1", //是否显示答案
  772. chapterId: "",
  773. moduleId: "",
  774. list: [
  775. {
  776. name: "对题",
  777. },
  778. {
  779. name: "错题",
  780. },
  781. ],
  782. };
  783. },
  784. onLoad(option) {
  785. this.examId = option.examId;
  786. this.goodsId = option.goodsId;
  787. this.chapterId = option.chapterId;
  788. this.moduleId = option.moduleId;
  789. this.orderGoodsId = option.orderGoodsId;
  790. // this.goodsQuestionList();
  791. let showDialog = uni.getStorageSync("showDialog");
  792. if (showDialog) {
  793. this.showDialog = false;
  794. } else {
  795. this.showDialog = true;
  796. uni.setStorageSync("showDialog", "1");
  797. }
  798. if (this.tabCurrent == 0) {
  799. this.examRecordRightList();
  800. } else {
  801. this.examRecordWrongList();
  802. }
  803. },
  804. onUnload() {},
  805. methods: {
  806. tabChange(e) {
  807. this.tabCurrent = e;
  808. if (this.tabCurrent == 0) {
  809. this.examRecordRightList();
  810. } else {
  811. this.examRecordWrongList();
  812. }
  813. },
  814. /**
  815. * 是否有上传图片
  816. */
  817. hasImgs(bank) {
  818. return bank.ansText.imageList.length == 0;
  819. },
  820. /**
  821. * 获取错题列表
  822. */
  823. examRecordWrongList() {
  824. this.$api
  825. .examRecordWrongList({
  826. examId: this.examId,
  827. goodsId: this.goodsId,
  828. orderGoodsId: this.orderGoodsId,
  829. })
  830. .then((res) => {
  831. res.data.rows.forEach((item, index) => {
  832. if (typeof item.jsonStr == "string") {
  833. item.jsonStr = JSON.parse(item.jsonStr);
  834. if (item.type == 2) {
  835. //多选
  836. item.jsonStr.forEach((str) => {
  837. str.optionsId = "" + str.optionsId;
  838. });
  839. let arr = item.answerQuestion.split(",");
  840. arr.forEach((a, i) => {
  841. arr[i] = "" + a;
  842. });
  843. item.ans = arr;
  844. if (this.explain) {
  845. item.ques = item.ans;
  846. }
  847. return;
  848. } else if (item.type == 5) {
  849. item.ansText = {
  850. text: "",
  851. imageList: [],
  852. };
  853. if (this.explain) {
  854. item.ques = {
  855. text: item.analysisContent,
  856. };
  857. return;
  858. }
  859. } else if (item.type == 4) {
  860. console.log(item.jsonStr);
  861. item.ques = [];
  862. item.current = 0;
  863. let ansArr = [];
  864. item.jsonStr.forEach((json, index) => {
  865. if (json.type == 1) {
  866. ansArr[index] = json.answerQuestion;
  867. } else if (json.type == 2) {
  868. json.optionsList.forEach((str) => {
  869. str.optionsId = "" + str.optionsId;
  870. });
  871. let arr = json.answerQuestion.split(",");
  872. arr.forEach((a, i) => {
  873. arr[i] = "" + a;
  874. });
  875. ansArr[index] = arr;
  876. } else if (json.type == 3) {
  877. ansArr[index] = json.answerQuestion;
  878. } else if (json.type == 5) {
  879. ansArr[index] = {
  880. text: "",
  881. imageList: [],
  882. };
  883. json.ansText = {
  884. text: "",
  885. imageList: [],
  886. };
  887. }
  888. });
  889. item.ans = ansArr;
  890. if (this.explain) {
  891. item.ques = item.ans;
  892. }
  893. return;
  894. }
  895. item.ans = item.answerQuestion;
  896. if (this.explain) {
  897. item.ques = item.ans;
  898. }
  899. } else {
  900. if (this.explain) {
  901. item.ques = item.ans;
  902. }
  903. }
  904. });
  905. this.questionList = res.data.rows;
  906. });
  907. },
  908. /**
  909. * 获取对题列表
  910. */
  911. examRecordRightList() {
  912. this.$api
  913. .examRecordRightList({
  914. examId: this.examId,
  915. goodsId: this.goodsId,
  916. orderGoodsId: this.orderGoodsId,
  917. })
  918. .then((res) => {
  919. res.data.rows.forEach((item, index) => {
  920. if (typeof item.jsonStr == "string") {
  921. item.jsonStr = JSON.parse(item.jsonStr);
  922. if (item.type == 2) {
  923. //多选
  924. item.jsonStr.forEach((str) => {
  925. str.optionsId = "" + str.optionsId;
  926. });
  927. let arr = item.answerQuestion.split(",");
  928. arr.forEach((a, i) => {
  929. arr[i] = "" + a;
  930. });
  931. item.ans = arr;
  932. if (this.explain) {
  933. item.ques = item.ans;
  934. }
  935. return;
  936. } else if (item.type == 5) {
  937. item.ansText = {
  938. text: "",
  939. imageList: [],
  940. };
  941. if (this.explain) {
  942. item.ques = {
  943. text: item.analysisContent,
  944. };
  945. return;
  946. }
  947. } else if (item.type == 4) {
  948. console.log(item.jsonStr);
  949. item.ques = [];
  950. item.current = 0;
  951. let ansArr = [];
  952. item.jsonStr.forEach((json, index) => {
  953. if (json.type == 1) {
  954. ansArr[index] = json.answerQuestion;
  955. } else if (json.type == 2) {
  956. json.optionsList.forEach((str) => {
  957. str.optionsId = "" + str.optionsId;
  958. });
  959. let arr = json.answerQuestion.split(",");
  960. arr.forEach((a, i) => {
  961. arr[i] = "" + a;
  962. });
  963. ansArr[index] = arr;
  964. } else if (json.type == 3) {
  965. ansArr[index] = json.answerQuestion;
  966. } else if (json.type == 5) {
  967. ansArr[index] = {
  968. text: "",
  969. imageList: [],
  970. };
  971. json.ansText = {
  972. text: "",
  973. imageList: [],
  974. };
  975. }
  976. });
  977. item.ans = ansArr;
  978. if (this.explain) {
  979. item.ques = item.ans;
  980. }
  981. return;
  982. }
  983. item.ans = item.answerQuestion;
  984. if (this.explain) {
  985. item.ques = item.ans;
  986. }
  987. } else {
  988. if (this.explain) {
  989. item.ques = item.ans;
  990. }
  991. }
  992. });
  993. this.questionList = res.data.rows;
  994. });
  995. },
  996. /**
  997. * @param {Object} state
  998. * @param {Object} index
  999. * 收藏
  1000. */
  1001. collect(state, index) {
  1002. if (!state) {
  1003. this.$api
  1004. .collectQuestion({
  1005. examId: this.id,
  1006. questionId: this.questionList[index].questionId,
  1007. goodsId: this.goodsId || "",
  1008. })
  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. }
  1749. }
  1750. .activeTI {
  1751. vertical-align: middle;
  1752. display: inline-block;
  1753. border: 1rpx solid #eee;
  1754. border-radius: 50rpx;
  1755. height: 48rpx;
  1756. line-height: 46rpx;
  1757. text-align: center;
  1758. width: 48rpx;
  1759. margin-right: 15rpx;
  1760. color: #666;
  1761. font-size: 30rpx;
  1762. &.right {
  1763. color: #fff;
  1764. background: #36c75a;
  1765. }
  1766. &.wrong {
  1767. color: #fff;
  1768. background: #ff3b30;
  1769. }
  1770. &.checked {
  1771. color: #fff;
  1772. background: #007aff;
  1773. }
  1774. }
  1775. .submit_checkbox {
  1776. position: fixed;
  1777. left: 0;
  1778. right: 0;
  1779. bottom: 120rpx;
  1780. margin: 20rpx auto;
  1781. width: 526rpx;
  1782. height: 80rpx;
  1783. background: rgba(0, 122, 255, 1);
  1784. color: #fff;
  1785. text-align: center;
  1786. line-height: 80rpx;
  1787. font-size: 30rpx;
  1788. border-radius: 40rpx;
  1789. }
  1790. .titles {
  1791. overflow: hidden;
  1792. margin-bottom: 24rpx;
  1793. }
  1794. .titBox {
  1795. padding: 41rpx 25rpx 24rpx 25rpx;
  1796. }
  1797. .titBox_title {
  1798. padding: 21rpx;
  1799. }
  1800. .tabs {
  1801. margin: 10rpx;
  1802. display: flex;
  1803. .tab {
  1804. margin: 0 4rpx;
  1805. padding: 10rpx 13rpx;
  1806. text-align: center;
  1807. color: #007aff;
  1808. font-size: 28rpx;
  1809. border-radius: 16rpx;
  1810. background: #fff;
  1811. &.current {
  1812. color: #fff;
  1813. background: #007aff;
  1814. }
  1815. }
  1816. }
  1817. .ans {
  1818. margin: 8rpx 8rpx 8rpx;
  1819. .ans_input {
  1820. border-radius: 16rpx;
  1821. background: #fff;
  1822. .top {
  1823. border-bottom: 1rpx solid #eeeeee;
  1824. padding: 16rpx;
  1825. display: flex;
  1826. align-items: center;
  1827. .icon {
  1828. margin-right: 20rpx;
  1829. width: 40rpx;
  1830. height: 38rpx;
  1831. }
  1832. .progress {
  1833. flex: 1;
  1834. }
  1835. .submit {
  1836. width: 168rpx;
  1837. height: 48rpx;
  1838. line-height: 48rpx;
  1839. text-align: center;
  1840. color: #fff;
  1841. font-size: 30rpx;
  1842. background: #007aff;
  1843. border-radius: 24rpx;
  1844. &.disabled {
  1845. opacity: 0.6;
  1846. }
  1847. }
  1848. }
  1849. .textarea {
  1850. textarea {
  1851. width: 100%;
  1852. height: 287rpx;
  1853. padding: 10rpx;
  1854. }
  1855. }
  1856. .imgs {
  1857. overflow: hidden;
  1858. display: flex;
  1859. width: 100%;
  1860. .img {
  1861. width: 104rpx;
  1862. height: 104rpx;
  1863. border-radius: 8rpx;
  1864. position: relative;
  1865. margin: 20rpx;
  1866. text {
  1867. position: absolute;
  1868. right: -15rpx;
  1869. top: -15rpx;
  1870. width: 30rpx;
  1871. height: 30rpx;
  1872. text-align: center;
  1873. line-height: 30rpx;
  1874. color: #fff;
  1875. background: #ff3b30;
  1876. border-radius: 50%;
  1877. }
  1878. image {
  1879. width: 100%;
  1880. height: 100%;
  1881. }
  1882. }
  1883. }
  1884. }
  1885. .ans_submit {
  1886. padding: 16rpx;
  1887. border-radius: 16rpx;
  1888. background: #fff;
  1889. .imgs {
  1890. overflow: hidden;
  1891. display: flex;
  1892. width: 100%;
  1893. .img {
  1894. width: 104rpx;
  1895. height: 104rpx;
  1896. border-radius: 8rpx;
  1897. position: relative;
  1898. margin: 20rpx;
  1899. image {
  1900. width: 100%;
  1901. height: 100%;
  1902. }
  1903. }
  1904. }
  1905. }
  1906. }
  1907. .leftLetters {
  1908. display: flex;
  1909. align-items: center;
  1910. width: 220rpx;
  1911. .btnType {
  1912. padding: 5rpx 10rpx;
  1913. border: 1rpx solid #007aff;
  1914. border-radius: 10rpx;
  1915. background-color: rgba(0, 122, 255, 0.1);
  1916. font-size: 28rpx;
  1917. color: #007aff;
  1918. margin-right: 15rpx;
  1919. }
  1920. }
  1921. .firstLetter {
  1922. display: flex;
  1923. justify-content: space-between;
  1924. align-items: center;
  1925. margin-bottom: 30rpx;
  1926. }
  1927. .popupView {
  1928. height: 100%;
  1929. padding-bottom: 100rpx;
  1930. .popupTops {
  1931. height: 77rpx;
  1932. border-bottom: 1rpx solid #eee;
  1933. text-align: center;
  1934. line-height: 77rpx;
  1935. font-size: 24rpx;
  1936. color: #999;
  1937. position: relative;
  1938. .topIcon {
  1939. position: absolute;
  1940. top: 10rpx;
  1941. left: 50%;
  1942. transform: translateX(-50%);
  1943. width: 80rpx;
  1944. height: 8rpx;
  1945. background-color: #999;
  1946. border-radius: 4rpx;
  1947. }
  1948. }
  1949. .popupContent {
  1950. }
  1951. }
  1952. .pageContent {
  1953. position: relative;
  1954. background-color: #eaeef1;
  1955. height: 100%;
  1956. overflow-y: scroll;
  1957. padding-top: 8rpx;
  1958. padding-bottom: 100rpx;
  1959. }
  1960. .pad_8 {
  1961. background-color: #fff;
  1962. margin: 0rpx 8rpx 8rpx;
  1963. border-radius: 16rpx;
  1964. &.no-margin {
  1965. margin-top: -16rpx;
  1966. border-radius: 0 0 16rpx 16rpx;
  1967. }
  1968. }
  1969. .answer {
  1970. height: 80rpx;
  1971. line-height: 80rpx;
  1972. padding: 0rpx 24rpx;
  1973. display: flex;
  1974. align-items: center;
  1975. justify-content: space-between;
  1976. color: #666;
  1977. font-size: 30rpx;
  1978. }
  1979. .footer_btn {
  1980. background-color: #fff;
  1981. z-index: 10078;
  1982. position: fixed;
  1983. bottom: 0rpx;
  1984. display: flex;
  1985. align-items: center;
  1986. justify-content: space-between;
  1987. width: 100%;
  1988. height: 98rpx;
  1989. padding: 0rpx 38rpx;
  1990. border-top: 1rpx solid #eee;
  1991. .flex_center {
  1992. flex: 1;
  1993. display: flex;
  1994. justify-content: center;
  1995. align-items: center;
  1996. flex-direction: column;
  1997. margin: 0 200rpx;
  1998. font-size: 24rpx;
  1999. color: #999999;
  2000. .up-icon {
  2001. margin-bottom: 18rpx;
  2002. width: 100%;
  2003. display: flex;
  2004. justify-content: center;
  2005. image {
  2006. width: 58rpx;
  2007. height: 21rpx;
  2008. }
  2009. }
  2010. }
  2011. .collect {
  2012. visibility: hidden;
  2013. width: 100rpx;
  2014. &.show {
  2015. visibility: visible;
  2016. }
  2017. > view {
  2018. display: flex;
  2019. flex-direction: column;
  2020. align-items: center;
  2021. justify-content: center;
  2022. image {
  2023. width: 32rpx;
  2024. height: 32rpx;
  2025. margin-bottom: 6rpx;
  2026. }
  2027. view {
  2028. font-size: 24rpx;
  2029. color: #999999;
  2030. }
  2031. }
  2032. }
  2033. }
  2034. .boxSty {
  2035. padding: 44rpx 41rpx 0rpx;
  2036. }
  2037. .liListSty {
  2038. border: 1rpx solid #eeeeee;
  2039. width: 88rpx;
  2040. height: 88rpx;
  2041. border-radius: 32rpx;
  2042. text-align: center;
  2043. line-height: 88rpx;
  2044. color: #333;
  2045. font-size: 32rpx;
  2046. float: left;
  2047. margin: 20rpx 23rpx;
  2048. &.isRight {
  2049. border: 1rpx solid #eeeeee;
  2050. color: #fff;
  2051. background: #36c75a;
  2052. }
  2053. &.isWrong {
  2054. border: 1rpx solid #eeeeee;
  2055. color: #fff;
  2056. background: #ff3b30;
  2057. }
  2058. &.isPart {
  2059. border: 1rpx solid #eeeeee;
  2060. color: #fff;
  2061. background: #ffc53d;
  2062. }
  2063. }
  2064. .answerInfos {
  2065. padding: 25rpx 25rpx 25rpx 23rpx;
  2066. }
  2067. .answerTitle {
  2068. margin-bottom: 28rpx;
  2069. color: #666;
  2070. font-size: 30rpx;
  2071. }
  2072. .answerContent {
  2073. font-size: 30rpx;
  2074. color: #666;
  2075. }
  2076. .textChild {
  2077. display: inline-block;
  2078. vertical-align: middle;
  2079. }
  2080. .dialog {
  2081. position: fixed;
  2082. left: 0;
  2083. top: 0;
  2084. width: 100%;
  2085. height: 100%;
  2086. background-color: rgba(0, 0, 0, 0.8);
  2087. display: flex;
  2088. flex-direction: column;
  2089. align-items: center;
  2090. justify-content: center;
  2091. z-index: 20000;
  2092. .pointer {
  2093. width: 338rpx;
  2094. height: 240rpx;
  2095. }
  2096. .text {
  2097. font-size: 32rpx;
  2098. color: #ffffff;
  2099. text-align: center;
  2100. }
  2101. .btn {
  2102. width: 242rpx;
  2103. height: 82rpx;
  2104. border: 2rpx solid #ffffff;
  2105. border-radius: 16rpx;
  2106. text-align: center;
  2107. line-height: 82rpx;
  2108. margin: 41rpx auto;
  2109. color: #fff;
  2110. font-size: 32rpx;
  2111. }
  2112. }
  2113. </style>