wrongBank.vue 57 KB

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