index.vue 81 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815
  1. <template>
  2. <view class="questionBank">
  3. <uni-nav-bar
  4. @clickLeft="clickLeft"
  5. left-icon="back"
  6. ref="navbar"
  7. :statusBar="true"
  8. :title="examData.examName"
  9. ></uni-nav-bar>
  10. <swiper class="swiper" :current="current" @change="swiperChange">
  11. <swiper-item v-for="(bank, bankIndex) in questionList" :key="bankIndex">
  12. <view class="pageContent">
  13. <view class="pad_8 titBox">
  14. <view class="firstLetter">
  15. <view class="leftLetters">
  16. <view class="btnType">
  17. <text v-if="bank.type == 1">单选</text>
  18. <text v-if="bank.type == 2">多选</text>
  19. <text v-if="bank.type == 3">判断</text>
  20. <text v-if="bank.type == 4">案例</text>
  21. <text v-if="bank.type == 5">简答</text>
  22. </view>
  23. <text>{{ bankIndex + 1 }}/{{ questionList.length }}</text>
  24. </view>
  25. <view style="color: #666; font-size: 28rpx">{{
  26. countdown(lastTime)
  27. }}</view>
  28. </view>
  29. <view class="titles" @click="showPhoto(bank.content)"
  30. ><rich-text :nodes="bank.content"></rich-text
  31. ></view>
  32. </view>
  33. <template v-if="bank.type == 1">
  34. <view class="pad_8 titBox no-margin">
  35. <view v-if="!bank.ques">
  36. <view
  37. v-for="(item, index) in bank.jsonStr"
  38. :key="index"
  39. class="lisSty"
  40. @click="radioSelect(item.optionsId, bankIndex)"
  41. >
  42. <view class="activeTI">{{ ast[index] }}</view>
  43. <view class="flex_auto"
  44. >{{ item.content }}
  45. <view v-if="item.imgUrl">
  46. <image
  47. style="width: 600rpx"
  48. mode="widthFix"
  49. :src="$method.splitImgHost(item.imgUrl)"
  50. ></image>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. <view v-if="bank.ques">
  56. <view
  57. v-for="(item, index) in bank.jsonStr"
  58. :key="index"
  59. class="lisSty"
  60. @click="radioSelect(item.optionsId, bankIndex)"
  61. >
  62. <text
  63. :class="{
  64. right:
  65. bankType == 1 &&
  66. (item.optionsId == bank.ques ||
  67. item.optionsId == bank.ans),
  68. wrong:
  69. bankType == 1 &&
  70. item.optionsId == bank.ques &&
  71. bank.ques != bank.ans,
  72. user_choose: bankType == 2 && item.optionsId == bank.ques,
  73. }"
  74. class="activeTI"
  75. >
  76. {{ ast[index] }}
  77. </text>
  78. <view class="flex_auto">
  79. {{ item.content }}
  80. <view v-if="item.imgUrl">
  81. <image
  82. style="width: 600rpx"
  83. mode="widthFix"
  84. :src="$method.splitImgHost(item.imgUrl)"
  85. ></image>
  86. </view>
  87. </view>
  88. </view>
  89. </view>
  90. </view>
  91. <view v-if="bankType == 1 && bank.ques">
  92. <view class="pad_8 answer">
  93. <view>题目答案:{{ ast[bank.ans - 1] }} </view>
  94. <view>我的答案:{{ ast[bank.ques - 1] }}</view>
  95. </view>
  96. <view class="pad_8 answerInfos">
  97. <view class="answerTitle">答案解析</view>
  98. <view class="answerContent"
  99. ><rich-text :nodes="bank.analysisContent"></rich-text
  100. ></view>
  101. </view>
  102. </view>
  103. </template>
  104. <template v-if="bank.type == 2">
  105. <view class="pad_8 titBox no-margin">
  106. <view v-if="!bank.ques">
  107. <view
  108. v-for="(item, index) in bank.jsonStr"
  109. :key="index"
  110. class="lisSty"
  111. @click="checkboxSelect(item.optionsId, bankIndex, index)"
  112. >
  113. <view :class="{ checked: item.checked }" class="activeTI">{{
  114. ast[index]
  115. }}</view>
  116. <view class="flex_auto">
  117. {{ item.content }}
  118. <view v-if="item.imgUrl">
  119. <image
  120. style="width: 600rpx"
  121. mode="widthFix"
  122. :src="$method.splitImgHost(item.imgUrl)"
  123. ></image>
  124. </view>
  125. </view>
  126. </view>
  127. </view>
  128. <view v-if="bank.ques">
  129. <view
  130. v-for="(item, index) in bank.jsonStr"
  131. :key="index"
  132. class="lisSty"
  133. @click="checkboxSelect(item.optionsId, bankIndex, index)"
  134. >
  135. <text
  136. :class="{
  137. right:
  138. bankType == 1 &&
  139. (bank.ques.indexOf(item.optionsId) != -1 ||
  140. bank.ans.indexOf(item.optionsId) != -1),
  141. wrong:
  142. bankType == 1 &&
  143. bank.ques.indexOf(item.optionsId) != -1 &&
  144. bank.ans.indexOf(item.optionsId) == -1,
  145. user_choose: bankType == 2 && item.checked,
  146. }"
  147. class="activeTI"
  148. >
  149. {{ ast[index] }}
  150. </text>
  151. <view class="flex_auto">
  152. {{ item.content }}
  153. <view v-if="item.imgUrl">
  154. <image
  155. style="width: 600rpx"
  156. mode="widthFix"
  157. :src="$method.splitImgHost(item.imgUrl)"
  158. ></image>
  159. </view>
  160. </view>
  161. </view>
  162. </view>
  163. <view
  164. v-if="bankType == 2 || (bankType == 1 && !bank.ques)"
  165. class="submit_checkbox"
  166. :class="{ disabled: !isCheckboxChecked(bank.jsonStr) }"
  167. @click="checkboxSubmit(bankIndex)"
  168. >确认答案</view
  169. >
  170. </view>
  171. <view v-if="bankType == 1 && bank.ques">
  172. <view class="pad_8 answer">
  173. <view>
  174. 题目答案:
  175. <text
  176. v-for="(ansItem, ansIndex) in bank.ans"
  177. :key="ansIndex"
  178. >{{ ast[ansItem - 1] }}</text
  179. >
  180. </view>
  181. <view>
  182. 我的答案:
  183. <text
  184. v-for="(quesItem, quesIndex) in bank.ques"
  185. :key="quesIndex"
  186. >{{ ast[quesItem - 1] }}</text
  187. >
  188. </view>
  189. </view>
  190. <view class="pad_8 answerInfos">
  191. <view class="answerTitle">答案解析</view>
  192. <view class="answerContent"
  193. ><rich-text :nodes="bank.analysisContent"></rich-text
  194. ></view>
  195. </view>
  196. </view>
  197. </template>
  198. <template v-if="bank.type == 3">
  199. <view class="pad_8 titBox no-margin">
  200. <view v-if="!bank.ques">
  201. <view
  202. v-for="(item, index) in judge"
  203. :key="index"
  204. class="lisSty"
  205. @click="judgeSelect(index, bankIndex)"
  206. >
  207. <view class="activeTI">{{ ast[index] }}</view>
  208. <view class="flex_auto">
  209. {{ item }}
  210. <view v-if="item.imgUrl">
  211. <image
  212. style="width: 600rpx"
  213. mode="widthFix"
  214. :src="$method.splitImgHost(item.imgUrl)"
  215. ></image>
  216. </view>
  217. </view>
  218. </view>
  219. </view>
  220. <view v-if="bank.ques">
  221. <view
  222. v-for="(item, index) in judge"
  223. :key="index"
  224. class="lisSty"
  225. @click="judgeSelect(index, bankIndex)"
  226. >
  227. <text
  228. :class="{
  229. right:
  230. bankType == 1 &&
  231. (index == (bank.ques == 1 ? 0 : 1) ||
  232. index != bank.ans),
  233. wrong:
  234. bankType == 1 &&
  235. index == (bank.ques == 1 ? 0 : 1) &&
  236. bank.ques != bank.ans,
  237. user_choose:
  238. bankType == 2 && index == (bank.ques == 1 ? 0 : 1),
  239. }"
  240. class="activeTI"
  241. >
  242. {{ ast[index] }}
  243. </text>
  244. <view class="flex_auto">
  245. {{ item }}
  246. <view v-if="item.imgUrl">
  247. <image
  248. style="width: 600rpx"
  249. mode="widthFix"
  250. :src="$method.splitImgHost(item.imgUrl)"
  251. ></image>
  252. </view>
  253. </view>
  254. </view>
  255. </view>
  256. </view>
  257. <view v-if="bankType == 1 && bank.ques">
  258. <view class="pad_8 answer">
  259. <view>题目答案:{{ ast[bank.ans == 1 ? 0 : 1] }}</view>
  260. <view>我的答案:{{ ast[bank.ques == 1 ? 0 : 1] }}</view>
  261. </view>
  262. <view class="pad_8 answerInfos">
  263. <view class="answerTitle">答案解析</view>
  264. <view class="answerContent"
  265. ><rich-text :nodes="bank.analysisContent"></rich-text
  266. ></view>
  267. </view>
  268. </view>
  269. </template>
  270. <!-- 简答题 -->
  271. <template v-if="bank.type == 5">
  272. <view class="pad_8 titBox">
  273. <view class="ans">
  274. <view
  275. class="ans_input"
  276. v-if="
  277. bankType == 2 ||
  278. (bankType == 1 &&
  279. (!bank.ques ||
  280. (!bank.ques.imageList.length && !bank.ques.text)))
  281. "
  282. >
  283. <view class="top flex">
  284. <image
  285. :data-index="bankIndex"
  286. class="icon"
  287. @click="chooseImg(bankIndex)"
  288. src="/static/camera.png"
  289. mode=""
  290. ></image>
  291. <view class="progress"
  292. >{{ bank.ansText.imageList.length || "0" }}/4</view
  293. >
  294. <view
  295. class="submit"
  296. :class="{ disabled: !bank.ansText.text && hasImgs(bank) }"
  297. @click="submitAns(bankIndex)"
  298. >确认答案</view
  299. >
  300. </view>
  301. <view class="textarea">
  302. <textarea
  303. v-model="bank.ansText.text"
  304. placeholder="在此输入答案"
  305. ></textarea>
  306. </view>
  307. <view class="imgs">
  308. <view
  309. class="img"
  310. v-for="(img, imgIndex) in bank.ansText.imageList"
  311. :key="imgIndex"
  312. >
  313. <text @click="deleteImg(imgIndex, bankIndex)">x</text>
  314. <image :src="$method.splitImgHost(img, true)"></image>
  315. </view>
  316. </view>
  317. </view>
  318. <view
  319. class="ans_submit answerInfos"
  320. v-if="
  321. bankType == 1 &&
  322. bank.ques &&
  323. (bank.ques.imageList.length || bank.ques.text)
  324. "
  325. >
  326. <view class="answerTitle">我的答案:</view>
  327. {{ bank.ques.text }}
  328. <view class="imgs"
  329. ><image
  330. class="img"
  331. :key="quesIndex"
  332. v-for="(ques, quesIndex) in bank.ques.imageList"
  333. :src="$method.splitImgHost(ques, true)"
  334. ></image
  335. ></view>
  336. </view>
  337. </view>
  338. </view>
  339. <view
  340. v-if="
  341. bankType == 1 &&
  342. bank.ques &&
  343. (bank.ques.imageList.length || bank.ques.text)
  344. "
  345. >
  346. <view class="pad_8 answerInfos">
  347. <view class="answerTitle">答案解析:</view>
  348. <view class="answerContent"
  349. ><rich-text :nodes="bank.analysisContent"></rich-text
  350. ></view>
  351. </view>
  352. </view>
  353. </template>
  354. <!-- 案例题 -->
  355. <template v-if="bank.type == 4">
  356. <view class="tabs">
  357. <view
  358. class="tab"
  359. :class="{ current: tabIndex == bank.current }"
  360. :key="tabIndex"
  361. v-for="(tab, tabIndex) in bank.jsonStr"
  362. @click="tabSelect(tabIndex, bankIndex)"
  363. >
  364. 问题{{ tabIndex + 1 }}
  365. </view>
  366. </view>
  367. <view
  368. v-for="(ansItem, ansIndex) in bank.jsonStr"
  369. v-if="bank.current == ansIndex"
  370. :key="ansIndex"
  371. >
  372. <template v-if="ansItem.type == 1">
  373. <view class="pad_8 titBox">
  374. <view class="leftLetters">
  375. <view class="btnType">
  376. <text>单选</text>
  377. </view>
  378. </view>
  379. <view class="titles"
  380. ><rich-text :nodes="ansItem.content"></rich-text
  381. ></view>
  382. <view v-if="!bank.ques[ansIndex]">
  383. <view
  384. v-for="(option, childIndex) in ansItem.optionsList"
  385. :key="childIndex"
  386. class="lisSty"
  387. @click="
  388. radioSelectChild(option.optionsId, ansIndex, bankIndex)
  389. "
  390. >
  391. <view class="activeTI">{{ ast[childIndex] }}</view>
  392. <view class="flex_auto">
  393. <rich-text
  394. class="textChild"
  395. :nodes="option.content"
  396. ></rich-text>
  397. <view v-if="option.imgUrl">
  398. <image
  399. style="width: 600rpx"
  400. mode="widthFix"
  401. :src="$method.splitImgHost(option.imgUrl)"
  402. ></image>
  403. </view>
  404. </view>
  405. </view>
  406. </view>
  407. <view v-if="bank.ques[ansIndex]">
  408. <view
  409. v-for="(option, childIndex) in ansItem.optionsList"
  410. :key="childIndex"
  411. class="lisSty"
  412. @click="
  413. radioSelectChild(option.optionsId, ansIndex, bankIndex)
  414. "
  415. >
  416. <text
  417. :class="{
  418. right:
  419. bankType == 1 &&
  420. (option.optionsId == bank.ques[ansIndex] ||
  421. option.optionsId == bank.ans[ansIndex]),
  422. wrong:
  423. bankType == 1 &&
  424. option.optionsId == bank.ques[ansIndex] &&
  425. bank.ques[ansIndex] != bank.ans[ansIndex],
  426. user_choose:
  427. bankType == 2 &&
  428. option.optionsId == bank.ques[ansIndex],
  429. }"
  430. class="activeTI"
  431. >
  432. {{ ast[childIndex] }}
  433. </text>
  434. <view class="flex_auto">
  435. <rich-text :nodes="option.content"></rich-text>
  436. <view v-if="option.imgUrl">
  437. <image
  438. style="width: 600rpx"
  439. mode="widthFix"
  440. :src="$method.splitImgHost(option.imgUrl)"
  441. ></image>
  442. </view>
  443. </view>
  444. </view>
  445. </view>
  446. </view>
  447. <view v-if="bankType == 1 && bank.ques[ansIndex]">
  448. <view class="pad_8 answer">
  449. <view>题目答案:{{ ast[bank.ans[ansIndex] - 1] }}</view>
  450. <view>我的答案:{{ ast[bank.ques[ansIndex] - 1] }}</view>
  451. </view>
  452. <view class="pad_8 answerInfos">
  453. <view class="answerTitle">答案解析</view>
  454. <view class="answerContent"
  455. ><rich-text :nodes="option.analysisContent"></rich-text
  456. ></view>
  457. </view>
  458. </view>
  459. </template>
  460. <template v-if="ansItem.type == 2">
  461. <view class="pad_8 titBox">
  462. <view class="leftLetters">
  463. <view class="btnType">
  464. <text>多选</text>
  465. </view>
  466. </view>
  467. <view class="titles"
  468. ><rich-text :nodes="ansItem.content"></rich-text
  469. ></view>
  470. <view v-if="!bank.ques[ansIndex]">
  471. <view
  472. v-for="(option, childindex) in ansItem.optionsList"
  473. :key="childindex"
  474. class="lisSty"
  475. @click="
  476. checkboxSelectChild(bankIndex, ansIndex, childindex)
  477. "
  478. >
  479. <view
  480. :class="{ checked: option.checked }"
  481. class="activeTI"
  482. >{{ ast[childindex] }}</view
  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. v-if="
  498. bankType == 2 || (bankType == 1 && !bank.ques[ansIndex])
  499. "
  500. class="submit_checkbox"
  501. :class="{
  502. disabled: !isCheckboxChecked(ansItem.optionsList),
  503. }"
  504. @click="checkboxSubmitChild(bankIndex, ansIndex)"
  505. >确认答案</view
  506. >
  507. <view v-if="bank.ques && bank.ques[ansIndex]">
  508. <view
  509. v-for="(option, childindex) in ansItem.optionsList"
  510. :key="childindex"
  511. class="lisSty"
  512. @click="
  513. checkboxSelectChild(bankIndex, ansIndex, childindex)
  514. "
  515. >
  516. <text
  517. :class="{
  518. right:
  519. bankType == 1 && right(bankIndex, ansIndex, option),
  520. wrong:
  521. bankType == 1 && wrong(bankIndex, ansIndex, option),
  522. user_choose: bankType == 2 && option.checked,
  523. }"
  524. class="activeTI"
  525. >
  526. {{ ast[childindex] }}
  527. </text>
  528. <view class="flex_auto">
  529. <rich-text :nodes="option.content"></rich-text>
  530. <view v-if="option.imgUrl">
  531. <image
  532. style="width: 600rpx"
  533. mode="widthFix"
  534. :src="$method.splitImgHost(option.imgUrl)"
  535. ></image>
  536. </view>
  537. </view>
  538. </view>
  539. </view>
  540. </view>
  541. <view v-if="bankType == 1 && bank.ques[ansIndex]">
  542. <view class="pad_8 answer">
  543. <view>
  544. 题目答案:
  545. <text
  546. :key="ansItemIndex1"
  547. v-for="(ansItem1, ansItemIndex1) in bank.ans[ansIndex]"
  548. >{{ ast[ansItem1 - 1] }}</text
  549. >
  550. </view>
  551. <view>
  552. 我的答案:
  553. <text
  554. :key="quesItemIndex"
  555. v-for="(quesItem, quesItemIndex) in bank.ques[ansIndex]"
  556. >{{ ast[quesItem - 1] }}</text
  557. >
  558. </view>
  559. </view>
  560. <view class="pad_8 answerInfos">
  561. <view class="answerTitle">答案解析</view>
  562. <view class="answerContent"
  563. ><rich-text :nodes="ansItem.analysisContent"></rich-text
  564. ></view>
  565. </view>
  566. </view>
  567. </template>
  568. <template v-if="ansItem.type == 3">
  569. <view class="pad_8 titBox">
  570. <view class="leftLetters">
  571. <view class="btnType">
  572. <text>判断</text>
  573. </view>
  574. </view>
  575. <view class="titles"
  576. ><rich-text :nodes="ansItem.content"></rich-text
  577. ></view>
  578. <view v-if="!bank.ques[ansIndex]">
  579. <view
  580. v-for="(option, childindex) in judge"
  581. :key="childindex"
  582. class="lisSty"
  583. @click="judgeSelectChild(ansIndex, childindex, bankIndex)"
  584. >
  585. <view class="activeTI">{{ ast[childindex] }}</view>
  586. <view class="flex_auto">
  587. {{ option }}
  588. <view v-if="option.imgUrl">
  589. <image
  590. style="width: 600rpx"
  591. mode="widthFix"
  592. :src="$method.splitImgHost(option.imgUrl)"
  593. ></image>
  594. </view>
  595. </view>
  596. </view>
  597. </view>
  598. <view v-if="bank.ques[ansIndex]">
  599. <view
  600. v-for="(option, childindex) in judge"
  601. :key="childindex"
  602. class="lisSty"
  603. @click="judgeSelectChild(ansIndex, childindex, bankIndex)"
  604. >
  605. <text
  606. :class="{
  607. right:
  608. bankType == 1 &&
  609. (childindex == (bank.ques[ansIndex] == 1 ? 0 : 1) ||
  610. childindex != bank.ans[ansIndex]),
  611. wrong:
  612. bankType == 1 &&
  613. childindex == (bank.ques[ansIndex] == 1 ? 0 : 1) &&
  614. bank.ques[ansIndex] != bank.ans[ansIndex],
  615. user_choose:
  616. bankType == 2 &&
  617. childindex == (bank.ques[ansIndex] == 1 ? 0 : 1),
  618. }"
  619. class="activeTI"
  620. >
  621. {{ ast[childindex] }}
  622. </text>
  623. <view class="flex_auto">
  624. {{ option }}
  625. <view v-if="option.imgUrl">
  626. <image
  627. style="width: 600rpx"
  628. mode="widthFix"
  629. :src="$method.splitImgHost(option.imgUrl)"
  630. ></image>
  631. </view>
  632. </view>
  633. </view>
  634. </view>
  635. </view>
  636. <view v-if="bankType == 1 && bank.ques[ansIndex]">
  637. <view class="pad_8 answer">
  638. <view
  639. >题目答案:{{
  640. ast[bank.ans[ansIndex] == 1 ? 0 : 1]
  641. }}</view
  642. >
  643. <view
  644. >我的答案:{{
  645. ast[bank.ques[ansIndex] == 1 ? 0 : 1]
  646. }}</view
  647. >
  648. </view>
  649. <view class="pad_8 answerInfos">
  650. <view class="answerTitle">答案解析</view>
  651. <view class="answerContent"
  652. ><rich-text :nodes="ansItem.analysisContent"></rich-text
  653. ></view>
  654. </view>
  655. </view>
  656. </template>
  657. <!-- 简答题 -->
  658. <template v-if="ansItem.type == 5">
  659. <view class="pad_8 titBox_title">
  660. <view class="leftLetters">
  661. <view class="btnType">
  662. <text>简答</text>
  663. </view>
  664. </view>
  665. <view><rich-text :nodes="ansItem.content"></rich-text></view>
  666. </view>
  667. <view class="pad_8 titBox_title">
  668. <view class="ans">
  669. <view
  670. class="ans_input"
  671. v-if="
  672. bankType == 2 ||
  673. (bankType == 1 &&
  674. (!bank.ques[ansIndex] ||
  675. (!bank.ques[ansIndex].text &&
  676. !bank.ques[ansIndex].imageList.length)))
  677. "
  678. >
  679. <view class="top flex">
  680. <image
  681. class="icon"
  682. @click="chooseImgChild(bankIndex, ansIndex)"
  683. src="/static/camera.png"
  684. mode=""
  685. ></image>
  686. <view class="progress"
  687. >{{ ansItem.ansText.imageList.length || "0" }}/4</view
  688. >
  689. <view
  690. class="submit"
  691. :class="{
  692. disabled: !ansItem.ansText.text && hasImgs(ansItem),
  693. }"
  694. @click="submitAnsChild(bankIndex, ansIndex)"
  695. >确认答案</view
  696. >
  697. </view>
  698. <view class="textarea">
  699. <textarea
  700. v-model="ansItem.ansText.text"
  701. placeholder="在此输入答案"
  702. ></textarea>
  703. </view>
  704. <view class="imgs">
  705. <view
  706. class="img"
  707. v-for="(img, imgIndex) in ansItem.ansText.imageList"
  708. :key="imgIndex"
  709. >
  710. <text
  711. @click="
  712. deleteImgChild(imgIndex, bankIndex, ansIndex)
  713. "
  714. >x</text
  715. >
  716. <image :src="$method.splitImgHost(img, true)"></image>
  717. </view>
  718. </view>
  719. </view>
  720. <view
  721. class="ans_submit answerInfos"
  722. v-if="
  723. bankType == 1 &&
  724. bank.ques[ansIndex] &&
  725. (bank.ques[ansIndex].imageList.length ||
  726. bank.ques[ansIndex].text)
  727. "
  728. >
  729. <view class="answerTitle">我的答案</view>
  730. {{ bank.ques[ansIndex].text || "" }}
  731. <view class="imgs">
  732. <image
  733. class="img"
  734. v-for="(ques, quesIndex) in bank.ques[ansIndex]
  735. .imageList"
  736. :key="quesIndex"
  737. :src="$method.splitImgHost(ques, true)"
  738. ></image>
  739. </view>
  740. </view>
  741. </view>
  742. </view>
  743. <view
  744. v-if="
  745. bankType == 1 &&
  746. (bank.ques[ansIndex].imageList.length ||
  747. bank.ques[ansIndex].text)
  748. "
  749. >
  750. <view class="pad_8 answerInfos">
  751. <view class="answerTitle">答案解析</view>
  752. <view class="answerContent"
  753. ><rich-text :nodes="ansItem.analysisContent"></rich-text
  754. ></view>
  755. </view>
  756. </view>
  757. </template>
  758. </view>
  759. </template>
  760. <view class="footer_btn">
  761. <view class="collect"> </view>
  762. <view class="flex_center" @click="openFooterTab">
  763. <view class="up-icon">
  764. <image src="/static/up.png"></image>
  765. </view>
  766. 答题卡
  767. </view>
  768. <view class="collect show" @click="pdsubmit">
  769. <view>
  770. <image src="/static/jj.png" mode=""></image>
  771. <view>交卷</view>
  772. </view>
  773. </view>
  774. </view>
  775. </view>
  776. </swiper-item>
  777. </swiper>
  778. <u-popup v-model="show" mode="bottom" border-radius="14" height="680rpx">
  779. <view class="popupView">
  780. <view class="popupTops">
  781. <view class="topIcon"></view>
  782. 点击编号即可跳转至对应题目
  783. </view>
  784. <view class="popupContent">
  785. <scroll-view scroll-y="true" style="height: 506rpx">
  786. <view class="boxSty">
  787. <view
  788. v-for="(item, index) in questionList"
  789. :key="index"
  790. @click="changeIndex(index)"
  791. :class="{
  792. isRight: bankType == 1 && isRight(item, index),
  793. isWrong: bankType == 1 && isWrong(item, index),
  794. isPart: bankType == 1 && isPart(item, index),
  795. isOver: bankType == 1 && isOver(item, index),
  796. check_ans: bankType == 2 && isCheck(item, index),
  797. }"
  798. class="liListSty"
  799. >
  800. {{ index + 1 }}
  801. </view>
  802. </view>
  803. </scroll-view>
  804. </view>
  805. </view>
  806. </u-popup>
  807. <view class="dialog" v-if="showDialog">
  808. <image class="pointer" src="/static/pointer.png" mode=""></image>
  809. <view class="text">左右滑动切换上下题</view>
  810. <view class="btn" @click="showDialog = false">我知道了</view>
  811. </view>
  812. <view class="dialog-arrow" v-if="showArrow">
  813. <image class="pointer" src="/static/arrow-left.png" mode=""></image>
  814. <view class="text">您当前正在测试, 若想退出请点击左上角返回按钮。</view>
  815. <view class="btn" @click="showArrow = false">我知道了</view>
  816. </view>
  817. <view class="dialog_wrap" v-if="testOver">
  818. <view class="bg"></view>
  819. <view class="dialog">
  820. <view class="title">温馨提示</view>
  821. <view class="content">
  822. <view>您已完成所有题目,</view>
  823. <view>快去交卷吧!</view>
  824. </view>
  825. <view class="btns">
  826. <view class="btn" @click="noSubmit()">暂不交卷</view>
  827. <view class="btn active" @click="submitNow()">立即交卷</view>
  828. </view>
  829. </view>
  830. </view>
  831. <view class="dialog_wrap" v-if="isLastCount">
  832. <view class="bg"></view>
  833. <view class="dialog">
  834. <view class="title">温馨提示</view>
  835. <view class="content">
  836. <view
  837. >您当前正在测试,还剩{{ lastCount }}道题未完成,离开视为交卷</view
  838. >
  839. </view>
  840. <view class="btns">
  841. <view class="btn" @click="noLeave()">暂不离开</view>
  842. <view class="btn active" @click="leaveNow()">继续离开</view>
  843. </view>
  844. </view>
  845. </view>
  846. <u-popup
  847. v-model="showpopups"
  848. mode="center"
  849. border-radius="24"
  850. height="439rpx"
  851. width="640rpx"
  852. :mask-close-able="false"
  853. >
  854. <view class="popboxs">
  855. <view class="classTops">温馨提示</view>
  856. <view class="textStys">
  857. {{
  858. cgType === 7
  859. ? "您还未交卷,确定结束做题吗?"
  860. : cgType === 8
  861. ? `您还有${lastCount}道题未作答, 现在继续作答,还是下次继续?`
  862. : cgType === 6
  863. ? `您还有${lastCount}道题未作答, 您确定要交卷吗?`
  864. : cgType == 9
  865. ? `您已完成所有题目,快去交卷吧!`
  866. : ""
  867. }}
  868. </view>
  869. <view class="classFootsty" v-if="cgType === 6">
  870. <view class="btnsty btns1" @click="submit">立即交卷</view>
  871. <view class="btnsty btns2" @click="showpopups = false">继续做题</view>
  872. </view>
  873. <view class="classFootsty" v-if="cgType === 7">
  874. <view class="btnsty btns1" @click="backPages">下次继续</view>
  875. <view class="btnsty btns2" @click="submit">结束做题</view>
  876. </view>
  877. <view class="classFootsty" v-if="cgType === 8">
  878. <view class="btnsty btns1" @click="backPages()">下次继续</view>
  879. <view class="btnsty btns2" @click="showpopups = false">继续作答</view>
  880. </view>
  881. <view class="classFootsty" v-if="cgType === 9">
  882. <view class="btnsty btns1" @click="showpopups = false">暂不交卷</view>
  883. <view class="btnsty btns2" @click="submit">立即交卷</view>
  884. </view>
  885. </view>
  886. </u-popup>
  887. </view>
  888. </template>
  889. <script>
  890. import { mapGetters, mapActions } from "vuex";
  891. export default {
  892. computed: {
  893. ...mapGetters(["sysTime"]),
  894. },
  895. data() {
  896. return {
  897. subscribeId: 0,
  898. showpopups: false,
  899. examId: "",
  900. current: 0,
  901. questionList: [],
  902. ast: ["A", "B", "C", "D", "E", "F", "G"],
  903. judge: ["正确", "错误"],
  904. ans: [],
  905. ques: [],
  906. show: false,
  907. showDialog: false,
  908. bankList: [],
  909. collectList: [],
  910. recordId: "",
  911. isSubmit: false,
  912. lastTime: 0, //剩余考试时长
  913. allTimes: 0, //总考试时长
  914. timer: null,
  915. wrongList: [],
  916. bankType: 2, //试卷类型
  917. needBack: false, //是否是考试
  918. testOver: false,
  919. isLastCount: false, //是否有未答题目
  920. lastCount: 0, //剩余没有回答的题目数
  921. showArrow: false, //退出提示
  922. gradeId: "",
  923. examData: {},
  924. eachExamId: 0,
  925. normal: "",
  926. isAutoSubmit: false,
  927. cgType: 0, //对应设计稿弹窗编码
  928. examStartTime: 0,
  929. examEndTime: 0,
  930. simulateExamId: undefined,
  931. goodsId: undefined,
  932. orderGoodsId: undefined,
  933. };
  934. },
  935. async onLoad(option) {
  936. console.log(option);
  937. this.examStartTime = option.examStartTime;
  938. this.examEndTime = option.examEndTime;
  939. this.subscribeId = option.subscribeId || "";
  940. this.current = +option.current || 0;
  941. this.eachExamId = option.eachExamId;
  942. this.examId = option.examId;
  943. this.allTimes = this.examEndTime - this.examStartTime || "";
  944. this.goodsId = option.goodsId;
  945. this.orderGoodsId = option.orderGoodsId;
  946. let isBack = option.isback;
  947. let showDialog = uni.getStorageSync("showDialog");
  948. if (showDialog) {
  949. this.showDialog = false;
  950. } else {
  951. this.showDialog = true;
  952. uni.setStorageSync("showDialog", "1");
  953. }
  954. //考试被迫返回
  955. if (isBack) {
  956. let app = getApp();
  957. let globalData = app.globalData;
  958. for (var k in globalData.bankData) {
  959. this[k] = globalData.bankData[k];
  960. }
  961. this.showArrow = true;
  962. this.timer = setInterval(() => {
  963. if (this.lastTime <= 0) {
  964. clearInterval(this.timer);
  965. uni.showToast({
  966. icon: "none",
  967. mask: true,
  968. title: "考试时间已到,系统将自动交卷",
  969. duration: 10000,
  970. });
  971. this.isAutoSubmit = true;
  972. this.submit();
  973. return;
  974. }
  975. this.lastTime--;
  976. }, 1000);
  977. } else {
  978. //进入页面
  979. await this.bankExam();
  980. await this.setSystemTime();
  981. this.goodsQuestionList();
  982. }
  983. },
  984. onUnload() {
  985. if (this.isSubmit) {
  986. clearInterval(this.timer);
  987. return;
  988. }
  989. //考试试卷 阻止ios手势返回,自动跳回答题页
  990. if (this.needBack) {
  991. let app = getApp();
  992. app.globalData.bankData = this.$data;
  993. clearInterval(this.timer);
  994. uni.navigateTo({
  995. url:
  996. "/pages2/bank/questionBank?examId=" +
  997. this.examId +
  998. "&eachExamId=" +
  999. this.eachExamId +
  1000. "&isback=true" +
  1001. "&subscribeId=" +
  1002. this.subscribeId +
  1003. "&examStartTime=" +
  1004. this.examStartTime +
  1005. "&examEndTime=" +
  1006. this.examEndTime,
  1007. });
  1008. } else {
  1009. //点击返回按钮确认允许退出,记录答题记录
  1010. clearInterval(this.timer);
  1011. this.mockRecordEdit();
  1012. }
  1013. },
  1014. methods: {
  1015. ...mapActions(["setSystemTime"]),
  1016. /**
  1017. * 是否有上传图片
  1018. */
  1019. hasImgs(bank) {
  1020. return bank.ansText.imageList.length == 0;
  1021. },
  1022. /**
  1023. * 获取试卷类型2考试,1练习
  1024. */
  1025. bankExam() {
  1026. return new Promise((resolve) => {
  1027. this.$api.bankExam(this.examId).then((res) => {
  1028. this.bankType = res.data.data.doType;
  1029. this.examData = res.data.data;
  1030. if (this.bankType == 2) {
  1031. this.needBack = true;
  1032. }
  1033. resolve();
  1034. });
  1035. });
  1036. },
  1037. /**
  1038. * 点击后退按钮
  1039. */
  1040. clickLeft() {
  1041. if (this.bankType == 1) {
  1042. let ansCount = this.questionOverNum(true); //已答题数
  1043. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  1044. //所有题目答完
  1045. if (this.lastCount == 0) {
  1046. // this.testOver = true;
  1047. this.cgType = 7;
  1048. //未答完
  1049. } else {
  1050. this.cgType = 8;
  1051. // this.isLastCount = true;
  1052. }
  1053. this.showpopups = true;
  1054. } else if (this.bankType == 2) {
  1055. let ansCount = this.questionOverNum(true); //已答题数
  1056. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  1057. //所有题目答完
  1058. if (this.lastCount == 0) {
  1059. this.testOver = true;
  1060. //未答完
  1061. } else {
  1062. this.isLastCount = true;
  1063. }
  1064. }
  1065. },
  1066. /**
  1067. * 返回上一页
  1068. */
  1069. backPages() {
  1070. this.needBack = false;
  1071. uni.navigateBack({
  1072. delta: 1,
  1073. });
  1074. },
  1075. /**
  1076. * 获取已经回答的题目数
  1077. * hasSpecail (是否包含简答和案例)
  1078. */
  1079. questionOverNum(hasSpecail) {
  1080. let count = 0;
  1081. this.questionList.forEach((item) => {
  1082. if (item.type == 1 || item.type == 2 || item.type == 3) {
  1083. if (item.ques) {
  1084. count++;
  1085. }
  1086. } else if (item.type == 4) {
  1087. //案例题
  1088. if (hasSpecail) {
  1089. let isOver = item.jsonStr.every((jsonItem, indexs) => {
  1090. if (
  1091. jsonItem.type == 1 ||
  1092. jsonItem.type == 2 ||
  1093. jsonItem.type == 3
  1094. ) {
  1095. if (item.ques[indexs]) {
  1096. return true;
  1097. } else {
  1098. return false;
  1099. }
  1100. } else if (jsonItem.type == 5) {
  1101. if (
  1102. item.ques[indexs] &&
  1103. (item.ques[indexs].text || item.ques[indexs].imageList.length)
  1104. ) {
  1105. console.log("chil");
  1106. return true;
  1107. } else {
  1108. return false;
  1109. }
  1110. }
  1111. });
  1112. if (isOver) {
  1113. count++;
  1114. console.log(item, 444);
  1115. }
  1116. }
  1117. } else if (item.type == 5) {
  1118. //简答题
  1119. if (hasSpecail) {
  1120. if (item.ques && (item.ques.text || item.ques.imageList.length)) {
  1121. console.log(5, item);
  1122. count++;
  1123. }
  1124. }
  1125. }
  1126. });
  1127. return count;
  1128. },
  1129. mockSubscribeEdit() {
  1130. this.$api
  1131. .mockSubscribeEdit({
  1132. subscribeId: this.subscribeId,
  1133. handStatus: this.isAutoSubmit ? 2 : 1,
  1134. })
  1135. .then((res) => {});
  1136. },
  1137. /**
  1138. * 是否做完所有题目
  1139. */
  1140. isDoOver() {
  1141. let questionOverNum = this.questionOverNum(true); //获取已经回答的题目数(包括简答和案例)
  1142. if (this.questionList.length == questionOverNum) {
  1143. //全部做完弹窗
  1144. this.cgType = 9;
  1145. this.showpopups = true;
  1146. }
  1147. },
  1148. /**
  1149. * 暂不交卷
  1150. */
  1151. noSubmit() {
  1152. //设为允许退出页面
  1153. this.needBack = false;
  1154. uni.navigateBack({
  1155. delta: 1,
  1156. });
  1157. },
  1158. /**
  1159. * 不离开
  1160. */
  1161. noLeave() {
  1162. this.isLastCount = false;
  1163. },
  1164. /**
  1165. * 立即离开并交卷
  1166. */
  1167. leaveNow() {
  1168. this.needBack = false;
  1169. this.isSubmit = true;
  1170. this.submit(false);
  1171. uni.navigateBack({
  1172. delta: 1,
  1173. });
  1174. },
  1175. /**
  1176. * 立即交卷
  1177. */
  1178. submitNow() {
  1179. console.log("sds");
  1180. this.showpopups = false;
  1181. this.needBack = false;
  1182. this.submit();
  1183. },
  1184. /**
  1185. * 离开页面统计回答正确题数
  1186. */
  1187. mockRecordEdit() {
  1188. if (!this.isSubmit) {
  1189. if (this.subscribeId) {
  1190. this.mockSubscribeEdit();
  1191. }
  1192. let {
  1193. doQuestionNum,
  1194. doQuestionIds,
  1195. rightQuestionNum,
  1196. historyExamJson,
  1197. } = this.$method.calculateScore(this.questionList);
  1198. this.$api
  1199. .mockRecordEdit({
  1200. examId: this.examId,
  1201. eachExamId: this.eachExamId,
  1202. goodsId: this.goodsId,
  1203. recordId: this.recordId,
  1204. doQuestionIds,
  1205. rightQuestionNum,
  1206. status: 1,
  1207. doQuestionNum,
  1208. historyExamJson,
  1209. })
  1210. .then((res) => {});
  1211. }
  1212. },
  1213. /**
  1214. * 记录总题数
  1215. * hasSpecial (是否包含简答和案例) true 包含 false 不包含
  1216. */
  1217. mockRecord(hasSpecial) {
  1218. let questionList = 0;
  1219. // if(!hasSpecial) {
  1220. this.questionList.forEach((item, index) => {
  1221. if (item.type == 1 || item.type == 2 || item.type == 3) {
  1222. questionList++;
  1223. }
  1224. });
  1225. // } else {
  1226. // questionList = this.questionList.length;
  1227. // }
  1228. this.$api
  1229. .mockRecord({
  1230. examId: this.examId,
  1231. eachExamId: this.eachExamId,
  1232. totalQuestionNum: questionList,
  1233. allQuestionNum: this.questionList.length,
  1234. doMode: this.doMode,
  1235. simulateExamId: this.simulateExamId,
  1236. })
  1237. .then((res) => {
  1238. this.recordId = res.data.data;
  1239. //获取recordId 初始化先提交题目 以防突然下次继续做题退出报错
  1240. });
  1241. },
  1242. /**
  1243. * @param {Object} second倒计时过滤器
  1244. */
  1245. countdown(second) {
  1246. if (second) {
  1247. let h = parseInt((second / 60 / 60) % 24); // 计算小时
  1248. let m = parseInt((second / 60) % 60); // 计算分数
  1249. let s = parseInt(second % 60); // 计算当前秒数
  1250. if (h < 10) h = "0" + h;
  1251. if (m < 10) m = "0" + m;
  1252. if (s < 10) s = "0" + s;
  1253. return h + ":" + m + ":" + s;
  1254. } else {
  1255. return "";
  1256. }
  1257. },
  1258. hideDialog() {
  1259. this.showDialog = false;
  1260. },
  1261. noListTip(content = "该试卷暂无题目") {
  1262. this.hideDialog();
  1263. uni.showModal({
  1264. showCancel: false,
  1265. content,
  1266. success: (k) => {
  1267. if (k.confirm) {
  1268. this.isSubmit = true;
  1269. uni.navigateBack();
  1270. }
  1271. },
  1272. });
  1273. },
  1274. /**
  1275. * 请求题目列表
  1276. */
  1277. goodsQuestionList() {
  1278. // app/common/bank/question/list
  1279. this.$api[
  1280. this.doMode == 3 ? "goodsRandomQuestionList" : "goodsQuestionList"
  1281. ]({
  1282. examId: this.examId,
  1283. goodsId: this.goodsId,
  1284. orderGoodsId: this.orderGoodsId,
  1285. from: 3,
  1286. }).then((res) => {
  1287. if (res.data.code == 500) {
  1288. return this.noListTip("你已完成所有题目");
  1289. }
  1290. let data = res.data.data;
  1291. if (this.doMode == 3) {
  1292. this.simulateExamId = data.simulateExamId;
  1293. data = data.questionList;
  1294. }
  1295. if (!data.length) {
  1296. return this.noListTip();
  1297. }
  1298. if (this.subscribeId) {
  1299. this.lastTime = this.examEndTime - this.sysTime;
  1300. //考试时间到了自动交卷
  1301. if (this.lastTime) {
  1302. this.timer = setInterval(() => {
  1303. if (this.lastTime <= 0) {
  1304. clearInterval(this.timer);
  1305. uni.showToast({
  1306. icon: "none",
  1307. mask: true,
  1308. title: "考试时间已到,系统将自动交卷",
  1309. duration: 5000,
  1310. });
  1311. this.isAutoSubmit = true;
  1312. this.submit();
  1313. return;
  1314. }
  1315. this.lastTime--;
  1316. }, 1000);
  1317. } else {
  1318. }
  1319. }
  1320. data.forEach((item, index) => {
  1321. // if (typeof item.jsonStr == 'string') {
  1322. item.jsonStr = JSON.parse(item.jsonStr);
  1323. if (item.type == 2) {
  1324. //多选
  1325. item.jsonStr.forEach((str) => {
  1326. str.optionsId = "" + str.optionsId;
  1327. });
  1328. let arr = item.answerQuestion.split(",");
  1329. arr.forEach((a, i) => {
  1330. arr[i] = "" + a;
  1331. });
  1332. item.ans = arr;
  1333. item.analysisContent &&
  1334. (item.analysisContent = item.analysisContent.replace(
  1335. /<img/gi,
  1336. '<img style="max-width:100%;"'
  1337. ));
  1338. item.content &&
  1339. (item.content = item.content.replace(
  1340. /<img/gi,
  1341. '<img style="max-width:100%;"'
  1342. ));
  1343. return;
  1344. } else if (item.type == 5) {
  1345. //简答题
  1346. item.ansText = {
  1347. text: "",
  1348. imageList: [],
  1349. };
  1350. item.ques = {
  1351. text: "",
  1352. imageList: [],
  1353. };
  1354. item.analysisContent &&
  1355. (item.analysisContent = item.analysisContent.replace(
  1356. /<img/gi,
  1357. '<img style="max-width:100%;"'
  1358. ));
  1359. item.content &&
  1360. (item.content = item.content.replace(
  1361. /<img/gi,
  1362. '<img style="max-width:100%;"'
  1363. ));
  1364. } else if (item.type == 4) {
  1365. //案例题
  1366. item.ques = [];
  1367. item.current = 0;
  1368. let ansArr = [];
  1369. item.jsonStr.forEach((json, index) => {
  1370. if (json.type == 1) {
  1371. ansArr[index] = json.answerQuestion;
  1372. json.content &&
  1373. (json.content = json.content.replace(
  1374. /<img/gi,
  1375. '<img style="max-width:100%;"'
  1376. ));
  1377. } else if (json.type == 2) {
  1378. json.optionsList.forEach((str) => {
  1379. str.optionsId = "" + str.optionsId;
  1380. });
  1381. let arr = json.answerQuestion.split(",");
  1382. arr.forEach((a, i) => {
  1383. arr[i] = "" + a;
  1384. });
  1385. ansArr[index] = arr;
  1386. json.content &&
  1387. (json.content = json.content.replace(
  1388. /<img/gi,
  1389. '<img style="max-width:100%;"'
  1390. ));
  1391. } else if (json.type == 3) {
  1392. ansArr[index] = json.answerQuestion;
  1393. json.content &&
  1394. (json.content = json.content.replace(
  1395. /<img/gi,
  1396. '<img style="max-width:100%;"'
  1397. ));
  1398. } else if (json.type == 5) {
  1399. ansArr[index] = {
  1400. text: json.answerQuestion,
  1401. imageList: [],
  1402. };
  1403. json.ansText = {
  1404. text: "",
  1405. imageList: [],
  1406. };
  1407. json.content &&
  1408. (json.content = json.content.replace(
  1409. /<img/gi,
  1410. '<img style="max-width:100%;"'
  1411. ));
  1412. }
  1413. });
  1414. item.analysisContent &&
  1415. (item.analysisContent = item.analysisContent.replace(
  1416. /<img/gi,
  1417. '<img style="max-width:100%;"'
  1418. ));
  1419. item.content &&
  1420. (item.content = item.content.replace(
  1421. /<img/gi,
  1422. '<img style="max-width:100%;"'
  1423. ));
  1424. item.ans = ansArr;
  1425. return;
  1426. }
  1427. item.analysisContent &&
  1428. (item.analysisContent = item.analysisContent.replace(
  1429. /<img/gi,
  1430. '<img style="max-width:100%;"'
  1431. ));
  1432. item.content &&
  1433. (item.content = item.content.replace(
  1434. /<img/gi,
  1435. '<img style="max-width:100%;"'
  1436. ));
  1437. item.ans = item.answerQuestion;
  1438. // }
  1439. });
  1440. this.questionList = data;
  1441. this.lastCount = this.questionList.length;
  1442. this.mockRecord();
  1443. });
  1444. },
  1445. /**
  1446. * @param {Object} e单选点击
  1447. */
  1448. radioSelect(optionsId, bindex) {
  1449. // if (this.questionList[bindex].ques) return;
  1450. // 类型为考试的可以重新在选择答案
  1451. if (this.questionList[bindex].ques && this.bankType == 1) {
  1452. return;
  1453. }
  1454. this.$set(this.questionList[bindex], "ques", optionsId);
  1455. // if ((bindex + 1) < this.questionList.length) {
  1456. // this.current = bindex + 1
  1457. // }
  1458. console.log("改变后:", this.questionList[bindex].ques);
  1459. this.isDoOver();
  1460. },
  1461. /**
  1462. * @param {Object} e案例单选点击
  1463. */
  1464. radioSelectChild(optionsId, ansIndex, bindex) {
  1465. // if (this.questionList[bindex].ques[ansIndex]) return;
  1466. if (this.questionList[bindex].ques[ansIndex] && this.bankType == 1) {
  1467. return;
  1468. }
  1469. this.$set(this.questionList[bindex].ques, ansIndex, optionsId);
  1470. this.isDoOver();
  1471. },
  1472. /**
  1473. * @param {Object} 多选点击
  1474. */
  1475. checkboxSelect(optionsId, bindex, index) {
  1476. if (this.questionList[bindex].ques && this.bankType == 1) {
  1477. return;
  1478. }
  1479. this.$set(
  1480. this.questionList[bindex].jsonStr[index],
  1481. "checked",
  1482. !this.questionList[bindex].jsonStr[index].checked
  1483. );
  1484. },
  1485. /**
  1486. * @param {Object} 案例多选点击
  1487. */
  1488. checkboxSelectChild(bindex, ansIndex, childIndex) {
  1489. if (this.questionList[bindex].ques[ansIndex] && this.bankType == 1) {
  1490. return;
  1491. }
  1492. this.$set(
  1493. this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex],
  1494. "checked",
  1495. !this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex]
  1496. .checked
  1497. );
  1498. },
  1499. isCheckboxChecked(arr) {
  1500. return arr.some((item) => {
  1501. if (item.checked) {
  1502. return true;
  1503. }
  1504. });
  1505. },
  1506. /**
  1507. * @param {Object} 多选确认
  1508. */
  1509. checkboxSubmit(bindex) {
  1510. // if (this.questionList[bindex].ques) return;
  1511. if (this.questionList[bindex].ques && this.bankType == 1) {
  1512. return;
  1513. }
  1514. let arr = [];
  1515. this.questionList[bindex].jsonStr.forEach((item) => {
  1516. if (item.checked) {
  1517. arr.push(item.optionsId);
  1518. }
  1519. });
  1520. if (!arr.length) {
  1521. delete this.questionList[bindex].ques;
  1522. uni.showToast({
  1523. title: "请选择答案",
  1524. icon: "none",
  1525. });
  1526. return;
  1527. }
  1528. this.$set(this.questionList[bindex], "ques", arr);
  1529. this.$u.toast("已确认答案");
  1530. this.isDoOver();
  1531. // 切换下一题
  1532. if (
  1533. this.bankType != 1 &&
  1534. this.cgType != 9 &&
  1535. bindex != this.questionList.length - 1
  1536. ) {
  1537. this.current = bindex + 1;
  1538. this.getCollectInfo(this.current);
  1539. }
  1540. },
  1541. /**
  1542. * @param {Object} 案例多选确认
  1543. */
  1544. checkboxSubmitChild(bindex, ansIndex) {
  1545. // if (this.questionList[bindex].ques[ansIndex]) return;
  1546. if (this.questionList[bindex].ques[ansIndex] && this.bankType == 1) {
  1547. return;
  1548. }
  1549. let arr = [];
  1550. this.questionList[bindex].jsonStr[ansIndex].optionsList.forEach(
  1551. (item) => {
  1552. if (item.checked) {
  1553. arr.push(item.optionsId);
  1554. }
  1555. }
  1556. );
  1557. if (!arr.length) {
  1558. delete this.questionList[bindex].ques[ansIndex];
  1559. uni.showToast({
  1560. title: "请选择答案",
  1561. icon: "none",
  1562. });
  1563. return;
  1564. }
  1565. this.$set(this.questionList[bindex].ques, ansIndex, arr);
  1566. this.$u.toast("已确认答案");
  1567. this.isDoOver();
  1568. // 切换下一题
  1569. if (
  1570. this.bankType != 1 &&
  1571. this.cgType != 9 &&
  1572. ansIndex != this.questionList[bindex].ques.length - 1
  1573. ) {
  1574. this.questionList[bindex].current += 1;
  1575. }
  1576. },
  1577. /**
  1578. * @param {Object} index
  1579. * @param {Object} bindex
  1580. * 判断题
  1581. */
  1582. judgeSelect(index, bindex) {
  1583. // if (this.questionList[bindex].ques) return;
  1584. if (this.questionList[bindex].ques && this.bankType == 1) {
  1585. return;
  1586. }
  1587. // 答案: 判断题1正确 0错误
  1588. let value = index == 0 ? "1" : "0";
  1589. // this.$set(this.questionList[bindex], "ques", index + "");
  1590. this.$set(this.questionList[bindex], "ques", value);
  1591. this.isDoOver();
  1592. },
  1593. /**
  1594. * @param {Object} ansindex
  1595. * @param {Object} childindex
  1596. * @param {Object} bindex
  1597. * 案例判断题
  1598. */
  1599. judgeSelectChild(ansindex, childindex, bindex) {
  1600. // if (this.questionList[bindex].ques[ansindex]) return;
  1601. if (this.questionList[bindex].ques[ansindex] && this.bankType == 1) {
  1602. return;
  1603. }
  1604. this.$set(
  1605. this.questionList[bindex].ques,
  1606. ansindex,
  1607. childindex == 0 ? "1" : "0"
  1608. );
  1609. this.isDoOver();
  1610. },
  1611. openFooterTab() {
  1612. this.show = true;
  1613. },
  1614. changeIndex(index) {
  1615. this.current = index;
  1616. },
  1617. swiperChange(e) {
  1618. this.current = e.detail.current;
  1619. },
  1620. pdsubmit() {
  1621. // if (this.bankType == 1) {
  1622. let ansCount = this.questionOverNum(true); //已答题数
  1623. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  1624. //没有答完
  1625. if (this.lastCount !== 0) {
  1626. this.cgType = 6;
  1627. this.showpopups = true;
  1628. return;
  1629. }
  1630. // }
  1631. if (this.bankType == 2) {
  1632. if (this.lastTime > 0) {
  1633. let lastTime = this.countdown(this.lastTime);
  1634. uni.showModal({
  1635. title: "提示",
  1636. content: `时间还剩余${lastTime},确定交卷吗?`,
  1637. confirmText: "交卷",
  1638. cancelText: "继续答题",
  1639. success: (res) => {
  1640. if (res.confirm) {
  1641. //确定
  1642. this.submit();
  1643. } else {
  1644. //取消
  1645. }
  1646. },
  1647. });
  1648. return;
  1649. }
  1650. }
  1651. this.submit();
  1652. },
  1653. /**
  1654. * 交卷
  1655. */
  1656. submit(isShowTip = true) {
  1657. let form = this.$method.calculateScore(this.questionList);
  1658. if (this.subscribeId) {
  1659. this.mockSubscribeEdit();
  1660. }
  1661. //交卷
  1662. this.$api
  1663. .mockRecordEdit({
  1664. examId: this.examId,
  1665. eachExamId: this.eachExamId,
  1666. recordId: this.recordId,
  1667. status: 1,
  1668. examTime: parseInt(this.allTimes),
  1669. doTime: parseInt(this.allTimes) - parseInt(this.lastTime),
  1670. ...form,
  1671. })
  1672. .then((res) => {
  1673. this.isSubmit = true;
  1674. if (res.data.code == 200) {
  1675. if (!isShowTip) {
  1676. return;
  1677. }
  1678. uni.showToast({
  1679. title: "交卷成功",
  1680. duration: 1000,
  1681. icon: "none",
  1682. });
  1683. setTimeout(() => {
  1684. uni.redirectTo({
  1685. url:
  1686. "/pages5/examReport/index?&examId=" +
  1687. this.examId +
  1688. "&id=" +
  1689. this.recordId +
  1690. "&eachExamId=" +
  1691. this.eachExamId +
  1692. "&subscribeId=" +
  1693. this.subscribeId +
  1694. "&doMode=" +
  1695. this.doMode,
  1696. });
  1697. }, 1000);
  1698. }
  1699. });
  1700. //错题集id提交(客观题)
  1701. if (doWrongQuestionIds.length) {
  1702. this.$api
  1703. .mockWrongRecord({
  1704. eachExamId: this.eachExamId,
  1705. examId: this.examId,
  1706. questionIds: form.questionIds,
  1707. recordId: this.recordId,
  1708. doMode: this.doMode,
  1709. })
  1710. .then((res) => {});
  1711. }
  1712. },
  1713. /**
  1714. * @param {Object} imgIndex
  1715. * @param {Object} bankIndex
  1716. * 删除简答图片
  1717. */
  1718. deleteImg(imgIndex, bankIndex) {
  1719. this.questionList[bankIndex].ansText.imageList.splice(imgIndex, 1);
  1720. },
  1721. /**
  1722. * @param {Object} imgIndex
  1723. * @param {Object} bankIndex
  1724. * @param {Object} ansIndex
  1725. * 删除案例题简答图片
  1726. */
  1727. deleteImgChild(imgIndex, bankIndex, ansIndex) {
  1728. this.questionList[bankIndex].jsonStr[ansIndex].ansText.imageList.splice(
  1729. imgIndex,
  1730. 1
  1731. );
  1732. },
  1733. /**
  1734. * @param {Object} bankindex
  1735. * 选择上传图片
  1736. */
  1737. chooseImg(bankindex) {
  1738. if (
  1739. this.questionList[bankindex] &&
  1740. this.questionList[bankindex].ansText &&
  1741. this.questionList[bankindex].ansText.imageList.length >= 4
  1742. ) {
  1743. uni.showToast({
  1744. icon: "none",
  1745. title: "最多选择4张",
  1746. });
  1747. return;
  1748. }
  1749. uni.chooseImage({
  1750. count: 1, //默认9
  1751. sizeType: ["compressed"], //可以指定是原图还是压缩图,默认二者都有
  1752. sourceType: ["album", "camera"], //从相册选择
  1753. success: (res) => {
  1754. let self = this;
  1755. // console.log(JSON.stringify(res.tempFilePaths));
  1756. let img = res.tempFilePaths[0];
  1757. uni.getImageInfo({
  1758. src: img,
  1759. success: async (res) => {
  1760. let canvasWidth = res.width; //图片原始长宽
  1761. let canvasHeight = res.height;
  1762. if (canvasWidth > 1000 || canvasHeight > 1000) {
  1763. uni.compressImage({
  1764. src: img,
  1765. quality: 75,
  1766. width: "50%",
  1767. height: "50%",
  1768. success: async (rest) => {
  1769. const dir = await self.uploadFile(rest.tempFilePath, 0);
  1770. this.questionList[bankindex].ansText.imageList.push(dir);
  1771. },
  1772. });
  1773. } else {
  1774. const dir = await self.uploadFile(img, 0);
  1775. this.questionList[bankindex].ansText.imageList.push(dir);
  1776. }
  1777. },
  1778. });
  1779. },
  1780. });
  1781. },
  1782. /**
  1783. * @param {Object} bankindex
  1784. * @param {Object} ansindex
  1785. * 案例题选择上传图片
  1786. */
  1787. chooseImgChild(bankindex, ansindex) {
  1788. if (
  1789. this.questionList[bankindex].jsonStr[ansindex] &&
  1790. this.questionList[bankindex].jsonStr[ansindex].ansText &&
  1791. this.questionList[bankindex].jsonStr[ansindex].ansText.imageList
  1792. .length >= 4
  1793. ) {
  1794. uni.showToast({
  1795. icon: "none",
  1796. title: "最多选择4张",
  1797. });
  1798. return;
  1799. }
  1800. uni.chooseImage({
  1801. count: 1, //默认9
  1802. sizeType: ["compressed"], //可以指定是原图还是压缩图,默认二者都有
  1803. sourceType: ["album", "camera"], //从相册选择
  1804. success: (res) => {
  1805. let self = this;
  1806. // console.log(JSON.stringify(res.tempFilePaths));
  1807. let img = res.tempFilePaths[0];
  1808. uni.getImageInfo({
  1809. src: img,
  1810. success: async (res) => {
  1811. let canvasWidth = res.width; //图片原始长宽
  1812. let canvasHeight = res.height;
  1813. if (canvasWidth > 1000 || canvasHeight > 1000) {
  1814. uni.compressImage({
  1815. src: img,
  1816. quality: 75,
  1817. width: "50%",
  1818. height: "50%",
  1819. success: async (rest) => {
  1820. const dir = await self.uploadFile(rest.tempFilePath, 0);
  1821. this.questionList[bankindex].jsonStr[
  1822. ansindex
  1823. ].ansText.imageList.push(dir);
  1824. },
  1825. });
  1826. } else {
  1827. const dir = await self.uploadFile(img, 0);
  1828. this.questionList[bankindex].jsonStr[
  1829. ansindex
  1830. ].ansText.imageList.push(dir);
  1831. }
  1832. },
  1833. });
  1834. },
  1835. });
  1836. },
  1837. uploadFile(options, int) {
  1838. var self = this;
  1839. return new Promise((resolve, reject) => {
  1840. var data = {
  1841. orderGoodsId: this.orderGoodsId,
  1842. imageStatus: int,
  1843. };
  1844. self.$api.aliyunpolicy(data).then((res) => {
  1845. console.log(res.data, 6);
  1846. if (res.data.code != 200) {
  1847. self.$method.showToast("签名错误" + JSON.stringify(res.data));
  1848. return;
  1849. }
  1850. var ossToken = res.data.data.resultContent;
  1851. if (ossToken.host == null || ossToken.host == undefined) {
  1852. self.$method.showToast("上传路径报错" + JSON.stringify(res.data));
  1853. return;
  1854. }
  1855. uni.uploadFile({
  1856. url: ossToken.host,
  1857. name: "file",
  1858. filePath: options,
  1859. fileType: "image",
  1860. header: {
  1861. AuthorizationToken: "WX " + uni.getStorageSync("token"),
  1862. },
  1863. formData: {
  1864. key: ossToken.dir,
  1865. OSSAccessKeyId: ossToken.accessid,
  1866. policy: ossToken.policy,
  1867. Signature: ossToken.signature,
  1868. callback: ossToken.callback,
  1869. success_action_status: 200,
  1870. },
  1871. success: (result) => {
  1872. // if (result.statusCode === 200) {
  1873. resolve(ossToken.dir);
  1874. // } else {
  1875. // uni.showToast({
  1876. // title: "上传失败",
  1877. // icon: "none",
  1878. // });
  1879. // return;
  1880. // }
  1881. },
  1882. fail: (error) => {
  1883. uni.showToast({
  1884. title: "上传接口报错" + error,
  1885. icon: "none",
  1886. });
  1887. return;
  1888. },
  1889. });
  1890. });
  1891. });
  1892. },
  1893. /**
  1894. * @param {Object} type
  1895. * @param {Object} bankindex
  1896. * 简答题答案确认
  1897. */
  1898. submitAns(bankindex) {
  1899. console.log(this.questionList[bankindex]);
  1900. if (
  1901. !this.questionList[bankindex].ansText.text &&
  1902. !this.questionList[bankindex].ansText.imageList.length
  1903. ) {
  1904. uni.showToast({
  1905. title: "请输入内容或上传图片",
  1906. duration: 2000,
  1907. icon: "none",
  1908. });
  1909. return;
  1910. }
  1911. this.$set(this.questionList[bankindex], "ques", {
  1912. imageList: this.questionList[bankindex].ansText.imageList || [],
  1913. text: this.questionList[bankindex].ansText.text || "",
  1914. });
  1915. this.$u.toast("已确认答案");
  1916. this.isDoOver();
  1917. },
  1918. /**
  1919. * @param {Object} bankindex
  1920. * @param {Object} ansindex
  1921. * 案例题简答答案确认
  1922. */
  1923. submitAnsChild(bankindex, ansindex) {
  1924. if (
  1925. !this.questionList[bankindex].jsonStr[ansindex].ansText.text &&
  1926. !this.questionList[bankindex].jsonStr[ansindex].ansText.imageList.length
  1927. ) {
  1928. uni.showToast({
  1929. title: "请输入内容或上传图片",
  1930. duration: 2000,
  1931. icon: "none",
  1932. });
  1933. return;
  1934. }
  1935. this.$set(this.questionList[bankindex].ques, ansindex, {
  1936. imageList:
  1937. this.questionList[bankindex].jsonStr[ansindex].ansText.imageList ||
  1938. [],
  1939. text: this.questionList[bankindex].jsonStr[ansindex].ansText.text || "",
  1940. });
  1941. this.$u.toast("已确认答案");
  1942. this.isDoOver();
  1943. },
  1944. isCheck(item, index) {
  1945. // 案例题处理
  1946. let { ques, type, ans } = item;
  1947. if (type == 4) {
  1948. return ans.length == ques.length;
  1949. }
  1950. if (ques) {
  1951. return true;
  1952. }
  1953. },
  1954. isRight(item, index) {
  1955. //单选
  1956. if (this.questionList[index].ques) {
  1957. if (item.type == 1) {
  1958. return this.questionList[index].ques == this.questionList[index].ans;
  1959. //多选
  1960. } else if (item.type == 2) {
  1961. //每一项都相等
  1962. return this.questionList[index].ans.every((item, i) => {
  1963. return item == this.questionList[index].ques[i];
  1964. });
  1965. //判断
  1966. } else if (item.type == 3) {
  1967. return this.questionList[index].ques == this.questionList[index].ans;
  1968. // } else if (item.type == 5) {
  1969. // if(this.questionList[index].ques.text){
  1970. // return true
  1971. // }else{
  1972. // return false
  1973. // }
  1974. } else {
  1975. return false;
  1976. }
  1977. } else {
  1978. return false;
  1979. }
  1980. },
  1981. right(bankIndex, ansIndex, option) {
  1982. if (
  1983. this.questionList[bankIndex].ques[ansIndex] &&
  1984. this.questionList[bankIndex].ans[ansIndex]
  1985. ) {
  1986. if (
  1987. this.questionList[bankIndex].ques[ansIndex].indexOf(
  1988. option.optionsId
  1989. ) != -1 ||
  1990. this.questionList[bankIndex].ans[ansIndex].indexOf(
  1991. option.optionsId
  1992. ) != -1
  1993. ) {
  1994. return true;
  1995. } else {
  1996. return false;
  1997. }
  1998. } else {
  1999. return false;
  2000. }
  2001. },
  2002. wrong(bankIndex, ansIndex, option) {
  2003. if (
  2004. this.questionList[bankIndex].ques[ansIndex] &&
  2005. this.questionList[bankIndex].ans[ansIndex]
  2006. ) {
  2007. if (
  2008. this.questionList[bankIndex].ques[ansIndex].indexOf(
  2009. option.optionsId
  2010. ) != -1 &&
  2011. this.questionList[bankIndex].ans[ansIndex].indexOf(
  2012. option.optionsId
  2013. ) == -1
  2014. ) {
  2015. return true;
  2016. } else {
  2017. return false;
  2018. }
  2019. } else {
  2020. return false;
  2021. }
  2022. },
  2023. isWrong(item, index) {
  2024. if (this.questionList[index].ques) {
  2025. //单选
  2026. if (item.type == 1) {
  2027. return this.questionList[index].ques != this.questionList[index].ans;
  2028. //多选
  2029. } else if (item.type == 2) {
  2030. //每一项都相等
  2031. return this.questionList[index].ques.some((item, i) => {
  2032. return this.questionList[index].ans.indexOf(item) == -1;
  2033. });
  2034. //判断
  2035. } else if (item.type == 3) {
  2036. return this.questionList[index].ques != this.questionList[index].ans;
  2037. } else {
  2038. return false;
  2039. }
  2040. } else {
  2041. return false;
  2042. }
  2043. },
  2044. isPart(item, index) {
  2045. if (this.questionList[index].ques) {
  2046. if (item.type == 2) {
  2047. let isWrong = this.questionList[index].ques.some((item, i) => {
  2048. return this.questionList[index].ans.indexOf(item) == -1;
  2049. });
  2050. let isRight = this.questionList[index].ans.every((item, i) => {
  2051. return item == this.questionList[index].ques[i];
  2052. });
  2053. if (!isRight && !isWrong) {
  2054. return true;
  2055. }
  2056. }
  2057. } else {
  2058. return false;
  2059. }
  2060. },
  2061. isOver(item, index) {
  2062. if (this.questionList[index].ques) {
  2063. if (item.type == 4) {
  2064. //案例题
  2065. let isOver = item.jsonStr.every((jsonItem, indexs) => {
  2066. if (
  2067. jsonItem.type == 1 ||
  2068. jsonItem.type == 2 ||
  2069. jsonItem.type == 3
  2070. ) {
  2071. if (item.ques[indexs]) {
  2072. return true;
  2073. } else {
  2074. return false;
  2075. }
  2076. } else if (jsonItem.type == 5) {
  2077. if (
  2078. item.ques[indexs] &&
  2079. (item.ques[indexs].text || item.ques[indexs].imageList.length)
  2080. ) {
  2081. console.log("chil");
  2082. return true;
  2083. } else {
  2084. return false;
  2085. }
  2086. }
  2087. });
  2088. if (isOver) {
  2089. return true;
  2090. } else {
  2091. return false;
  2092. }
  2093. } else if (item.type == 5) {
  2094. //简答题
  2095. //每一项都相等
  2096. if (item.ques && (item.ques.imageList.length || item.ques.text)) {
  2097. return true;
  2098. }
  2099. //判断
  2100. } else {
  2101. return false;
  2102. }
  2103. } else {
  2104. return false;
  2105. }
  2106. },
  2107. tabSelect(index, bankindex) {
  2108. this.$set(this.questionList[bankindex], "current", index);
  2109. },
  2110. showPhoto(contentStr) {
  2111. if (contentStr && typeof contentStr == "string") {
  2112. let reg = /<img[^>]*src[=\'\"\s]+([^\'\"]*)[\'\"]?[^>]*>/gi;
  2113. let strArr = contentStr.match(reg);
  2114. strArr.forEach((str, index) => {
  2115. strArr[index] = str.replace(reg, "$1");
  2116. });
  2117. // 预览图片
  2118. uni.previewImage({
  2119. urls: strArr,
  2120. longPressActions: {
  2121. itemList: ["发送给朋友", "保存图片", "收藏"],
  2122. success: function (data) {
  2123. console.log(
  2124. "选中了第" +
  2125. (data.tapIndex + 1) +
  2126. "个按钮,第" +
  2127. (data.index + 1) +
  2128. "张图片"
  2129. );
  2130. },
  2131. fail: function (err) {
  2132. console.log(err.errMsg);
  2133. },
  2134. },
  2135. });
  2136. }
  2137. },
  2138. },
  2139. computed: {
  2140. doMode() {
  2141. // 做题模式 1章卷 2随机练习 3模拟组卷
  2142. return this.examData.simulateStatus ? 3 : undefined;
  2143. },
  2144. },
  2145. };
  2146. </script>
  2147. <style lang="scss" scoped>
  2148. .questionBank {
  2149. width: 100%;
  2150. height: 100vh;
  2151. display: flex;
  2152. flex-direction: column;
  2153. }
  2154. .swiper {
  2155. width: 100%;
  2156. flex: 1;
  2157. }
  2158. .lisSty {
  2159. margin-bottom: 16rpx;
  2160. display: flex;
  2161. align-items: center;
  2162. .flex_auto {
  2163. flex: 1;
  2164. word-break: break-all;
  2165. }
  2166. }
  2167. .activeTI {
  2168. vertical-align: middle;
  2169. display: inline-block;
  2170. border: 1rpx solid #eee;
  2171. border-radius: 50rpx;
  2172. height: 48rpx;
  2173. line-height: 46rpx;
  2174. text-align: center;
  2175. width: 48rpx;
  2176. margin-right: 15rpx;
  2177. color: #666;
  2178. font-size: 30rpx;
  2179. &.right {
  2180. color: #fff;
  2181. background: #36c75a;
  2182. }
  2183. &.wrong {
  2184. color: #fff;
  2185. background: #ff3b30;
  2186. }
  2187. &.checked,
  2188. &.user_choose {
  2189. color: #fff;
  2190. background: #007aff;
  2191. }
  2192. }
  2193. .submit_checkbox {
  2194. position: fixed;
  2195. left: 0;
  2196. right: 0;
  2197. bottom: 120rpx;
  2198. margin: 20rpx auto;
  2199. width: 526rpx;
  2200. height: 80rpx;
  2201. background: rgba(0, 122, 255, 1);
  2202. color: #fff;
  2203. text-align: center;
  2204. line-height: 80rpx;
  2205. font-size: 30rpx;
  2206. border-radius: 40rpx;
  2207. &.disabled {
  2208. opacity: 0.6;
  2209. }
  2210. }
  2211. .titles {
  2212. overflow: hidden;
  2213. margin-bottom: 24rpx;
  2214. }
  2215. .titBox {
  2216. padding: 41rpx 25rpx 24rpx 25rpx;
  2217. }
  2218. .titBox_title {
  2219. padding: 21rpx;
  2220. }
  2221. .tabs {
  2222. margin: 10rpx;
  2223. display: flex;
  2224. .tab {
  2225. margin: 0 4rpx;
  2226. padding: 10rpx 13rpx;
  2227. text-align: center;
  2228. color: #007aff;
  2229. font-size: 28rpx;
  2230. border-radius: 16rpx;
  2231. background: #fff;
  2232. &.current {
  2233. color: #fff;
  2234. background: #007aff;
  2235. }
  2236. }
  2237. }
  2238. .ans {
  2239. margin: 8rpx 8rpx 8rpx;
  2240. .ans_input {
  2241. border-radius: 16rpx;
  2242. background: #fff;
  2243. .top {
  2244. border-bottom: 1rpx solid #eeeeee;
  2245. padding: 16rpx;
  2246. display: flex;
  2247. align-items: center;
  2248. .icon {
  2249. margin-right: 20rpx;
  2250. width: 40rpx;
  2251. height: 38rpx;
  2252. }
  2253. .progress {
  2254. flex: 1;
  2255. }
  2256. .submit {
  2257. width: 168rpx;
  2258. height: 48rpx;
  2259. line-height: 48rpx;
  2260. text-align: center;
  2261. color: #fff;
  2262. font-size: 30rpx;
  2263. background: #007aff;
  2264. border-radius: 24rpx;
  2265. &.disabled {
  2266. opacity: 0.6;
  2267. }
  2268. }
  2269. }
  2270. .textarea {
  2271. textarea {
  2272. width: 100%;
  2273. height: 287rpx;
  2274. padding: 10rpx;
  2275. }
  2276. }
  2277. .imgs {
  2278. overflow: hidden;
  2279. display: flex;
  2280. width: 100%;
  2281. .img {
  2282. width: 104rpx;
  2283. height: 104rpx;
  2284. border-radius: 8rpx;
  2285. position: relative;
  2286. margin: 20rpx;
  2287. text {
  2288. position: absolute;
  2289. right: -15rpx;
  2290. top: -15rpx;
  2291. width: 30rpx;
  2292. height: 30rpx;
  2293. text-align: center;
  2294. line-height: 30rpx;
  2295. color: #fff;
  2296. background: #ff3b30;
  2297. border-radius: 50%;
  2298. }
  2299. image {
  2300. width: 100%;
  2301. height: 100%;
  2302. }
  2303. }
  2304. }
  2305. }
  2306. .ans_submit {
  2307. padding: 16rpx;
  2308. border-radius: 16rpx;
  2309. background: #fff;
  2310. .imgs {
  2311. overflow: hidden;
  2312. display: flex;
  2313. width: 100%;
  2314. .img {
  2315. width: 104rpx;
  2316. height: 104rpx;
  2317. border-radius: 8rpx;
  2318. position: relative;
  2319. margin: 20rpx;
  2320. image {
  2321. width: 100%;
  2322. height: 100%;
  2323. }
  2324. }
  2325. }
  2326. }
  2327. }
  2328. .leftLetters {
  2329. display: flex;
  2330. align-items: center;
  2331. width: 220rpx;
  2332. .btnType {
  2333. padding: 5rpx 10rpx;
  2334. border: 1rpx solid #007aff;
  2335. border-radius: 10rpx;
  2336. background-color: rgba(0, 122, 255, 0.1);
  2337. font-size: 28rpx;
  2338. color: #007aff;
  2339. margin-right: 15rpx;
  2340. }
  2341. }
  2342. .firstLetter {
  2343. display: flex;
  2344. justify-content: space-between;
  2345. align-items: center;
  2346. margin-bottom: 30rpx;
  2347. }
  2348. .popupView {
  2349. height: 100%;
  2350. padding-bottom: 100rpx;
  2351. .popupTops {
  2352. height: 77rpx;
  2353. border-bottom: 1rpx solid #eee;
  2354. text-align: center;
  2355. line-height: 77rpx;
  2356. font-size: 24rpx;
  2357. color: #999;
  2358. position: relative;
  2359. .topIcon {
  2360. position: absolute;
  2361. top: 10rpx;
  2362. left: 50%;
  2363. transform: translateX(-50%);
  2364. width: 80rpx;
  2365. height: 8rpx;
  2366. background-color: #999;
  2367. border-radius: 4rpx;
  2368. }
  2369. }
  2370. }
  2371. .pageContent {
  2372. position: relative;
  2373. background-color: #eaeef1;
  2374. height: 100%;
  2375. padding-top: 8rpx;
  2376. padding-bottom: 100rpx;
  2377. overflow-y: scroll;
  2378. }
  2379. .pad_8 {
  2380. background-color: #fff;
  2381. margin: 0rpx 8rpx 8rpx;
  2382. border-radius: 16rpx;
  2383. &.no-margin {
  2384. margin-top: -16rpx;
  2385. border-radius: 0 0 16rpx 16rpx;
  2386. }
  2387. }
  2388. .answer {
  2389. height: 80rpx;
  2390. line-height: 80rpx;
  2391. padding: 0rpx 24rpx;
  2392. display: flex;
  2393. align-items: center;
  2394. justify-content: space-between;
  2395. color: #666;
  2396. font-size: 30rpx;
  2397. }
  2398. .footer_btn {
  2399. background-color: #fff;
  2400. z-index: 10078;
  2401. position: fixed;
  2402. bottom: 0rpx;
  2403. display: flex;
  2404. align-items: center;
  2405. justify-content: space-between;
  2406. width: 100%;
  2407. height: 98rpx;
  2408. padding: 0rpx 38rpx;
  2409. border-top: 1rpx solid #eee;
  2410. .flex_center {
  2411. flex: 1;
  2412. display: flex;
  2413. justify-content: center;
  2414. align-items: center;
  2415. flex-direction: column;
  2416. margin: 0 200rpx;
  2417. font-size: 24rpx;
  2418. color: #999999;
  2419. .up-icon {
  2420. margin-bottom: 18rpx;
  2421. width: 100%;
  2422. display: flex;
  2423. justify-content: center;
  2424. image {
  2425. width: 58rpx;
  2426. height: 21rpx;
  2427. }
  2428. }
  2429. }
  2430. .collect {
  2431. visibility: hidden;
  2432. width: 100rpx;
  2433. &.show {
  2434. visibility: visible;
  2435. }
  2436. > view {
  2437. display: flex;
  2438. flex-direction: column;
  2439. align-items: center;
  2440. justify-content: center;
  2441. image {
  2442. width: 32rpx;
  2443. height: 32rpx;
  2444. margin-bottom: 6rpx;
  2445. }
  2446. view {
  2447. font-size: 24rpx;
  2448. color: #999999;
  2449. }
  2450. }
  2451. }
  2452. }
  2453. .boxSty {
  2454. padding: 44rpx 41rpx 0rpx;
  2455. }
  2456. .liListSty {
  2457. border: 1rpx solid #eeeeee;
  2458. width: 88rpx;
  2459. height: 88rpx;
  2460. border-radius: 32rpx;
  2461. text-align: center;
  2462. line-height: 88rpx;
  2463. color: #333;
  2464. font-size: 32rpx;
  2465. float: left;
  2466. margin: 20rpx 23rpx;
  2467. &.isRight {
  2468. border: 1rpx solid #eeeeee;
  2469. color: #fff;
  2470. background: #36c75a;
  2471. }
  2472. &.isWrong {
  2473. border: 1rpx solid #eeeeee;
  2474. color: #fff;
  2475. background: #ff3b30;
  2476. }
  2477. &.isPart {
  2478. border: 1rpx solid #eeeeee;
  2479. color: #fff;
  2480. background: #ffc53d;
  2481. }
  2482. &.isOver {
  2483. border: 1rpx solid #eeeeee;
  2484. color: #fff;
  2485. background: blue;
  2486. }
  2487. &.check_ans {
  2488. border: 1rpx solid #eeeeee;
  2489. color: #fff;
  2490. background: #007aff;
  2491. }
  2492. }
  2493. .answerInfos {
  2494. padding: 25rpx 25rpx 25rpx 23rpx;
  2495. }
  2496. .answerTitle {
  2497. margin-bottom: 28rpx;
  2498. color: #666;
  2499. font-size: 30rpx;
  2500. }
  2501. .answerContent {
  2502. font-size: 30rpx;
  2503. color: #666;
  2504. }
  2505. .textChild {
  2506. display: inline-block;
  2507. vertical-align: middle;
  2508. }
  2509. .dialog {
  2510. position: fixed;
  2511. left: 0;
  2512. top: 0;
  2513. width: 100%;
  2514. height: 100%;
  2515. background-color: rgba(0, 0, 0, 0.8);
  2516. display: flex;
  2517. flex-direction: column;
  2518. align-items: center;
  2519. justify-content: center;
  2520. z-index: 20000;
  2521. .pointer {
  2522. width: 338rpx;
  2523. height: 240rpx;
  2524. }
  2525. .text {
  2526. font-size: 32rpx;
  2527. color: #ffffff;
  2528. text-align: center;
  2529. }
  2530. .btn {
  2531. width: 242rpx;
  2532. height: 82rpx;
  2533. border: 2rpx solid #ffffff;
  2534. border-radius: 16rpx;
  2535. text-align: center;
  2536. line-height: 82rpx;
  2537. margin: 41rpx auto;
  2538. color: #fff;
  2539. font-size: 32rpx;
  2540. }
  2541. }
  2542. .dialog-arrow {
  2543. padding-top: 124rpx;
  2544. position: fixed;
  2545. left: 0;
  2546. top: 0;
  2547. width: 100%;
  2548. height: 100%;
  2549. background-color: rgba(0, 0, 0, 0.8);
  2550. z-index: 20000;
  2551. .pointer {
  2552. margin-left: 87rpx;
  2553. display: block;
  2554. width: 95rpx;
  2555. height: 98rpx;
  2556. }
  2557. .text {
  2558. padding-left: 177rpx;
  2559. font-size: 32rpx;
  2560. color: #ffffff;
  2561. }
  2562. .btn {
  2563. width: 242rpx;
  2564. height: 82rpx;
  2565. border: 2rpx solid #ffffff;
  2566. border-radius: 16rpx;
  2567. text-align: center;
  2568. line-height: 82rpx;
  2569. margin: 500rpx auto 0;
  2570. color: #fff;
  2571. font-size: 32rpx;
  2572. }
  2573. }
  2574. .dialog_wrap {
  2575. position: fixed;
  2576. left: 0;
  2577. top: 0;
  2578. width: 100%;
  2579. height: 100%;
  2580. z-index: 9999999999;
  2581. .bg {
  2582. background: rgba(0, 0, 0, 0.3);
  2583. position: absolute;
  2584. left: 0;
  2585. top: 0;
  2586. width: 100%;
  2587. height: 100%;
  2588. }
  2589. .dialog {
  2590. position: absolute;
  2591. left: 50%;
  2592. top: 50%;
  2593. transform: translate3D(-50%, -50%, 0);
  2594. width: 640rpx;
  2595. height: 439rpx;
  2596. background: #ffffff;
  2597. border-radius: 24rpx;
  2598. .title {
  2599. font-size: 30rpx;
  2600. font-weight: bold;
  2601. color: #333333;
  2602. line-height: 48rpx;
  2603. text-align: center;
  2604. margin-top: 40rpx;
  2605. }
  2606. .content {
  2607. margin: 35rpx 35rpx 0;
  2608. font-size: 30rpx;
  2609. color: #666666;
  2610. line-height: 48rpx;
  2611. }
  2612. .btns {
  2613. margin-top: 35rpx;
  2614. display: flex;
  2615. align-items: center;
  2616. justify-content: center;
  2617. .btn {
  2618. width: 200rpx;
  2619. height: 80rpx;
  2620. line-height: 80rpx;
  2621. text-align: center;
  2622. background: #f5f5f5;
  2623. border-radius: 40rpx;
  2624. font-size: 30rpx;
  2625. color: rgba(0, 122, 255, 1);
  2626. background: #f5f5f5;
  2627. margin: 0 20rpx;
  2628. &.active {
  2629. color: #f5f5f5;
  2630. background: rgba(0, 122, 255, 1);
  2631. }
  2632. }
  2633. }
  2634. }
  2635. }
  2636. .popboxs {
  2637. width: 100%;
  2638. height: 100%;
  2639. display: flex;
  2640. flex-direction: column;
  2641. align-items: center;
  2642. }
  2643. .classTops {
  2644. flex-shrink: 0;
  2645. padding: 39rpx 0rpx 4rpx;
  2646. font-weight: bold;
  2647. color: #333;
  2648. font-size: 30rpx;
  2649. }
  2650. .textStys {
  2651. width: 100%;
  2652. flex: 1;
  2653. padding: 36rpx;
  2654. }
  2655. .classFootsty {
  2656. flex-shrink: 0;
  2657. display: flex;
  2658. align-items: center;
  2659. justify-content: center;
  2660. padding: 10rpx 0rpx 40rpx;
  2661. .btnsty {
  2662. width: 200rpx;
  2663. height: 80rpx;
  2664. border-radius: 40rpx;
  2665. font-weight: bold;
  2666. font-size: 30rpx;
  2667. text-align: center;
  2668. line-height: 80rpx;
  2669. }
  2670. .btns1 {
  2671. background-color: #f5f5f5;
  2672. color: #007aff;
  2673. }
  2674. .btns2 {
  2675. margin-left: 40rpx;
  2676. background-color: #007aff;
  2677. color: #ffffff;
  2678. }
  2679. }
  2680. </style>