questionBankExplainDetail.vue 66 KB

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