m-do-topic.vue 50 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771
  1. <template>
  2. <view>
  3. <countDown :time="examTime" @change="getUseTime" v-if="type == 'singleTest' || type == 'exam'"></countDown>
  4. <view v-if="!hiddenMode" class="mode">
  5. <view
  6. @click="
  7. () => {
  8. createOrderProblemList();
  9. mode = 0;
  10. }
  11. "
  12. :class="{
  13. 'mode-item_select': mode == 0,
  14. }"
  15. class="mode-item"
  16. >顺序练习</view
  17. >
  18. <view
  19. @click="
  20. () => {
  21. createRandomProblemList();
  22. mode = 1;
  23. }
  24. "
  25. :class="{
  26. 'mode-item_select': mode == 1,
  27. }"
  28. class="mode-item"
  29. >随机练习</view
  30. >
  31. <view
  32. @click="
  33. () => {
  34. createCompleteProblemList();
  35. mode = 2;
  36. }
  37. "
  38. :class="{
  39. 'mode-item_select': mode == 2,
  40. }"
  41. class="mode-item"
  42. >背题模式</view
  43. >
  44. <view
  45. :class="{
  46. 'mode-item_select': isAutoReadTopics,
  47. }"
  48. @click="
  49. () => {
  50. isAutoReadTopics = !isAutoReadTopics;
  51. isAutoReadTopics ? playCurrentIssue() : stopAudio();
  52. }
  53. "
  54. class="mode-item"
  55. >自动读题</view
  56. >
  57. </view>
  58. <view class="divider"></view>
  59. <view class="problem-box">
  60. <span class="problem-type">{{
  61. problemList[problemListIndex].questionType | questionType
  62. }}</span>
  63. <!-- <text>{{ problemListIndex + 1 }}、</text> -->
  64. <text class="problem-issue"
  65. >{{ problemListIndex + 1 }}、{{
  66. problemList[problemListIndex].issue
  67. }}</text
  68. >
  69. <view v-if="problemList[problemListIndex].image" class="problem-img">
  70. <image
  71. mode="widthFix"
  72. :src="problemList[problemListIndex].image"
  73. ></image>
  74. </view>
  75. <!-- #ifdef MP-WEIXIN -->
  76. <!-- 单项选择 -->
  77. <view
  78. v-if="
  79. problemList[problemListIndex].questionType < 3 &&
  80. !problemList[problemListIndex].isCompleted
  81. "
  82. class="problem-ops"
  83. >
  84. <van-radio-group
  85. :value="problemList[problemListIndex].userAnswer"
  86. :max="1"
  87. @change="changeRadioGroup"
  88. >
  89. <van-radio
  90. :value="problemList[problemListIndex].userAnswer === item.value"
  91. class="problem-checkbox"
  92. use-icon-slot
  93. v-for="(item, index) in problemList[problemListIndex].optsArr"
  94. :key="index"
  95. :name="item.value"
  96. >
  97. <text>{{ item.value }}</text>
  98. <view
  99. class="problem-op"
  100. :class="{
  101. 'problem-op_selected':
  102. problemList[problemListIndex].userAnswer === item.value,
  103. }"
  104. slot="icon"
  105. >{{ numberToLetter(index) }}</view
  106. >
  107. </van-radio>
  108. </van-radio-group>
  109. </view>
  110. <view
  111. v-if="
  112. problemList[problemListIndex].questionType < 3 &&
  113. problemList[problemListIndex].isCompleted
  114. "
  115. >
  116. <view
  117. v-for="(item, index) in problemList[problemListIndex].optsArr"
  118. :key="index"
  119. class="problem-select"
  120. >
  121. <icon
  122. v-if="item.isAnswer && item.selected"
  123. class="icon-box-img"
  124. type="success"
  125. color="#06c05f"
  126. size="37"
  127. ></icon>
  128. <icon
  129. v-if="!item.isAnswer && item.selected"
  130. class="icon-box-img"
  131. type="clear"
  132. color="red"
  133. size="37"
  134. ></icon>
  135. <text v-if="!item.isAnswer && !item.selected" class="problem-op">{{
  136. numberToLetter(index)
  137. }}</text>
  138. <text
  139. v-if="item.isAnswer && !item.selected"
  140. class="problem-op problem-op_green"
  141. >{{ numberToLetter(index) }}</text
  142. >
  143. <view style="width: 8px"></view>
  144. <text style="font-weight: 500" class="problem-opAnswer">{{
  145. item.value
  146. }}</text>
  147. </view>
  148. </view>
  149. <!-- 多项选择 -->
  150. <view
  151. v-if="
  152. problemList[problemListIndex].questionType == 3 &&
  153. !problemList[problemListIndex].isCompleted
  154. "
  155. class="problem-ops"
  156. >
  157. <van-checkbox-group
  158. :value="problemList[problemListIndex].userAnswer"
  159. :max="4"
  160. @change="changeCheckboxGroup"
  161. >
  162. <van-checkbox
  163. :value="
  164. problemList[problemListIndex].userAnswer.includes(item.value)
  165. "
  166. class="problem-checkbox"
  167. use-icon-slot
  168. v-for="(item, index) in problemList[problemListIndex].optsArr"
  169. :key="index"
  170. :name="item.value"
  171. >
  172. <text>{{ item.value }}</text>
  173. <view
  174. class="problem-op"
  175. :class="{
  176. 'problem-op_selected': item.selected,
  177. }"
  178. slot="icon"
  179. >{{ numberToLetter(index) }}</view
  180. >
  181. </van-checkbox>
  182. </van-checkbox-group>
  183. <view class="flex-center mt30 pb16">
  184. <van-button
  185. @click="confirmMult"
  186. color="#498ef5"
  187. round
  188. custom-style="width:600rpx"
  189. type="primary"
  190. >确定</van-button
  191. >
  192. </view>
  193. </view>
  194. <view
  195. class="problem-ops"
  196. v-if="
  197. problemList[problemListIndex].questionType == 3 &&
  198. problemList[problemListIndex].isCompleted
  199. "
  200. >
  201. <view
  202. v-for="(item, index) in problemList[problemListIndex].optsArr"
  203. :key="index"
  204. class="problem-select"
  205. >
  206. <icon
  207. v-if="item.isAnswer && item.selected"
  208. class="icon-box-img"
  209. type="success"
  210. color="#06c05f"
  211. size="37"
  212. ></icon>
  213. <icon
  214. v-if="!item.isAnswer && item.selected"
  215. class="icon-box-img"
  216. type="clear"
  217. size="37"
  218. color="red"
  219. ></icon>
  220. <text v-if="!item.isAnswer && !item.selected" class="problem-op">{{
  221. numberToLetter(index)
  222. }}</text>
  223. <text
  224. v-if="item.isAnswer && !item.selected"
  225. class="problem-op problem-op_green"
  226. >{{ numberToLetter(index) }}</text
  227. >
  228. <view style="width: 8px"></view>
  229. <text class="problem-opAnswer">{{ item.value }}</text>
  230. </view>
  231. </view>
  232. <!-- #endif -->
  233. <!-- #ifdef MP-TOUTIAO -->
  234. <!-- 判断 -->
  235. <view
  236. v-if="
  237. problemList[problemListIndex].questionType == 1 &&
  238. !problemList[problemListIndex].isCompleted
  239. "
  240. class="problem-ops"
  241. >
  242. <m-radio-group
  243. @change="changeRadioGroup"
  244. :value.sync="problemList[problemListIndex].userAnswer"
  245. >
  246. <m-radio
  247. :value="judgMap[item.value]"
  248. :item="item"
  249. :useIconSlot="true"
  250. :key="index"
  251. :name="numberToLetter(index)"
  252. v-for="(item, index) in problemList[problemListIndex].optsArr"
  253. >
  254. </m-radio>
  255. </m-radio-group>
  256. </view>
  257. <view
  258. class="problem-ops"
  259. v-if="
  260. problemList[problemListIndex].questionType == 1 &&
  261. problemList[problemListIndex].isCompleted
  262. "
  263. >
  264. <view
  265. v-for="(item, index) in problemList[problemListIndex].optsArr"
  266. :key="index"
  267. class="problem-select"
  268. >
  269. <icon
  270. v-if="item.isAnswer && item.selected"
  271. class="icon-box-img"
  272. type="success"
  273. color="#06c05f"
  274. size="37"
  275. ></icon>
  276. <icon
  277. v-if="!item.isAnswer && item.selected"
  278. class="icon-box-img"
  279. type="clear"
  280. size="37"
  281. ></icon>
  282. <text v-if="!item.isAnswer && !item.selected" class="problem-op">{{
  283. numberToLetter(index)
  284. }}</text>
  285. <text
  286. v-if="item.isAnswer && !item.selected"
  287. class="problem-op problem-op_green"
  288. >{{ numberToLetter(index) }}</text
  289. >
  290. <view style="width: 8px"></view>
  291. <text class="problem-opAnswer">{{ judgMap[item.value] }}</text>
  292. </view>
  293. </view>
  294. <!-- 单选 -->
  295. <view
  296. v-if="
  297. problemList[problemListIndex].questionType == 2 &&
  298. !problemList[problemListIndex].isCompleted
  299. "
  300. class="problem-ops"
  301. >
  302. <m-radio-group
  303. @change="changeRadioGroup"
  304. :value.sync="problemList[problemListIndex].userAnswer"
  305. >
  306. <m-radio
  307. :value="item.value"
  308. :item="item"
  309. :useIconSlot="true"
  310. :key="index"
  311. :name="numberToLetter(index)"
  312. v-for="(item, index) in problemList[problemListIndex].optsArr"
  313. >
  314. </m-radio>
  315. </m-radio-group>
  316. </view>
  317. <view
  318. class="problem-ops"
  319. v-if="
  320. problemList[problemListIndex].questionType == 2 &&
  321. problemList[problemListIndex].isCompleted
  322. "
  323. >
  324. <view
  325. v-for="(item, index) in problemList[problemListIndex].optsArr"
  326. :key="index"
  327. class="problem-select"
  328. >
  329. <icon
  330. v-if="item.isAnswer && item.selected"
  331. class="icon-box-img"
  332. type="success"
  333. color="#06c05f"
  334. size="37"
  335. ></icon>
  336. <icon
  337. v-if="!item.isAnswer && item.selected"
  338. class="icon-box-img"
  339. type="clear"
  340. size="37"
  341. ></icon>
  342. <text v-if="!item.isAnswer && !item.selected" class="problem-op">{{
  343. numberToLetter(index)
  344. }}</text>
  345. <text
  346. v-if="item.isAnswer && !item.selected"
  347. class="problem-op problem-op_green"
  348. >{{ numberToLetter(index) }}</text
  349. >
  350. <view style="width: 8px"></view>
  351. <text class="problem-opAnswer">{{ item.value }}</text>
  352. </view>
  353. </view>
  354. <!-- 多选 -->
  355. <view
  356. v-if="
  357. problemList[problemListIndex].questionType == 3 &&
  358. !problemList[problemListIndex].isCompleted
  359. "
  360. class="problem-ops"
  361. >
  362. <m-checkbox-group
  363. @change="changeCheckboxGroup"
  364. :value="problemList[problemListIndex].userAnswer"
  365. :max="4"
  366. >
  367. <m-checkbox
  368. @change="changeCheckbox"
  369. :item="item"
  370. :value="item.value"
  371. class="problem-checkbox"
  372. use-icon-slot
  373. v-for="(item, index) in problemList[problemListIndex].optsArr"
  374. :key="index"
  375. :name="numberToLetter(index)"
  376. >
  377. </m-checkbox>
  378. </m-checkbox-group>
  379. <view class="flex-center pb16">
  380. <van-button
  381. @click="confirmMult"
  382. color="#498ef5"
  383. round
  384. custom-style="width:600rpx"
  385. type="primary"
  386. >确定</van-button
  387. >
  388. </view>
  389. </view>
  390. <view
  391. class="problem-ops"
  392. v-if="
  393. problemList[problemListIndex].questionType == 3 &&
  394. problemList[problemListIndex].isCompleted
  395. "
  396. >
  397. <view
  398. v-for="(item, index) in problemList[problemListIndex].optsArr"
  399. :key="index"
  400. class="problem-select"
  401. >
  402. <icon
  403. v-if="item.isAnswer && item.selected"
  404. class="icon-box-img"
  405. type="success"
  406. color="#06c05f"
  407. size="37"
  408. ></icon>
  409. <icon
  410. v-if="!item.isAnswer && item.selected"
  411. class="icon-box-img"
  412. type="clear"
  413. size="37"
  414. ></icon>
  415. <text v-if="!item.isAnswer && !item.selected" class="problem-op">{{
  416. numberToLetter(index)
  417. }}</text>
  418. <text
  419. v-if="item.isAnswer && !item.selected"
  420. class="problem-op problem-op_green"
  421. >{{ numberToLetter(index) }}</text
  422. >
  423. <view style="width: 8px"></view>
  424. <text class="problem-opAnswer">{{ item.value }}</text>
  425. </view>
  426. </view>
  427. <view
  428. v-if="problemList[problemListIndex].isCompleted && !hiddenAnswer"
  429. class="answer"
  430. >
  431. <view
  432. v-if="
  433. problemList[problemListIndex].questionType == 1 &&
  434. problemList[problemListIndex].isCompleted
  435. "
  436. >
  437. 答案:{{ judgMap[problemList[problemListIndex].answer] }}
  438. </view>
  439. <view
  440. v-if="
  441. problemList[problemListIndex].questionType > 1 &&
  442. problemList[problemListIndex].isCompleted
  443. "
  444. >
  445. 答案: {{ problemList[problemListIndex].answer }}
  446. </view>
  447. </view>
  448. <funList
  449. :midFunc="midFunc"
  450. v-if="!hiddenFunction"
  451. @collect="collectTopics"
  452. @readQuestionAndAnswer="
  453. readQuestionAndAnswer();
  454. completeQuestion();
  455. "
  456. :problemListItem="problemList[problemListIndex]"
  457. ></funList>
  458. <!-- #endif -->
  459. <!-- <view v-if="!hiddenFunction" class="function-list">
  460. <div @click="collectTopics" class="function-item">
  461. <van-icon
  462. v-if="!problemList[problemListIndex].isCollect"
  463. name="star-o"
  464. size="25px"
  465. />
  466. <van-icon
  467. color="#ffde00ff"
  468. v-if="problemList[problemListIndex].isCollect"
  469. name="star"
  470. size="25px"
  471. />
  472. <span>收藏</span>
  473. </div>
  474. <div
  475. @click="
  476. readQuestionAndAnswer();
  477. completeQuestion();
  478. "
  479. class="function-item"
  480. >
  481. <m-jp-icon type="a-dtda" size="25px" />
  482. <span>读题+答案</span>
  483. </div>
  484. <div @click="readQuestion()" class="function-item">
  485. <m-jp-icon type="duti" size="25px" />
  486. <span>读题</span>
  487. </div>
  488. <div
  489. @click="
  490. () => {
  491. explainJqVisible = true;
  492. }
  493. "
  494. class="function-item"
  495. >
  496. <m-jp-icon type="jqjj" size="25px" />
  497. <span>技巧讲解</span>
  498. </div>
  499. </view> -->
  500. <!-- 底部的栏目 -->
  501. <!-- #ifdef MP-WEIXIN -->
  502. <van-tabbar height="20px">
  503. <van-tabbar-item @click="goBeforeTopics"
  504. ><van-icon
  505. slot="icon"
  506. custom-style="transform: rotate(90deg);"
  507. custom-class="last-subject"
  508. name="down"
  509. size="18px"
  510. />上一题
  511. </van-tabbar-item>
  512. <van-tabbar-item>
  513. <icon
  514. slot="icon"
  515. class="icon-box-img"
  516. type="success"
  517. size="18px"
  518. ></icon
  519. >{{ trueNum }}</van-tabbar-item
  520. >
  521. <van-tabbar-item
  522. ><icon
  523. slot="icon"
  524. class="icon-box-img"
  525. type="cancel"
  526. size="18px"
  527. ></icon>
  528. {{ falseNum }}
  529. </van-tabbar-item>
  530. <van-tabbar-item
  531. ><van-icon slot="icon" size="18px" name="description" />{{
  532. problemListIndex + 1
  533. }}/{{ problemListTotal }}
  534. </van-tabbar-item>
  535. <van-tabbar-item
  536. @click="
  537. () => {
  538. explainJsVisible = true;
  539. }
  540. "
  541. ><icon slot="icon" type="warn" size="18px" />解释
  542. </van-tabbar-item>
  543. <van-tabbar-item @click="goNextTopics"
  544. ><van-icon
  545. slot="icon"
  546. custom-style="transform: rotate(-90deg);"
  547. custom-class="last-subject"
  548. name="down"
  549. size="18px"
  550. />下一题
  551. </van-tabbar-item>
  552. </van-tabbar>
  553. <!-- #endif -->
  554. <!-- #ifdef MP-TOUTIAO -->
  555. <tabbar height="45px">
  556. <view v-if="bottomFunc.includes('previous')" class="h-full tabbar-item">
  557. <view @click="goBeforeTopics">
  558. <van-icon
  559. slot="icon"
  560. custom-style="transform: rotate(90deg);"
  561. custom-class="last-subject"
  562. name="down"
  563. size="18px"
  564. />
  565. <view style="width: 100%"> 上一题 </view>
  566. </view>
  567. </view>
  568. <view v-if="bottomFunc.includes('score')" class="h-full tabbar-item">
  569. <view class="tabbar-item">
  570. <icon
  571. class="icon-box-img"
  572. color="#06c05f"
  573. type="success"
  574. size="18px"
  575. ></icon
  576. ><view style="width: 100%; color: #06c05f">{{ trueNum }}</view>
  577. </view>
  578. <view style="margin-left: 15rpx" class="tabbar-item">
  579. <icon class="icon-box-img" type="clear" size="18px"></icon>
  580. <view style="width: 100%; color: red">{{ falseNum }}</view>
  581. </view>
  582. </view>
  583. <view
  584. v-if="bottomFunc.includes('catalogue')"
  585. class="h-full tabbar-item"
  586. >
  587. <van-icon size="18px" name="description" /><view style="width: 100%"
  588. >{{ problemListIndex + 1 }}/{{ problemList.length }}</view
  589. >
  590. </view>
  591. <view
  592. v-if="bottomFunc.includes('selectCatalogue')"
  593. @click="
  594. () => {
  595. selectProblemListVisible = true;
  596. }
  597. "
  598. class="h-full tabbar-item"
  599. >
  600. <van-icon size="18px" name="description" /><view style="width: 100%"
  601. >{{ problemListIndex + 1 }}/{{ problemList.length }}</view
  602. >
  603. </view>
  604. <view
  605. v-if="bottomFunc.includes('explain')"
  606. @click="
  607. () => {
  608. explainJsVisible = true;
  609. }
  610. "
  611. class="h-full tabbar-item"
  612. >
  613. <icon type="warn" size="18" /><view
  614. style="width: 100%; text-align: center"
  615. >解释</view
  616. >
  617. </view>
  618. <view
  619. @click="submitExam"
  620. v-if="bottomFunc.includes('submitExam')"
  621. class="h-full tabbar-item"
  622. >
  623. <van-icon slot="icon" size="18px" name="records" />
  624. <view style="width: 100%">交卷</view>
  625. </view>
  626. <view
  627. v-if="bottomFunc.includes('next')"
  628. @click="goNextTopics"
  629. class="h-full tabbar-item"
  630. >
  631. <van-icon
  632. slot="icon"
  633. custom-style="transform: rotate(-90deg);"
  634. custom-class="last-subject"
  635. name="down"
  636. size="18px"
  637. />
  638. <view style="width: 100%"> 下一题 </view>
  639. </view>
  640. </tabbar>
  641. <!-- #endif -->
  642. <van-overlay
  643. @click-overlay="
  644. () => {
  645. selectProblemListVisible = false;
  646. }
  647. "
  648. :show="selectProblemListVisible"
  649. >
  650. <view class="select-problem">
  651. <view class="problem-index">
  652. <view class="problem-header">
  653. <view class="problem-header-left">
  654. <view class="problem-dui">
  655. <icon
  656. class="icon-box-img"
  657. color="#06c05f"
  658. type="success"
  659. size="18"
  660. ></icon>
  661. <text
  662. style="color: #06c05f; font-size: 14px; margin-left: 8rpx"
  663. >{{ trueNum }}</text
  664. >
  665. </view>
  666. <view class="problem-cuo" style="margin-left: 16rpx">
  667. <icon class="icon-box-img" type="clear" size="18"></icon>
  668. <text
  669. style="color: red; font-size: 14px; margin-left: 8rpx"
  670. >{{ falseNum }}</text
  671. >
  672. </view>
  673. </view>
  674. <view class="problem-header-right">
  675. <van-icon size="18px" name="description" />
  676. <view
  677. style="font-size: 14px; display: flex; align-items: center"
  678. >{{ problemListIndex + 1 }}/{{ problemListTotal }}</view
  679. >
  680. </view>
  681. </view>
  682. <view class="problem-body">
  683. <view class="problem-listBody">
  684. <view
  685. class="problem-listItem"
  686. :key="index"
  687. @click="
  688. () => {
  689. $emit('update:problemListIndex', index);
  690. }
  691. "
  692. v-for="(item, index) in problemList"
  693. :class="{
  694. 'problem-listItem_dui':
  695. item.userAnswer.length && item.userAnswer == item.answer,
  696. 'problem-listItem_cuo':
  697. item.userAnswer.length && item.userAnswer !== item.answer,
  698. }"
  699. >
  700. {{ index + 1 }}
  701. </view>
  702. </view>
  703. </view>
  704. <view class="problem-bottom">
  705. <view
  706. @click="
  707. () => {
  708. selectProblemListVisible = false;
  709. }
  710. "
  711. class="problem-bottom-sure"
  712. >确定
  713. </view>
  714. <view
  715. @click="
  716. () => {
  717. selectProblemListVisible = false;
  718. }
  719. "
  720. class="problem-bottom-close"
  721. >
  722. 关闭</view
  723. >
  724. </view>
  725. </view>
  726. </view>
  727. </van-overlay>
  728. <explainJs
  729. @close="
  730. () => {
  731. explainJsVisible = false;
  732. }
  733. "
  734. :explainJs="problemList[problemListIndex].explainJs"
  735. :explainjsmp3="problemList[problemListIndex].explainjsmp3"
  736. :show="explainJsVisible"
  737. ></explainJs>
  738. </view>
  739. </view>
  740. </template>
  741. <script>
  742. import countDown from "@/components/countDown/index";
  743. import mRadio from "@/components/m-radio/m-radio.vue";
  744. import mRadioGroup from "@/components/m-radio-group/m-radio-group.vue";
  745. import mCheckbox from "@/components/m-checkbox/m-checkbox.vue";
  746. import mCheckboxGroup from "@/components/m-checkbox-group/m-checkbox-group.vue";
  747. import api from "@/api/index";
  748. import utils from "@/utils/index";
  749. import explainJq from "./components/explainJq.vue";
  750. import tabbar from "./components/tabbar.vue";
  751. import explainJs from "./components/explainJs.vue";
  752. import funList from "./components/funList.vue";
  753. let origProblemList = [];
  754. export default {
  755. data() {
  756. return {
  757. //topic
  758. //isCollect
  759. isAutoReadTopics: false,
  760. mode: 0,
  761. problemList: [
  762. {
  763. questionType: 2,
  764. answer: "×",
  765. answerkeyword: "",
  766. isCollect: false,
  767. answermp3:
  768. "https://t1-1305573081.file.myqcloud.com/kt/answer_mp3/answer1389.mp3",
  769. classIssue: "54",
  770. classIssueName: "车内开关/装置",
  771. classSort: 16,
  772. createTime: "2022-04-21 13:33:46",
  773. excellIssue: "23",
  774. excellIssueName: "必学题三",
  775. excellSort: 4,
  776. explainGif:
  777. "https://t1-1305573081.file.myqcloud.com/kt/explain_gif/explain1389.gif",
  778. explainJq:
  779. "看图答题:红色圆圈套在杆子中间.答对;不在中间或没有圆圈的.答错。",
  780. explainJs:
  781. "图中所示为左右转向灯开关转向灯操作:上提是右转向灯亮起,下压是左转向灯。",
  782. explainMp3:
  783. "https://t1-1305573081.file.myqcloud.com/kt/explain_mp3/explain1389.mp3",
  784. explainjsmp3:
  785. "https://t1-1305573081.file.myqcloud.com/kt/explain_js_mp3/explainJS1389.mp3",
  786. id: 831,
  787. idKt: 1389,
  788. idYdt: 950,
  789. image:
  790. "https://t1-1305573081.file.myqcloud.com/kt/image/image1389.png",
  791. imageYdt:
  792. "https://t1-1305573081.file.myqcloud.com/kt/image_ydt/5eb4d75agw1e291vmniovj.jpg",
  793. issue: "将转向灯开关向上提,左转向灯亮。",
  794. issuemp3:
  795. "https://t1-1305573081.file.myqcloud.com/kt/issue_mp3/issue1389.mp3",
  796. liceBus: "1",
  797. liceCar: "1",
  798. liceMoto: null,
  799. liceTruck: "1",
  800. number: 831,
  801. opts: "√-×",
  802. optsArr: ["√", "×"],
  803. placeIssue: null,
  804. placeIssueName: null,
  805. placeSort: null,
  806. questionType: 1,
  807. sequeIssue: "7",
  808. sequeIssueName: "机械仪表",
  809. sequeSort: 25,
  810. skillkeyword: "没有圆圈-答错",
  811. subject: 1,
  812. titlekeyword: "",
  813. updateTime: "2022-04-22 13:43:07",
  814. userAnswer: [],
  815. },
  816. ],
  817. judgMap: {
  818. "√": "正确",
  819. "×": "错误",
  820. },
  821. gsMap: {
  822. xc: "小车",
  823. hc: "货车",
  824. mtc: "摩托车",
  825. kc: "客车",
  826. },
  827. examTime:1000*60*45,
  828. useTime:'',
  829. problemListTotal: 1,
  830. explainJqVisible: false,
  831. selectProblemListVisible: false,
  832. explainJsVisible: false,
  833. trueNum: 0,
  834. falseNum: 0,
  835. errQuestionIds: [],
  836. };
  837. },
  838. watch: {
  839. //specify
  840. problemListIndex(newValue, oldValue) {
  841. if (this.isAutoReadTopics) {
  842. let audio = utils.wxUtils.getGlobAudio();
  843. audio.stop();
  844. audio.src = this.problemList[this.problemListIndex].issuemp3;
  845. audio.play();
  846. }
  847. },
  848. },
  849. methods: {
  850. getUseTime(leftTime,useTime){
  851. this.useTime = useTime
  852. },
  853. stopAudio() {
  854. let audio = utils.wxUtils.getGlobAudio();
  855. audio.stop();
  856. },
  857. playCurrentIssue() {
  858. let audio = utils.wxUtils.getGlobAudio();
  859. audio.stop();
  860. audio.src = this.problemList[this.problemListIndex].issuemp3;
  861. audio.play();
  862. },
  863. createCompleteProblemList() {
  864. if (this.mode == 2) {
  865. return;
  866. }
  867. let problemList = JSON.parse(JSON.stringify(origProblemList));
  868. problemList.forEach((item) => {
  869. item.optsArr.forEach((_item) => {
  870. if (_item.isAnswer) {
  871. _item.selected = true;
  872. }
  873. });
  874. item.isCompleted = true;
  875. });
  876. this.trueNum = 0;
  877. this.falseNum = 0;
  878. this.problemList = problemList;
  879. this.$emit("update:problemListIndex", 0);
  880. },
  881. createOrderProblemList() {
  882. if (this.mode == 0) {
  883. return;
  884. }
  885. let problemList = JSON.parse(JSON.stringify(origProblemList));
  886. console.log(problemList);
  887. console.log(origProblemList);
  888. this.problemList = problemList;
  889. this.trueNum = 0;
  890. this.falseNum = 0;
  891. //初始化序号
  892. this.$emit("update:problemListIndex", 0);
  893. },
  894. createRandomProblemList() {
  895. if (this.mode == 1) {
  896. return;
  897. }
  898. let problemList = JSON.parse(JSON.stringify(origProblemList));
  899. problemList.sort(function () {
  900. return Math.random() - 0.5;
  901. });
  902. this.problemList = problemList;
  903. this.trueNum = 0;
  904. this.falseNum = 0;
  905. //初始化序号
  906. this.$emit("update:problemListIndex", 0);
  907. },
  908. goBeforeTopics() {
  909. if (this.problemListIndex <= 0) {
  910. uni.showToast({
  911. title: "到底了",
  912. icon: "none",
  913. });
  914. return;
  915. }
  916. // this.problemListIndex = this.problemListIndex - 1;
  917. this.$emit("update:problemListIndex", this.problemListIndex - 1);
  918. },
  919. goNextTopics() {
  920. if (this.problemListIndex >= this.problemList.length - 1) {
  921. uni.showToast({
  922. title: "到底了",
  923. icon: "none",
  924. });
  925. return;
  926. }
  927. // this.problemListIndex = this.problemListIndex + 1;
  928. this.$emit("update:problemListIndex", this.problemListIndex + 1);
  929. },
  930. completeQuestion() {
  931. this.problemList[this.problemListIndex].optsArr.forEach((item, index) => {
  932. if (item.isAnswer) {
  933. this.$set(
  934. this.problemList[this.problemListIndex].optsArr[index],
  935. "selected",
  936. true
  937. );
  938. }
  939. });
  940. this.$set(this.problemList[this.problemListIndex], "isCompleted", true);
  941. this.$set(
  942. this.problemList[this.problemListIndex],
  943. "userAnswer",
  944. this.problemList[this.problemListIndex].answer
  945. );
  946. },
  947. submitExam(e) {
  948. let score = 0;
  949. let query = this.query;
  950. let that = this;
  951. let scorePerQuestion = 0;
  952. query.subject === "4" ? (scorePerQuestion = 2) : (scorePerQuestion = 1);
  953. score = this.trueNum * scorePerQuestion;
  954. uni.showModal({
  955. title: "是否交卷",
  956. content: "交卷后不可再修改了",
  957. success(res) {
  958. if (res.confirm) {
  959. let useTime = that.useTime;
  960. uni.navigateTo({
  961. url:
  962. "/otherPages/mockExamEnd/index?" +
  963. utils.mapToUrlQuery({
  964. score,
  965. useTime,
  966. questionIds: that.errQuestionIds.join(","),
  967. type: that.type,
  968. ...that.query,
  969. }),
  970. });
  971. }
  972. },
  973. fail() {},
  974. });
  975. },
  976. collectTopics(e) {
  977. api.exam
  978. .studentQuestionCollection({
  979. questionId: this.problemList[this.problemListIndex].id,
  980. carType: this.gsMap[this.query.gs],
  981. km: this.query.subject === "4" ? "科目四" : "科目一",
  982. })
  983. .then((res) => {
  984. if (!this.problemList[this.problemListIndex].isCollect) {
  985. this.$set(
  986. this.problemList[this.problemListIndex],
  987. "isCollect",
  988. true
  989. );
  990. uni.showToast({
  991. title: "收藏成功",
  992. });
  993. } else {
  994. this.$set(
  995. this.problemList[this.problemListIndex],
  996. "isCollect",
  997. false
  998. );
  999. uni.showToast({
  1000. title: "取消收藏",
  1001. icon: "fail",
  1002. });
  1003. }
  1004. });
  1005. },
  1006. readQuestionAndAnswer() {
  1007. let globalAudio = utils.wxUtils.getGlobAudio();
  1008. if (globalAudio) {
  1009. globalAudio.src = this.problemList[this.problemListIndex].issuemp3;
  1010. globalAudio.stop();
  1011. globalAudio.play();
  1012. globalAudio.onEnded(() => {
  1013. globalAudio.src = this.problemList[this.problemListIndex].answermp3;
  1014. globalAudio.stop();
  1015. globalAudio.play();
  1016. globalAudio.offEnded();
  1017. });
  1018. }
  1019. },
  1020. readQuestion() {
  1021. let globalAudio = utils.wxUtils.getGlobAudio();
  1022. if (globalAudio) {
  1023. globalAudio.src = this.problemList[this.problemListIndex].issuemp3;
  1024. globalAudio.stop();
  1025. globalAudio.play();
  1026. }
  1027. },
  1028. numberToLetter(index) {
  1029. index = Number(index);
  1030. return String.fromCharCode(index + 65);
  1031. },
  1032. confirmMult(e) {
  1033. this.$set(this.problemList[this.problemListIndex], "isCompleted", true);
  1034. if (
  1035. JSON.stringify(
  1036. this.problemList[this.problemListIndex].answer.split("-").sort()
  1037. ) ===
  1038. JSON.stringify(
  1039. this.problemList[this.problemListIndex].userAnswer.sort()
  1040. )
  1041. ) {
  1042. this.trueNum++;
  1043. this.$emit("update:trueNum", this.trueNum);
  1044. } else {
  1045. this.falseNum++;
  1046. this.$emit("update:falseNum", this.falseNum);
  1047. this.errQuestionIds.includes(this.problemList[this.problemListIndex].id)
  1048. ? ""
  1049. : this.errQuestionIds.push(
  1050. this.problemList[this.problemListIndex].id
  1051. );
  1052. api.exam.studentQuestionWrong({
  1053. questionId: this.problemList[this.problemListIndex].id,
  1054. carType: this.gsMap[this.query.gs],
  1055. km: this.query.subject === "4" ? "科目四" : "科目一",
  1056. });
  1057. }
  1058. // this.problemList[this.problemListIndex]
  1059. },
  1060. changeCheckboxGroup(e) {
  1061. //console.log(e);
  1062. // this.$set()
  1063. // #ifdef MP-WEIXIN
  1064. this.$set(
  1065. this.problemList[this.problemListIndex],
  1066. "userAnswer",
  1067. e.detail
  1068. );
  1069. this.problemList[this.problemListIndex].optsArr.forEach((item) => {
  1070. if (e.detail.includes(item.value)) {
  1071. item.selected = true;
  1072. } else {
  1073. item.selected = false;
  1074. }
  1075. });
  1076. //#endif
  1077. // #ifdef MP-TOUTIAO
  1078. this.$set(
  1079. this.problemList[this.problemListIndex],
  1080. "userAnswer",
  1081. e.detail
  1082. );
  1083. this.problemList[this.problemListIndex].optsArr.forEach((item, index) => {
  1084. if (e.detail.includes(item.value)) {
  1085. item.selected = true;
  1086. this.$set(
  1087. this.problemList[this.problemListIndex].optsArr[index],
  1088. "selected",
  1089. true
  1090. );
  1091. } else {
  1092. item.selected = false;
  1093. this.$set(
  1094. this.problemList[this.problemListIndex].optsArr[index],
  1095. "selected",
  1096. false
  1097. );
  1098. }
  1099. });
  1100. //#endif
  1101. // if (
  1102. // this.problemList[this.problemListIndex].answer
  1103. // .split("-")
  1104. // .sort()
  1105. // .toString() ===
  1106. // this.problemList[this.problemListIndex].userAnswer.sort().toString()
  1107. // ) {
  1108. // this.trueNum = this.trueNum + 1;
  1109. // this.$emit("update:trueNum", this.trueNum);
  1110. // } else {
  1111. // this.falseNum = this.falseNum + 1;
  1112. // this.$emit("update:falseNum", this.falseNum);
  1113. // }
  1114. //score=1&useTime=NaN%3ANaN&questionIds=&type=&cert=C1%2FC2%2FC3&vehicle=%E8%BD%BF%E8%BD%A6&subject=1&title=%E9%A1%BA%E5%BA%8F%E7%BB%83%E4%B9%A0&liceCar=1&liceTruck=&liceBus=&liceMoto=&name=%E7%A7%91%E7%9B%AE%E4%B8%80&gs=xc&sort=3&sequeIssueName=%E7%BB%83%E4%B9%A0%E4%B8%80&__id__=3
  1115. },
  1116. changeRadioGroup(e) {
  1117. console.log(e, "changeRadioGroup");
  1118. // #ifdef MP-WEIXIN
  1119. this.$set(this.problemList[this.problemListIndex], "isCompleted", true);
  1120. if (e.detail == this.problemList[this.problemListIndex].answer) {
  1121. this.trueNum = this.trueNum + 1;
  1122. this.$emit("update:trueNum", this.trueNum);
  1123. } else {
  1124. this.falseNum = this.falseNum + 1;
  1125. api.exam.studentQuestionWrong({
  1126. questionId: this.problemList[this.problemListIndex].id,
  1127. carType: this.gsMap[this.query.gs],
  1128. km: this.query.subject === "4" ? "科目四" : "科目一",
  1129. });
  1130. this.$emit("update:falseNum", this.falseNum);
  1131. this.errQuestionIds.includes(this.problemList[this.problemListIndex].id)
  1132. ? ""
  1133. : this.errQuestionIds.push(
  1134. this.problemList[this.problemListIndex].id
  1135. );
  1136. console.log(this.errQuestionIds);
  1137. }
  1138. this.$set(
  1139. this.problemList[this.problemListIndex],
  1140. "userAnswer",
  1141. e.detail
  1142. );
  1143. this.optsArr = this.problemList[this.problemListIndex].optsArr.map(
  1144. (item) => {
  1145. item.selected = item.value == e.detail;
  1146. }
  1147. );
  1148. // e.detail.value === this.problemList[this.problemListIndex].answer
  1149. // ? (this.trueNum = this.trueNum + 1)
  1150. // : (this.falseNum = this.falseNum + 1);
  1151. //#endif
  1152. // #ifdef MP-TOUTIAO
  1153. this.$set(this.problemList[this.problemListIndex], "isCompleted", true);
  1154. this.$set(
  1155. this.problemList[this.problemListIndex],
  1156. "userAnswer",
  1157. e.detail
  1158. );
  1159. this.problemList[this.problemListIndex].optsArr.forEach((item, index) => {
  1160. if (e.detail === item.value) {
  1161. item.selected = true;
  1162. this.$set(
  1163. this.problemList[this.problemListIndex].optsArr[index],
  1164. "selected",
  1165. true
  1166. );
  1167. } else {
  1168. item.selected = false;
  1169. this.$set(
  1170. this.problemList[this.problemListIndex].optsArr[index],
  1171. "selected",
  1172. false
  1173. );
  1174. }
  1175. });
  1176. console.log(e, "组件");
  1177. if (e.detail === this.problemList[this.problemListIndex].answer) {
  1178. this.trueNum = this.trueNum + 1;
  1179. this.$emit("update:trueNum", this.trueNum);
  1180. } else {
  1181. this.falseNum = this.falseNum + 1;
  1182. this.$emit("update:falseNum", this.falseNum);
  1183. this.errQuestionIds.includes(this.problemList[this.problemListIndex].id)
  1184. ? ""
  1185. : this.errQuestionIds.push(
  1186. this.problemList[this.problemListIndex].id
  1187. );
  1188. api.exam.studentQuestionWrong({
  1189. questionId: this.problemList[this.problemListIndex].id,
  1190. carType: this.gsMap[this.query.gs],
  1191. km: this.query.subject === "4" ? "科目四" : "科目一",
  1192. });
  1193. }
  1194. //#endif
  1195. },
  1196. },
  1197. filters: {
  1198. questionType: function (value) {
  1199. let question = "";
  1200. switch (value) {
  1201. case 1:
  1202. case "1":
  1203. question = "判断题";
  1204. break;
  1205. case 2:
  1206. case "2":
  1207. question = "单选题";
  1208. break;
  1209. case 3:
  1210. case "3":
  1211. question = "多选题";
  1212. break;
  1213. }
  1214. return question;
  1215. },
  1216. },
  1217. components: {
  1218. mRadio,
  1219. mRadioGroup,
  1220. mCheckbox,
  1221. mCheckboxGroup,
  1222. explainJq,
  1223. tabbar,
  1224. explainJs,
  1225. funList,
  1226. countDown,
  1227. },
  1228. props: {
  1229. midFunc: {
  1230. type: Array,
  1231. default: () => {
  1232. return [];
  1233. },
  1234. },
  1235. bottomFunc: {
  1236. type: Array,
  1237. default: () => {
  1238. return [];
  1239. },
  1240. },
  1241. hiddenAnswer: {
  1242. type: Boolean,
  1243. default: false,
  1244. },
  1245. hiddenFunction: {
  1246. type: Boolean,
  1247. default: false,
  1248. },
  1249. hiddenMode: {
  1250. type: Boolean,
  1251. default: false,
  1252. },
  1253. problemListTotal: {
  1254. type: Number,
  1255. default: 0,
  1256. },
  1257. query: {
  1258. type: Object,
  1259. default: () => {
  1260. return {};
  1261. },
  1262. },
  1263. type: {
  1264. type: String,
  1265. default: "",
  1266. },
  1267. problemListIndex: {
  1268. type: Number,
  1269. default: 0,
  1270. },
  1271. },
  1272. mounted() {
  1273. let that = this;
  1274. uni.showLoading({
  1275. title: "加载题目中",
  1276. });
  1277. switch (that.type) {
  1278. case "specify":
  1279. api.open
  1280. .questionInfoGetQuestionInfoByIds({
  1281. ids: newValue.questionIds,
  1282. })
  1283. .then((res) => {
  1284. res.rows.forEach((element) => {
  1285. element.optsArr = [];
  1286. element.isCollect = false;
  1287. element.opts.split("-").forEach((item, index) => {
  1288. if (element.questionType == 3) {
  1289. element.optsArr.push({
  1290. selected: false,
  1291. value: item,
  1292. index: index,
  1293. isAnswer: element.answer.split("-").includes(item),
  1294. });
  1295. } else {
  1296. element.optsArr.push({
  1297. selected: false,
  1298. value: item,
  1299. index: index,
  1300. isAnswer: item === element.answer,
  1301. });
  1302. }
  1303. });
  1304. element.isCompleted = false;
  1305. element.userAnswer = [];
  1306. });
  1307. that.problemListTotal = res.total;
  1308. origProblemList = JSON.parse(JSON.stringify(res.rows));
  1309. that.problemList = res.rows;
  1310. that.$emit("update:problemListTotal", res.total);
  1311. uni.hideLoading();
  1312. });
  1313. break;
  1314. case "exam":
  1315. api.exam
  1316. .studentQuestionInfoSelectTestQuestionInfo({
  1317. gs: "xc",
  1318. subject: 1,
  1319. })
  1320. .then((res) => {
  1321. res.rows.forEach((element) => {
  1322. element.optsArr = [];
  1323. element.isCollect = false;
  1324. element.opts.split("-").forEach((item, index) => {
  1325. if (element.questionType == 3) {
  1326. element.optsArr.push({
  1327. selected: false,
  1328. value: item,
  1329. index: index,
  1330. isAnswer: element.answer.split("-").includes(item),
  1331. });
  1332. } else {
  1333. element.optsArr.push({
  1334. selected: false,
  1335. value: item,
  1336. index: index,
  1337. isAnswer: item === element.answer,
  1338. });
  1339. }
  1340. });
  1341. element.isCompleted = false;
  1342. element.userAnswer = [];
  1343. });
  1344. that.problemListTotal = res.total;
  1345. origProblemList = JSON.parse(JSON.stringify(res.rows));
  1346. that.problemList = res.rows;
  1347. that.$emit("update:problemListTotal", res.total);
  1348. uni.hideLoading();
  1349. });
  1350. break;
  1351. case "free":
  1352. api.open
  1353. .questionInfoSelectFreeQuestionInfo({
  1354. ...this.query,
  1355. })
  1356. .then((res) => {
  1357. res.rows.forEach((element) => {
  1358. element.optsArr = [];
  1359. element.opts.split("-").forEach((item, index) => {
  1360. if (element.questionType == 3) {
  1361. element.optsArr.push({
  1362. selected: false,
  1363. value: item,
  1364. index: index,
  1365. isAnswer: element.answer.split("-").includes(item),
  1366. });
  1367. } else {
  1368. element.optsArr.push({
  1369. selected: false,
  1370. value: item,
  1371. index: index,
  1372. isAnswer: item === element.answer,
  1373. });
  1374. }
  1375. });
  1376. element.isCompleted = false;
  1377. element.userAnswer = [];
  1378. });
  1379. that.problemList = res.rows;
  1380. origProblemList = JSON.parse(JSON.stringify(res.rows));
  1381. that.problemListTotal = res.total;
  1382. uni.hideLoading();
  1383. });
  1384. break;
  1385. case "wrong":
  1386. api.exam
  1387. .studentQuestionWrongWrongByUser({
  1388. carType: this.gsMap[this.query.gs],
  1389. km: this.query.subject === "1" ? "科目一" : "科目四",
  1390. })
  1391. .then((res) => {
  1392. res.data.forEach((element) => {
  1393. element.optsArr = [];
  1394. element.opts.split("-").forEach((item, index) => {
  1395. if (element.questionType == 3) {
  1396. element.optsArr.push({
  1397. selected: false,
  1398. value: item,
  1399. index: index,
  1400. isAnswer: element.answer.split("-").includes(item),
  1401. });
  1402. } else {
  1403. element.optsArr.push({
  1404. selected: false,
  1405. value: item,
  1406. index: index,
  1407. isAnswer: item === element.answer,
  1408. });
  1409. }
  1410. });
  1411. element.isCompleted = false;
  1412. element.userAnswer = [];
  1413. });
  1414. that.problemListTotal = res.total;
  1415. that.problemList = res.data;
  1416. origProblemList = JSON.parse(JSON.stringify(res.data));
  1417. that.$emit("update:problemListTotal", res.data.length);
  1418. uni.hideLoading();
  1419. uni.hideLoading();
  1420. });
  1421. break;
  1422. case "collect":
  1423. api.exam
  1424. .studentQuestionCollectionCollectionByUser({
  1425. carType: this.gsMap[this.query.gs],
  1426. km: this.query.subject === "1" ? "科目一" : "科目四",
  1427. })
  1428. .then((res) => {
  1429. res.data.forEach((element) => {
  1430. element.optsArr = [];
  1431. element.opts.split("-").forEach((item, index) => {
  1432. if (element.questionType == 3) {
  1433. element.optsArr.push({
  1434. selected: false,
  1435. value: item,
  1436. index: index,
  1437. isAnswer: element.answer.split("-").includes(item),
  1438. });
  1439. } else {
  1440. element.optsArr.push({
  1441. selected: false,
  1442. value: item,
  1443. index: index,
  1444. isAnswer: item === element.answer,
  1445. });
  1446. }
  1447. });
  1448. element.isCompleted = false;
  1449. element.userAnswer = [];
  1450. });
  1451. that.problemListTotal = res.total;
  1452. that.problemList = res.data;
  1453. origProblemList = JSON.parse(JSON.stringify(res.data));
  1454. that.$emit("update:problemListTotal", res.data.length);
  1455. uni.hideLoading();
  1456. });
  1457. break;
  1458. default:
  1459. api.exam
  1460. .studentQuestionInfoList({
  1461. ...this.query,
  1462. })
  1463. .then((res) => {
  1464. res.rows.forEach((element) => {
  1465. element.optsArr = [];
  1466. element.opts.split("-").forEach((item, index) => {
  1467. if (element.questionType == 3) {
  1468. element.optsArr.push({
  1469. selected: false,
  1470. value: item,
  1471. index: index,
  1472. isAnswer: element.answer.split("-").includes(item),
  1473. });
  1474. } else {
  1475. element.optsArr.push({
  1476. selected: false,
  1477. value: item,
  1478. index: index,
  1479. isAnswer: item === element.answer,
  1480. });
  1481. }
  1482. });
  1483. element.isCompleted = false;
  1484. element.userAnswer = [];
  1485. });
  1486. that.problemListTotal = res.total;
  1487. that.problemList = res.rows;
  1488. origProblemList = JSON.parse(JSON.stringify(res.rows));
  1489. that.$emit("update:problemListTotal", res.total);
  1490. uni.hideLoading();
  1491. });
  1492. break;
  1493. }
  1494. },
  1495. };
  1496. </script>
  1497. <style lang="scss" scoped>
  1498. .answer {
  1499. padding-left: 16rpx;
  1500. padding-bottom: 16rpx;
  1501. padding-top: 16rpx;
  1502. > view {
  1503. padding-left: 16rpx;
  1504. background: #d8d8d8;
  1505. padding-bottom: 8rpx;
  1506. padding-top: 8rpx;
  1507. }
  1508. }
  1509. .pb16 {
  1510. padding-bottom: 16rpx;
  1511. }
  1512. .mode {
  1513. display: flex;
  1514. padding: 20rpx 30rpx;
  1515. justify-content: space-between;
  1516. border-top: 2rpx solid #d8d8d8;
  1517. .mode-item {
  1518. width: 140rpx;
  1519. height: 50rpx;
  1520. font-size: 26rpx;
  1521. line-height: 50rpx;
  1522. background: #b8c0cc;
  1523. color: #fff;
  1524. text-align: center;
  1525. border-radius: 32rpx;
  1526. }
  1527. .mode-item_select {
  1528. background: #498ef5;
  1529. }
  1530. }
  1531. .divider {
  1532. width: 100%;
  1533. height: 24rpx;
  1534. background-color: #f2f3f5;
  1535. }
  1536. .select-problem {
  1537. display: flex;
  1538. width: 100vw;
  1539. height: 100vh;
  1540. align-content: flex-end;
  1541. align-items: flex-end;
  1542. .problem-index {
  1543. width: 100vw;
  1544. height: 650rpx;
  1545. background: #fff;
  1546. border-radius: 16rpx;
  1547. padding-top: 50rpx;
  1548. }
  1549. .problem-bottom {
  1550. width: 100%;
  1551. display: flex;
  1552. height: 80rpx;
  1553. .problem-bottom-sure {
  1554. width: 50%;
  1555. height: 100%;
  1556. border-right: 2rpx solid #d8d8d8;
  1557. border-top: 2rpx solid #d8d8d8;
  1558. text-align: center;
  1559. color: #498ef5;
  1560. line-height: 80rpx;
  1561. }
  1562. .problem-bottom-close {
  1563. width: 50%;
  1564. height: 100%;
  1565. color: red;
  1566. text-align: center;
  1567. border-top: 2rpx solid #d8d8d8;
  1568. line-height: 80rpx;
  1569. }
  1570. }
  1571. .problem-header {
  1572. display: flex;
  1573. justify-content: space-between;
  1574. align-content: center;
  1575. align-items: center;
  1576. padding: 0rpx 30rpx;
  1577. .problem-header-left {
  1578. display: flex;
  1579. .problem-dui {
  1580. display: flex;
  1581. align-content: center;
  1582. align-items: center;
  1583. }
  1584. .problem-cuo {
  1585. display: flex;
  1586. align-content: center;
  1587. align-items: center;
  1588. }
  1589. }
  1590. .problem-header-right {
  1591. display: flex;
  1592. align-content: center;
  1593. }
  1594. }
  1595. .problem-body {
  1596. height: 480rpx;
  1597. padding-top: 30rpx;
  1598. overflow-y: scroll;
  1599. .problem-listBody {
  1600. display: inline-block;
  1601. overflow: hidden;
  1602. .problem-listItem {
  1603. display: inline-block;
  1604. width: 99rpx;
  1605. height: 99rpx;
  1606. line-height: 100rpx;
  1607. text-align: center;
  1608. border-radius: 50%;
  1609. border: 2rpx #d8d8d8 solid;
  1610. margin-bottom: 15rpx;
  1611. margin-left: 13rpx;
  1612. margin-right: 13rpx;
  1613. }
  1614. .problem-listItem_dui {
  1615. background: #c1e6db;
  1616. color: #4eb79a;
  1617. }
  1618. .problem-listItem_cuo {
  1619. background: #e6c5c6;
  1620. }
  1621. }
  1622. }
  1623. }
  1624. .tabbar-item {
  1625. display: flex;
  1626. flex-wrap: wrap;
  1627. justify-content: center;
  1628. text-align: center;
  1629. align-content: space-around;
  1630. align-items: space-around;
  1631. }
  1632. .mt30 {
  1633. margin-top: 30rpx;
  1634. }
  1635. .flex-center {
  1636. display: flex;
  1637. justify-content: center;
  1638. }
  1639. .problem-box {
  1640. padding: 15rpx;
  1641. padding-bottom: 45px;
  1642. background: #fff;
  1643. /deep/ .van-checkbox {
  1644. padding-bottom: 15rpx;
  1645. }
  1646. /deep/ .van-radio {
  1647. padding-bottom: 15rpx;
  1648. }
  1649. .problem-issue {
  1650. font-size: 38rpx;
  1651. font-weight: 500;
  1652. }
  1653. .problem-select {
  1654. display: flex;
  1655. align-content: center;
  1656. align-items: center;
  1657. padding-top: 16rpx;
  1658. padding-bottom: 16rpx;
  1659. }
  1660. .problem-type {
  1661. padding-left: 10rpx;
  1662. padding-right: 10rpx;
  1663. padding-top: 4rpx;
  1664. padding-bottom: 4rpx;
  1665. font-size: 24rpx;
  1666. border-radius: 16rpx 16rpx 0 16rpx;
  1667. background: #498ef5;
  1668. margin-right: 10rpx;
  1669. color: #fff;
  1670. font-size: 32rpx;
  1671. }
  1672. .problem-ops {
  1673. margin-top: 30rpx;
  1674. padding-left: 30rpx;
  1675. .problem-checkbox {
  1676. height: 100rpx;
  1677. margin-bottom: 30rpx;
  1678. }
  1679. }
  1680. .problem-op {
  1681. width: 75rpx;
  1682. height: 75rpx;
  1683. line-height: 75rpx;
  1684. border-radius: 50%;
  1685. text-align: center;
  1686. overflow: hidden;
  1687. background: #fff;
  1688. box-shadow: 0px 4rpx 12rpx rgba(0, 0, 0, 0.16);
  1689. }
  1690. .problem-op_green {
  1691. width: 75rpx;
  1692. height: 75rpx;
  1693. line-height: 75rpx;
  1694. border-radius: 50%;
  1695. text-align: center;
  1696. overflow: hidden;
  1697. background: #01c18d;
  1698. box-shadow: 0px 4rpx 12rpx rgba(0, 0, 0, 0.16);
  1699. }
  1700. .problem-op_selected {
  1701. background: #498ef5;
  1702. }
  1703. .problem-img {
  1704. width: 100%;
  1705. margin-top: 20rpx;
  1706. display: flex;
  1707. justify-content: center;
  1708. image {
  1709. margin: 0 auto;
  1710. }
  1711. }
  1712. }
  1713. .function-list {
  1714. width: 100%;
  1715. font-size: 13px;
  1716. display: flex;
  1717. justify-content: space-around;
  1718. flex-wrap: wrap;
  1719. padding: 8px;
  1720. box-sizing: border-box;
  1721. border-top: 2rpx solid #d8d8d8;
  1722. .function-item {
  1723. margin-bottom: 20px;
  1724. width: 20%;
  1725. display: flex;
  1726. flex-direction: column;
  1727. align-items: center;
  1728. font-size: 13px;
  1729. font-weight: 400;
  1730. color: #8a9099;
  1731. span {
  1732. margin-top: 5px;
  1733. }
  1734. }
  1735. }
  1736. </style>