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