questionBank.vue 98 KB

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