questionBank.vue 111 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919
  1. <template>
  2. <view class="questionBank">
  3. <uni-nav-bar
  4. class="navbar"
  5. @clickLeft="clickLeft"
  6. left-icon="back"
  7. :statusBar="true"
  8. :title="examData.examName"
  9. ></uni-nav-bar>
  10. <swiper class="swiper" :current="current" @change="swiperChange">
  11. <swiper-item v-for="(bank, bankIndex) in questionList" :key="bankIndex">
  12. <view class="pageContent">
  13. <view class="pad_8 titBox">
  14. <view class="firstLetter">
  15. <view class="leftLetters">
  16. <view class="btnType">
  17. <text v-if="bank.type == 1">单选</text>
  18. <text v-if="bank.type == 2">多选</text>
  19. <text v-if="bank.type == 3">判断</text>
  20. <text v-if="bank.type == 4">案例</text>
  21. <text v-if="bank.type == 5">简答</text>
  22. </view>
  23. <text>{{ bankIndex + 1 }}/{{ questionList.length }}</text>
  24. </view>
  25. <view style="color: #666; font-size: 28rpx">{{
  26. countdown(lastTime)
  27. }}</view>
  28. <view class="leftLetters"></view>
  29. </view>
  30. <view class="titles">
  31. <rich-text :nodes="bank.content"></rich-text>
  32. </view>
  33. </view>
  34. <template v-if="bank.type == 1">
  35. <view class="pad_8 titBox no-margin">
  36. <view v-if="!bank.ques">
  37. <view
  38. v-for="(item, index) in bank.jsonStr"
  39. :key="index"
  40. class="lisSty"
  41. @click="radioSelect(item.optionsId, bankIndex)"
  42. >
  43. <view class="activeTI">{{ ast[index] }}</view>
  44. <view class="flex_auto">{{ item.content }}</view>
  45. </view>
  46. </view>
  47. <view v-if="bank.ques">
  48. <view
  49. v-for="(item, index) in bank.jsonStr"
  50. :key="index"
  51. class="lisSty"
  52. @click="radioSelect(item.optionsId, bankIndex)"
  53. >
  54. <text
  55. :class="{
  56. right:
  57. bankType == 1 &&
  58. (item.optionsId == bank.ques ||
  59. item.optionsId == bank.ans),
  60. wrong:
  61. bankType == 1 &&
  62. item.optionsId == bank.ques &&
  63. bank.ques != bank.ans,
  64. user_choose: bankType == 2 && item.optionsId == bank.ques,
  65. }"
  66. class="activeTI"
  67. >
  68. {{ ast[index] }}
  69. </text>
  70. <view class="flex_auto">{{ item.content }}</view>
  71. </view>
  72. </view>
  73. </view>
  74. <view v-if="bankType == 1 && bank.ques">
  75. <view class="pad_8 answer">
  76. <view>题目答案:{{ ast[bank.ans - 1] }}</view>
  77. <view>我的答案:{{ ast[bank.ques - 1] }}</view>
  78. </view>
  79. <view class="pad_8 answerInfos">
  80. <view class="answerTitle">答案解析</view>
  81. <view class="answerContent">
  82. <rich-text :nodes="bank.analysisContent"></rich-text>
  83. </view>
  84. </view>
  85. </view>
  86. </template>
  87. <template v-if="bank.type == 2">
  88. <view class="pad_8 titBox no-margin">
  89. <view v-if="!bank.ques">
  90. <view
  91. v-for="(item, index) in bank.jsonStr"
  92. :key="index"
  93. class="lisSty"
  94. @click="checkboxSelect(item.optionsId, bankIndex, index)"
  95. >
  96. <view :class="{ checked: item.checked }" class="activeTI">{{
  97. ast[index]
  98. }}</view>
  99. <view class="flex_auto">{{ item.content }}</view>
  100. </view>
  101. </view>
  102. <view
  103. v-if="bankType == 2 || (bankType == 1 && !bank.ques)"
  104. class="submit_checkbox"
  105. :class="{ disabled: !isCheckboxChecked(bank.jsonStr) }"
  106. @click="checkboxSubmit(bankIndex)"
  107. >确认答案</view
  108. >
  109. <view v-if="bank.ques">
  110. <view
  111. v-for="(item, index) in bank.jsonStr"
  112. :key="index"
  113. class="lisSty"
  114. @click="checkboxSelect(item.optionsId, bankIndex, index)"
  115. >
  116. <text
  117. :class="{
  118. right:
  119. bankType == 1 &&
  120. (bank.ques.indexOf(item.optionsId) != -1 ||
  121. bank.ans.indexOf(item.optionsId) != -1),
  122. wrong:
  123. bankType == 1 &&
  124. bank.ques.indexOf(item.optionsId) != -1 &&
  125. bank.ans.indexOf(item.optionsId) == -1,
  126. user_choose: bankType == 2 && item.checked,
  127. }"
  128. class="activeTI"
  129. >
  130. {{ ast[index] }}
  131. </text>
  132. <view class="flex_auto">{{ item.content }}</view>
  133. </view>
  134. </view>
  135. </view>
  136. <view v-if="bankType == 1 && bank.ques">
  137. <view class="pad_8 answer">
  138. <view>
  139. 题目答案:
  140. <text
  141. v-for="(ansItem, ansItemIndex) in bank.ans"
  142. :key="ansItemIndex"
  143. >{{ ast[ansItem - 1] }}</text
  144. >
  145. </view>
  146. <view>
  147. 我的答案:
  148. <text
  149. v-for="(quesItem, quesItemIndex) in bank.ques"
  150. :key="quesItemIndex"
  151. >{{ ast[quesItem - 1] }}</text
  152. >
  153. </view>
  154. </view>
  155. <view class="pad_8 answerInfos">
  156. <view class="answerTitle">答案解析</view>
  157. <view class="answerContent">
  158. <rich-text :nodes="bank.analysisContent"></rich-text>
  159. </view>
  160. </view>
  161. </view>
  162. </template>
  163. <template v-if="bank.type == 3">
  164. <view class="pad_8 titBox no-margin">
  165. <view v-if="!bank.ques">
  166. <view
  167. v-for="(item, index) in judge"
  168. :key="index"
  169. class="lisSty"
  170. @click="judgeSelect(index, bankIndex)"
  171. >
  172. <view class="activeTI">{{ ast[index] }}</view>
  173. <view class="flex_auto">
  174. {{ item }}
  175. </view>
  176. </view>
  177. </view>
  178. <view v-if="bank.ques">
  179. <view
  180. v-for="(item, index) in judge"
  181. :key="index"
  182. class="lisSty"
  183. @click="judgeSelect(index, bankIndex)"
  184. >
  185. <text
  186. :class="{
  187. right:
  188. bankType == 1 &&
  189. (index == (bank.ques == 1 ? 0 : 1) ||
  190. index != bank.ans),
  191. wrong:
  192. bankType == 1 &&
  193. index == (bank.ques == 1 ? 0 : 1) &&
  194. bank.ques != bank.ans,
  195. user_choose:
  196. bankType == 2 && index == (bank.ques == 1 ? 0 : 1),
  197. }"
  198. class="activeTI"
  199. >
  200. {{ ast[index] }}
  201. </text>
  202. <view class="flex_auto">
  203. {{ item }}
  204. </view>
  205. </view>
  206. </view>
  207. </view>
  208. <view v-if="bankType == 1 && bank.ques">
  209. <view class="pad_8 answer">
  210. <view>题目答案:{{ ast[bank.ans == 1 ? 0 : 1] }}</view>
  211. <view>我的答案:{{ ast[bank.ques == 1 ? 0 : 1] }}</view>
  212. </view>
  213. <view class="pad_8 answerInfos">
  214. <view class="answerTitle">答案解析</view>
  215. <view class="answerContent">
  216. <rich-text :nodes="bank.analysisContent"></rich-text>
  217. </view>
  218. </view>
  219. </view>
  220. </template>
  221. <!-- 简答题 -->
  222. <template v-if="bank.type == 5">
  223. <view class="pad_8 titBox">
  224. <view class="ans">
  225. <view
  226. class="ans_input"
  227. v-if="
  228. bankType == 2 ||
  229. (bankType == 1 &&
  230. (!bank.ques ||
  231. (!bank.ques.imageList.length && !bank.ques.text)))
  232. "
  233. >
  234. <view class="top flex">
  235. <image
  236. :data-index="bankIndex"
  237. class="icon"
  238. @click="chooseImg(bankIndex)"
  239. src="/static/camera.png"
  240. mode=""
  241. ></image>
  242. <view class="progress"
  243. >{{ bank.ansText.imageList.length || "0" }}/4</view
  244. >
  245. <view
  246. class="submit"
  247. :class="{ disabled: !bank.ansText.text && hasImgs(bank) }"
  248. @click="submitAns(bankIndex)"
  249. >确认答案</view
  250. >
  251. </view>
  252. <view class="textarea">
  253. <textarea
  254. v-model="bank.ansText.text"
  255. placeholder="在此输入答案"
  256. ></textarea>
  257. </view>
  258. <view class="imgs">
  259. <view
  260. class="img"
  261. v-for="(img, imgIndex) in bank.ansText.imageList"
  262. :key="imgIndex"
  263. >
  264. <text @click="deleteImg(imgIndex, bankIndex)">x</text>
  265. <image :src="$method.splitImgHost(img, true)"></image>
  266. </view>
  267. </view>
  268. </view>
  269. <view
  270. class="ans_submit answerInfos"
  271. v-if="
  272. bankType == 1 &&
  273. (bank.ques.text || bank.ques.imageList.length)
  274. "
  275. >
  276. <view class="answerTitle">我的答案:</view>
  277. {{ bank.ques.text }}
  278. <view class="imgs">
  279. <image
  280. class="img"
  281. v-for="(ques, quesIndex) in bank.ques.imageList"
  282. :key="quesIndex"
  283. :src="$method.splitImgHost(ques, true)"
  284. ></image>
  285. </view>
  286. </view>
  287. </view>
  288. </view>
  289. <view
  290. v-if="
  291. bankType == 1 &&
  292. bank.ques &&
  293. (bank.ques.text || bank.ques.imageList.length)
  294. "
  295. >
  296. <view class="pad_8 answerInfos">
  297. <view class="answerTitle">答案解析:</view>
  298. <view class="answerContent">
  299. <rich-text :nodes="bank.analysisContent"></rich-text>
  300. </view>
  301. </view>
  302. </view>
  303. </template>
  304. <!-- 案例题 -->
  305. <template v-if="bank.type == 4">
  306. <view class="tabs">
  307. <view
  308. class="tab"
  309. :class="{ current: tabIndex == bank.current }"
  310. :key="tabIndex"
  311. v-for="(tab, tabIndex) in bank.jsonStr"
  312. @click="tabSelect(tabIndex, bankIndex)"
  313. >
  314. 问题{{ tabIndex + 1 }}
  315. </view>
  316. </view>
  317. <view
  318. v-for="(ansItem, ansIndex) in bank.jsonStr"
  319. v-if="bank.current == ansIndex"
  320. :key="ansIndex"
  321. >
  322. <template v-if="ansItem.type == 1">
  323. <view class="pad_8 titBox">
  324. <view class="leftLetters">
  325. <view class="btnType">
  326. <text>单选</text>
  327. </view>
  328. </view>
  329. <view class="titles">
  330. <rich-text :nodes="ansItem.content"></rich-text>
  331. </view>
  332. <view v-if="!bank.ques[ansIndex]">
  333. <view
  334. v-for="(option, childIndex) in ansItem.optionsList"
  335. :key="childIndex"
  336. class="lisSty"
  337. @click="
  338. radioSelectChild(option.optionsId, ansIndex, bankIndex)
  339. "
  340. >
  341. <view class="activeTI">{{ ast[childIndex] }}</view>
  342. <view class="flex_auto">
  343. <rich-text
  344. class="textChild"
  345. :nodes="option.content"
  346. ></rich-text>
  347. </view>
  348. </view>
  349. </view>
  350. <view v-if="bank.ques[ansIndex]">
  351. <view
  352. v-for="(option, childIndex) in ansItem.optionsList"
  353. :key="childIndex"
  354. class="lisSty"
  355. @click="
  356. radioSelectChild(option.optionsId, ansIndex, bankIndex)
  357. "
  358. >
  359. <text
  360. :class="{
  361. right:
  362. bankType == 1 &&
  363. (option.optionsId == bank.ques[ansIndex] ||
  364. option.optionsId == bank.ans[ansIndex]),
  365. wrong:
  366. bankType == 1 &&
  367. option.optionsId == bank.ques[ansIndex] &&
  368. bank.ques[ansIndex] != bank.ans[ansIndex],
  369. user_choose:
  370. bankType == 2 &&
  371. option.optionsId == bank.ques[ansIndex],
  372. }"
  373. class="activeTI"
  374. >
  375. {{ ast[childIndex] }}
  376. </text>
  377. <view class="flex_auto">
  378. <rich-text :nodes="option.content"></rich-text>
  379. </view>
  380. </view>
  381. </view>
  382. </view>
  383. <view v-if="bankType == 1 && bank.ques[ansIndex]">
  384. <view class="pad_8 answer">
  385. <view>题目答案:{{ ast[bank.ans[ansIndex] - 1] }}</view>
  386. <view>我的答案:{{ ast[bank.ques[ansIndex] - 1] }}</view>
  387. </view>
  388. <view class="pad_8 answerInfos">
  389. <view class="answerTitle">答案解析</view>
  390. <view class="answerContent">
  391. <rich-text :nodes="option.analysisContent"></rich-text>
  392. </view>
  393. </view>
  394. </view>
  395. </template>
  396. <template v-if="ansItem.type == 2">
  397. <view class="pad_8 titBox">
  398. <view class="leftLetters">
  399. <view class="btnType">
  400. <text>多选</text>
  401. </view>
  402. </view>
  403. <view class="titles">
  404. <rich-text :nodes="ansItem.content"></rich-text>
  405. </view>
  406. <view v-if="!bank.ques[ansIndex]">
  407. <view
  408. v-for="(option, childindex) in ansItem.optionsList"
  409. :key="childindex"
  410. class="lisSty"
  411. @click="
  412. checkboxSelectChild(bankIndex, ansIndex, childindex)
  413. "
  414. >
  415. <view
  416. :class="{ checked: option.checked }"
  417. class="activeTI"
  418. >
  419. {{ ast[childindex] }}
  420. </view>
  421. <view class="flex_auto">
  422. <rich-text :nodes="option.content"></rich-text>
  423. </view>
  424. </view>
  425. </view>
  426. <view
  427. v-if="
  428. bankType == 2 || (bankType == 1 && !bank.ques[ansIndex])
  429. "
  430. class="submit_checkbox"
  431. :class="{
  432. disabled: !isCheckboxChecked(ansItem.optionsList),
  433. }"
  434. @click="checkboxSubmitChild(bankIndex, ansIndex)"
  435. >确认答案</view
  436. >
  437. <view v-if="bank.ques && bank.ques[ansIndex]">
  438. <view
  439. v-for="(option, childindex) in ansItem.optionsList"
  440. :key="childindex"
  441. class="lisSty"
  442. @click="
  443. checkboxSelectChild(bankIndex, ansIndex, childindex)
  444. "
  445. >
  446. <text
  447. :class="{
  448. right:
  449. bankType == 1 && right(bankIndex, ansIndex, option),
  450. wrong:
  451. bankType == 1 && wrong(bankIndex, ansIndex, option),
  452. user_choose: bankType == 2 && option.checked,
  453. }"
  454. class="activeTI"
  455. >
  456. {{ ast[childindex] }}
  457. </text>
  458. <view class="flex_auto">
  459. <rich-text :nodes="option.content"></rich-text>
  460. </view>
  461. </view>
  462. </view>
  463. </view>
  464. <view v-if="bankType == 1 && bank.ques[ansIndex]">
  465. <view class="pad_8 answer">
  466. <view>
  467. 题目答案:
  468. <text
  469. :key="ansItemIndex1"
  470. v-for="(ansItem1, ansItemIndex1) in bank.ans[ansIndex]"
  471. >{{ ast[ansItem1 - 1] }}</text
  472. >
  473. </view>
  474. <view>
  475. 我的答案:
  476. <text
  477. :key="quesItemIndex"
  478. v-for="(quesItem, quesItemIndex) in bank.ques[ansIndex]"
  479. >{{ ast[quesItem - 1] }}</text
  480. >
  481. </view>
  482. </view>
  483. <view class="pad_8 answerInfos">
  484. <view class="answerTitle">答案解析</view>
  485. <view class="answerContent">
  486. <rich-text :nodes="ansItem.analysisContent"></rich-text>
  487. </view>
  488. </view>
  489. </view>
  490. </template>
  491. <template v-if="ansItem.type == 3">
  492. <view class="pad_8 titBox">
  493. <view class="leftLetters">
  494. <view class="btnType">
  495. <text>判断</text>
  496. </view>
  497. </view>
  498. <view class="titles">
  499. <rich-text :nodes="ansItem.content"></rich-text>
  500. </view>
  501. <view v-if="!bank.ques[ansIndex]">
  502. <view
  503. v-for="(option, childindex) in judge"
  504. :key="childindex"
  505. class="lisSty"
  506. @click="judgeSelectChild(ansIndex, childindex, bankIndex)"
  507. >
  508. <view class="activeTI">{{ ast[childindex] }}</view>
  509. <view class="flex_auto">
  510. {{ option }}
  511. </view>
  512. </view>
  513. </view>
  514. <view v-if="bank.ques[ansIndex]">
  515. <view
  516. v-for="(option, childindex) in judge"
  517. :key="childindex"
  518. class="lisSty"
  519. @click="judgeSelectChild(ansIndex, childindex, bankIndex)"
  520. >
  521. <text
  522. :class="{
  523. right:
  524. bankType == 1 &&
  525. (childindex == (bank.ques[ansIndex] == 1 ? 0 : 1) ||
  526. childindex != bank.ans[ansIndex]),
  527. wrong:
  528. bankType == 1 &&
  529. childindex == (bank.ques[ansIndex] == 1 ? 0 : 1) &&
  530. bank.ques[ansIndex] != bank.ans[ansIndex],
  531. user_choose:
  532. bankType == 2 &&
  533. childindex == (bank.ques[ansIndex] == 1 ? 0 : 1),
  534. }"
  535. class="activeTI"
  536. >
  537. {{ ast[childindex] }}
  538. </text>
  539. <view class="flex_auto">
  540. {{ option }}
  541. </view>
  542. </view>
  543. </view>
  544. </view>
  545. <view v-if="bankType == 1 && bank.ques[ansIndex]">
  546. <view class="pad_8 answer">
  547. <view
  548. >题目答案:{{
  549. ast[bank.ans[ansIndex] == 1 ? 0 : 1]
  550. }}</view
  551. >
  552. <view
  553. >我的答案:{{
  554. ast[bank.ques[ansIndex] == 1 ? 0 : 1]
  555. }}</view
  556. >
  557. </view>
  558. <view class="pad_8 answerInfos">
  559. <view class="answerTitle">答案解析</view>
  560. <view class="answerContent">
  561. <rich-text :nodes="ansItem.analysisContent"></rich-text>
  562. </view>
  563. </view>
  564. </view>
  565. </template>
  566. <!-- 简答题 -->
  567. <template v-if="ansItem.type == 5">
  568. <view class="pad_8 titBox_title">
  569. <view class="leftLetters">
  570. <view class="btnType">
  571. <text>简答</text>
  572. </view>
  573. </view>
  574. <view class="titles">
  575. <rich-text :nodes="ansItem.content"></rich-text>
  576. </view>
  577. </view>
  578. <view class="pad_8 titBox_title">
  579. <view class="ans">
  580. <view
  581. class="ans_input"
  582. v-if="
  583. bankType == 2 ||
  584. (bankType == 1 &&
  585. (!bank.ques[ansIndex] ||
  586. (!bank.ques[ansIndex].text &&
  587. !bank.ques[ansIndex].imageList.length)))
  588. "
  589. >
  590. <view class="top flex">
  591. <image
  592. class="icon"
  593. @click="chooseImgChild(bankIndex, ansIndex)"
  594. src="/static/08-10_032.jpg"
  595. mode=""
  596. ></image>
  597. <view class="progress"
  598. >{{ ansItem.ansText.imageList.length || "0" }}/4
  599. </view>
  600. <view
  601. class="submit"
  602. @click="submitAnsChild(bankIndex, ansIndex)"
  603. >确认答案
  604. </view>
  605. </view>
  606. <view class="textarea">
  607. <textarea
  608. v-model="ansItem.ansText.text"
  609. placeholder="在此输入答案"
  610. ></textarea>
  611. </view>
  612. <view class="imgs">
  613. <view
  614. class="img"
  615. :key="imgIndex"
  616. v-for="(img, imgIndex) in ansItem.ansText.imageList"
  617. >
  618. <text
  619. @click="
  620. deleteImgChild(imgIndex, bankIndex, ansIndex)
  621. "
  622. >x</text
  623. >
  624. <image :src="$method.splitImgHost(img, true)"></image>
  625. </view>
  626. </view>
  627. </view>
  628. <view
  629. class="ans_submit answerInfos"
  630. v-if="bankType == 1 && bank.ques[ansIndex]"
  631. >
  632. <view class="answerTitle">我的答案</view>
  633. {{ bank.ques[ansIndex].text }}
  634. <view class="imgs">
  635. <image
  636. class="img"
  637. :key="quesIndex"
  638. v-for="(ques, quesIndex) in bank.ques[ansIndex]
  639. .imageList"
  640. :src="$method.splitImgHost(ques, true)"
  641. ></image>
  642. </view>
  643. </view>
  644. </view>
  645. </view>
  646. <view v-if="bankType == 1 && bank.ques[ansIndex]">
  647. <view class="pad_8 answerInfos">
  648. <view class="answerTitle">答案解析</view>
  649. <view class="answerContent">
  650. <rich-text :nodes="ansItem.analysisContent"></rich-text>
  651. </view>
  652. </view>
  653. </view>
  654. </template>
  655. </view>
  656. </template>
  657. <view class="footer_btn">
  658. <!-- <view class="collect">
  659. <view v-if="collectList[bankIndex]">
  660. <image src="/static/icon/collected.png" mode=""></image>
  661. <view>取消收藏</view>
  662. </view>
  663. </view> -->
  664. <view
  665. class="collect show"
  666. @click="collect(collectList[bankIndex], bankIndex)"
  667. >
  668. <view v-if="collectList[bankIndex]">
  669. <image src="/static/icon/collected.png" mode=""></image>
  670. <view>取消收藏</view>
  671. </view>
  672. <view v-if="!collectList[bankIndex]">
  673. <image src="/static/icon/collect.png" mode=""></image>
  674. <view>收藏</view>
  675. </view>
  676. </view>
  677. <view class="flex_center" @click="openFooterTab">
  678. <view class="up-icon">
  679. <image src="/static/up.png"></image>
  680. </view>
  681. 答题卡
  682. </view>
  683. <view class="collect show" @click="pdsubmit">
  684. <view>
  685. <image src="/static/jj.png" mode=""></image>
  686. <view>交卷</view>
  687. </view>
  688. </view>
  689. </view>
  690. </view>
  691. </swiper-item>
  692. </swiper>
  693. <u-popup v-model="show" mode="bottom" border-radius="14" height="680rpx">
  694. <view class="popupView">
  695. <view class="popupTops">
  696. <view class="topIcon"></view>
  697. 点击编号即可跳转至对应题目
  698. </view>
  699. <view class="popupContent">
  700. <scroll-view scroll-y="true" style="height: 506rpx">
  701. <view class="boxSty">
  702. <view
  703. v-for="(item, index) in questionList"
  704. :key="index"
  705. @click="changeIndex(index)"
  706. :class="{
  707. isRight: bankType == 1 && isRight(item, index),
  708. isWrong: bankType == 1 && isWrong(item, index),
  709. isPart: bankType == 1 && isPart(item, index),
  710. isOver: bankType == 1 && isOver(item, index),
  711. check_ans: bankType == 2 && isCheck(item, index),
  712. }"
  713. class="liListSty"
  714. >
  715. {{ index + 1 }}
  716. </view>
  717. </view>
  718. </scroll-view>
  719. </view>
  720. </view>
  721. </u-popup>
  722. <view class="dialog" v-if="showDialog">
  723. <view class="text">左右滑动切换上下题</view>
  724. <view class="btn" @click="hideDialog">我知道了</view>
  725. </view>
  726. <view class="dialog-arrow" v-if="showArrow">
  727. <image class="pointer" src="/static/arrow-left.png" mode=""></image>
  728. <view class="text">您当前正在测试, 若想退出请点击左上角返回按钮。</view>
  729. <view class="btn" @click="showArrow = false">我知道了</view>
  730. </view>
  731. <view class="dialog_wrap" v-if="testOver">
  732. <view class="bg"></view>
  733. <view class="dialog">
  734. <view class="title">温馨提示</view>
  735. <view class="content">
  736. <view>您已完成所有题目,</view>
  737. <view>快去交卷吧!</view>
  738. </view>
  739. <view class="btns">
  740. <view class="btn" @click="noSubmit()">暂不交卷</view>
  741. <view class="btn active" @click="submitNow()">立即交卷</view>
  742. </view>
  743. </view>
  744. </view>
  745. <view class="dialog_wrap" v-if="isLastCount">
  746. <view class="bg"></view>
  747. <view class="dialog">
  748. <view class="title">温馨提示</view>
  749. <view class="content">
  750. <view
  751. >您当前正在测试,还剩{{ lastCount }}道题未完成,离开视为交卷</view
  752. >
  753. </view>
  754. <view class="btns">
  755. <view class="btn" @click="noLeave()">暂不离开</view>
  756. <view class="btn active" @click="leaveNow()">继续离开</view>
  757. </view>
  758. </view>
  759. </view>
  760. <u-popup
  761. v-model="showpopups"
  762. mode="center"
  763. border-radius="24"
  764. height="439rpx"
  765. width="640rpx"
  766. :mask-close-able="false"
  767. >
  768. <view class="popboxs">
  769. <view class="classTops">温馨提示</view>
  770. <view class="textStys">
  771. {{
  772. cgType === 7
  773. ? "您还未交卷,确定结束做题吗?"
  774. : cgType === 8
  775. ? `您还有${lastCount}道题未作答, 现在继续作答,还是下次继续?`
  776. : cgType === 6
  777. ? `您还有${lastCount}道题未作答, 您确定要交卷吗?`
  778. : cgType == 9
  779. ? `您已完成所有题目,快去交卷吧!`
  780. : ""
  781. }}
  782. </view>
  783. <view class="classFootsty" v-if="cgType === 6">
  784. <view class="btnsty btns1" @click="submit()">立即交卷</view>
  785. <view class="btnsty btns2" @click="showpopups = false">继续做题</view>
  786. </view>
  787. <view class="classFootsty" v-if="cgType === 7">
  788. <view class="btnsty btns1" @click="showpopups = false">下次继续</view>
  789. <view class="btnsty btns2" @click="backPages">结束做题</view>
  790. </view>
  791. <view class="classFootsty" v-if="cgType === 8">
  792. <view class="btnsty btns1" @click="leaveNow()">下次继续</view>
  793. <view class="btnsty btns2" @click="showpopups = false">继续作答</view>
  794. </view>
  795. <view class="classFootsty" v-if="cgType === 9">
  796. <view class="btnsty btns1" @click="showpopups = false">暂不交卷</view>
  797. <view class="btnsty btns2" @click="submit()">立即交卷</view>
  798. </view>
  799. </view>
  800. </u-popup>
  801. <!-- 节卷不需要拍照 -->
  802. <!-- :show="examType != 2 && photoPopup" -->
  803. <u-popup
  804. v-model="photoPopup"
  805. mode="bottom"
  806. border-radius="40"
  807. :mask-close-able="false"
  808. >
  809. <!-- 播放前拍照start -->
  810. <!-- :mask-close-able="false" -->
  811. <!-- style="bottom: 0; position: fixed; width: 100%; z-index: 999" -->
  812. <view v-if="examType != 2 && photoPopup">
  813. <view class="photoBox">
  814. <view class="photoTop">
  815. <view class="sqzz" v-if="false">
  816. <u-icon
  817. name="close"
  818. color="#333333"
  819. size="30"
  820. @click="closePhoto"
  821. ></u-icon>
  822. </view>
  823. <view class="centersq">请正视手机屏幕</view>
  824. <view class="sqzz"></view>
  825. </view>
  826. <view class="photoCenter">
  827. <view class="center_camera" v-if="photoPopup && isTaking">
  828. <!-- #ifdef MP-WEIXIN -->
  829. <camera
  830. device-position="front"
  831. flash="off"
  832. @error="error"
  833. style="width: 100%; height: 100%"
  834. >
  835. <!-- 加人脸框 -->
  836. <cover-view class="head_take">
  837. <cover-view class="headTake_up color"></cover-view>
  838. <cover-view class="headTake_minddle">
  839. <cover-view class="min_left color"></cover-view>
  840. <cover-view class="min_img"></cover-view>
  841. <cover-view class="min_right color"></cover-view>
  842. </cover-view>
  843. <cover-view class="headTake_down color"></cover-view>
  844. </cover-view>
  845. </camera>
  846. <!-- #endif -->
  847. <!-- #ifdef H5 -->
  848. <video
  849. :controls="false"
  850. id="video"
  851. width="400"
  852. height="300"
  853. class="photo_v"
  854. ></video>
  855. <view class="mask"></view>
  856. <!-- #endif -->
  857. </view>
  858. <view class="custom" v-if="!isTaking">
  859. <!-- #ifdef MP-WEIXIN -->
  860. <image :src="avatarUrl" mode=""></image>
  861. <!-- #endif -->
  862. <!-- #ifdef H5 -->
  863. <image :src="faceUrl" mode=""></image>
  864. <!-- #endif -->
  865. </view>
  866. </view>
  867. <view class="photoBoxbtns">
  868. <!-- <view class="btnResult" v-if="isTaking" @click="takePhoto"
  869. >拍照</view
  870. > -->
  871. <view v-if="isTaking" class="takePhoto_btn">
  872. <view style="width: 100rpx; height: 2rpx"></view>
  873. <view class="middle_btn" @click="takePhoto">
  874. <view class="square"></view>
  875. </view>
  876. <view class="rights" @click="takePhTips()">
  877. <text>拍照提示</text>
  878. <u-icon name="arrow-right" color="#FFFFFF" size="30"></u-icon>
  879. </view>
  880. </view>
  881. <view class="btnResult" v-if="!isTaking" @click="reTake">重拍</view>
  882. <view class="btnResult" v-if="!isTaking" @click="submitPhoto"
  883. >确认</view
  884. >
  885. </view>
  886. </view>
  887. </view>
  888. </u-popup>
  889. <!-- 拍照提示 -->
  890. <popup-photo
  891. :popupPhotoShow.sync="popupPhotoShow"
  892. @takePhoto="toTakePhoto()"
  893. ></popup-photo>
  894. </view>
  895. </template>
  896. <script>
  897. import PopupPhoto from "@/components/popup/index.vue";
  898. export default {
  899. components: {
  900. PopupPhoto,
  901. },
  902. data() {
  903. return {
  904. photoPopup: false,
  905. showpopups: false,
  906. id: "",
  907. current: 0,
  908. questionList: [],
  909. ast: ["A", "B", "C", "D", "E", "F", "G"],
  910. judge: ["正确", "错误"],
  911. ans: [],
  912. ques: [],
  913. show: false,
  914. showDialog: false,
  915. bankList: [],
  916. collectList: [],
  917. goodsId: "",
  918. recordId: "",
  919. isSubmit: false,
  920. lastTime: 0, //剩余考试时长
  921. allTimes: 0, //总考试时长
  922. timer: null,
  923. wrongList: [],
  924. bankType: 0, //试卷类型
  925. needBack: false, //是否是考试
  926. testOver: false,
  927. isLastCount: false, //是否有未答题目
  928. lastCount: 0, //剩余没有回答的题目数
  929. chapterId: 0,
  930. moduleId: 0,
  931. sectionId: 0,
  932. showArrow: false, //退出提示
  933. isFromVideo: "",
  934. gradeId: "",
  935. courseId: 0,
  936. cgType: 0, //对应设计稿弹窗编码,
  937. avatarUrl: "",
  938. ossAvatarUrl: "",
  939. goodsDetail: {},
  940. isTakePhoto: false,
  941. orderGoodsId: 0,
  942. isTaking: true, //是否正在拍照
  943. needPhoto: false, //是否需要拍照
  944. examType: 0, // 3-模块,1-章,2-节
  945. compareFaceData: 0, // 拍照匹配相似度
  946. learning: false, // 1合格,0不合格
  947. originShowDialog: false,
  948. uploadLock: false, //上传图片
  949. examData: {},
  950. popupPhotoShow: false,
  951. // h5
  952. faceUrl: "",
  953. simulateExamId: undefined,
  954. };
  955. },
  956. watch: {
  957. photoPopup(n) {
  958. // 拍照弹窗和showDialog同时出现时,先展示拍照弹窗再展示showDialog弹窗
  959. if (n) {
  960. this.showDialog && (this.showDialog = false);
  961. } else {
  962. this.originShowDialog && (this.showDialog = true);
  963. }
  964. },
  965. },
  966. async onLoad(option) {
  967. this.examType = option.type;
  968. this.id = option.id;
  969. this.goodsId = option.goodsid;
  970. this.chapterId = option.chapterId;
  971. this.courseId = option.courseId;
  972. this.sectionId = option.sectionId;
  973. this.moduleId = option.moduleId;
  974. this.isFromVideo = option.isFromVideo || "";
  975. this.gradeId = option.gradeId || "";
  976. this.orderGoodsId = Number(option.orderGoodsId);
  977. let isBack = option.isback;
  978. let showDialog = uni.getStorageSync("showDialog");
  979. if (showDialog) {
  980. this.showDialog = false;
  981. } else {
  982. this.showDialog = true;
  983. this.originShowDialog = true;
  984. uni.setStorageSync("showDialog", "1");
  985. }
  986. //考试时候用手势或者返回键 被迫返回做题
  987. if (isBack) {
  988. let app = getApp();
  989. let globalData = app.globalData;
  990. for (var k in globalData.bankData) {
  991. this[k] = globalData.bankData[k];
  992. }
  993. this.showArrow = true;
  994. //需要拍没拍过直接弹出摄像头
  995. if (this.needPhoto && !this.isTakePhoto) {
  996. if (!this.learning && this.examType != 2) {
  997. if (uni.getStorageSync("tabkePhotoShow")) {
  998. // #ifdef MP-WEIXIN
  999. this.photoPopup = true;
  1000. this.isTaking = true;
  1001. // #endif
  1002. this.avatarUrl = "";
  1003. // #ifdef H5
  1004. this.isHadCamera();
  1005. // #endif
  1006. } else {
  1007. this.popupPhotoShow = true;
  1008. uni.setStorageSync("tabkePhotoShow", 1); // 本地缓存用来判断是否已经弹出过弹窗
  1009. }
  1010. }
  1011. } else {
  1012. //不需要拍照
  1013. if (this.lastTime) {
  1014. this.timer = setInterval(() => {
  1015. if (this.lastTime <= 0) {
  1016. clearInterval(this.timer);
  1017. uni.showToast({
  1018. icon: "none",
  1019. mask: true,
  1020. title: "考试时间已到,系统将自动交卷",
  1021. duration: 10000,
  1022. });
  1023. this.submit();
  1024. return;
  1025. }
  1026. this.lastTime--;
  1027. }, 1000);
  1028. }
  1029. }
  1030. } else {
  1031. await this.getGoodsDetail();
  1032. this.needPhoto && (await this.getExamLearnStatus());
  1033. // 请求题目列表
  1034. await this.bankExam();
  1035. this.goodsQuestionList();
  1036. }
  1037. },
  1038. mounted() {},
  1039. onUnload() {
  1040. if (this.isSubmit) {
  1041. clearInterval(this.timer);
  1042. return;
  1043. }
  1044. if (this.needPhoto && !this.isTakePhoto) {
  1045. return;
  1046. }
  1047. //考试试卷 阻止ios手势返回,自动跳回答题页
  1048. if (this.needBack) {
  1049. let app = getApp();
  1050. app.globalData.bankData = this.$data;
  1051. clearInterval(this.timer);
  1052. uni.navigateTo({
  1053. url:
  1054. "/pages2/class/questionBank?id=" +
  1055. this.id +
  1056. "&goodsid=" +
  1057. this.goodsId +
  1058. "&isback=true&orderGoodsId=" +
  1059. this.orderGoodsId,
  1060. });
  1061. } else {
  1062. //点击返回按钮确认允许退出,交卷
  1063. clearInterval(this.timer);
  1064. this.examRecordEdit();
  1065. }
  1066. },
  1067. computed: {
  1068. doMode() {
  1069. // 做题模式 1章卷 2随机练习 3模拟组卷
  1070. return this.examData.simulateStatus ? 3 : undefined;
  1071. },
  1072. },
  1073. methods: {
  1074. getExamLearnStatus() {
  1075. return this.$api
  1076. .getExamLearnStatus({
  1077. goodsId: this.goodsId,
  1078. gradeId: this.gradeId,
  1079. chapterId: this.chapterId,
  1080. courseId: this.courseId,
  1081. moduleId: this.moduleId,
  1082. type: this.examType,
  1083. examId: this.id,
  1084. })
  1085. .then((res) => {
  1086. this.learning = res.data.data;
  1087. return Promise.resolve();
  1088. });
  1089. },
  1090. getGoodsDetail() {
  1091. return new Promise((resolve) => {
  1092. let self = this;
  1093. this.$api.goodsDetail(this.goodsId).then((res) => {
  1094. self.goodsDetail = res.data.data;
  1095. if (self.goodsDetail.goodsPhotoExamConfig) {
  1096. let goodsPhotoExamConfig = JSON.parse(
  1097. self.goodsDetail.goodsPhotoExamConfig
  1098. );
  1099. if (goodsPhotoExamConfig.photograph > 0) {
  1100. self.needPhoto = true;
  1101. }
  1102. }
  1103. resolve();
  1104. });
  1105. });
  1106. },
  1107. reTake() {
  1108. this.isTaking = true;
  1109. // #ifdef H5
  1110. this.faceUrl = "";
  1111. this.getUserMedia({
  1112. video: {
  1113. width: 400,
  1114. height: 300,
  1115. },
  1116. });
  1117. // #endif
  1118. },
  1119. postStudyRecord() {
  1120. let self = this;
  1121. let data = {
  1122. photo: self.ossAvatarUrl,
  1123. recordId: self.recordId,
  1124. };
  1125. if (this.ossAvatarUrl) {
  1126. data.similarity = this.compareFaceData; // 相似度
  1127. }
  1128. // console.log(data, "拍照提交");
  1129. this.$api.studyExamPhotoRecord(data).then((res) => {
  1130. // console.log(res, "拍照提交结果");
  1131. if (res.data.code != 200) {
  1132. uni.showToast({
  1133. icon: "none",
  1134. mask: true,
  1135. title: res.data.msg,
  1136. duration: 10000,
  1137. });
  1138. return;
  1139. }
  1140. self.ossAvatarUrl = "";
  1141. self.isTakePhoto = true;
  1142. //拍照
  1143. if (this.lastTime) {
  1144. this.timer = setInterval(() => {
  1145. if (this.lastTime <= 0) {
  1146. clearInterval(this.timer);
  1147. uni.showToast({
  1148. icon: "none",
  1149. mask: true,
  1150. title: "考试时间已到,系统将自动交卷",
  1151. duration: 10000,
  1152. });
  1153. this.submit();
  1154. return;
  1155. }
  1156. this.lastTime--;
  1157. }, 1000);
  1158. }
  1159. });
  1160. },
  1161. uploadFile(options, int) {
  1162. var self = this;
  1163. return new Promise((resolve, reject) => {
  1164. var data = {
  1165. imageStatus: int,
  1166. gradeId: this.gradeId,
  1167. };
  1168. self.$api.aliyunpolicy(data).then((res) => {
  1169. if (res.data.code != 200) {
  1170. self.$method.showToast("签名错误" + JSON.stringify(res.data));
  1171. return;
  1172. }
  1173. var ossToken = res.data.data.resultContent;
  1174. if (ossToken.host == null || ossToken.host == undefined) {
  1175. self.$method.showToast("上传路径报错" + JSON.stringify(res.data));
  1176. return;
  1177. }
  1178. let filePath = "";
  1179. // #ifdef H5
  1180. var localData = options; //dataUrl为base64位
  1181. let base = atob(localData.substring(localData.indexOf(",") + 1)); // base是将base64编码解码,去掉data:image/png;base64部分
  1182. let length = base.length;
  1183. let url = new Uint8Array(length);
  1184. while (length--) {
  1185. url[length] = base.charCodeAt(length);
  1186. }
  1187. filePath = new File([url], "a.jpg", {
  1188. type: "image/jpg",
  1189. });
  1190. console.log("filePath:", filePath);
  1191. uni.uploadFile({
  1192. url: ossToken.host,
  1193. name: "file",
  1194. file: filePath,
  1195. fileType: "image",
  1196. header: {
  1197. AuthorizationToken: "WX " + uni.getStorageSync("token"),
  1198. },
  1199. formData: {
  1200. key: ossToken.dir,
  1201. OSSAccessKeyId: ossToken.accessid,
  1202. policy: ossToken.policy,
  1203. Signature: ossToken.signature,
  1204. callback: ossToken.callback,
  1205. success_action_status: 200,
  1206. },
  1207. success: (result) => {
  1208. this.$u.toast("上传成功");
  1209. this.ossAvatarUrl = ossToken.dir;
  1210. console.log("h5上传成功--:", this.ossAvatarUrl);
  1211. resolve();
  1212. },
  1213. fail: (error) => {
  1214. console.log("h5上传失败:", error);
  1215. uni.showToast({
  1216. title: "上传接口报错,请重新拍照上传" + error,
  1217. icon: "none",
  1218. });
  1219. this.openPhoto();
  1220. return;
  1221. },
  1222. });
  1223. // #endif
  1224. // #ifdef MP-WEIXIN
  1225. uni.uploadFile({
  1226. url: ossToken.host,
  1227. name: "file",
  1228. filePath: options,
  1229. fileType: "image",
  1230. header: {
  1231. AuthorizationToken: "WX " + uni.getStorageSync("token"),
  1232. },
  1233. formData: {
  1234. key: ossToken.dir,
  1235. OSSAccessKeyId: ossToken.accessid,
  1236. policy: ossToken.policy,
  1237. Signature: ossToken.signature,
  1238. callback: ossToken.callback,
  1239. success_action_status: 200,
  1240. },
  1241. success: (result) => {
  1242. // if (result.statusCode === 200) {
  1243. self.ossAvatarUrl = ossToken.dir;
  1244. resolve(ossToken.dir);
  1245. // } else {
  1246. // uni.showToast({
  1247. // title: "上传失败",
  1248. // icon: "none",
  1249. // });
  1250. // return;
  1251. // }
  1252. },
  1253. fail: (error) => {
  1254. uni.showToast({
  1255. title: "上传接口报错" + error,
  1256. icon: "none",
  1257. });
  1258. this.uploadLock = false;
  1259. this.openPhoto();
  1260. return;
  1261. },
  1262. });
  1263. // #endif
  1264. });
  1265. });
  1266. },
  1267. imageInfos() {
  1268. var self = this;
  1269. return new Promise(async (resolve, reject) => {
  1270. // #ifdef MP-WEIXIN
  1271. uni.getImageInfo({
  1272. src: self.avatarUrl,
  1273. success: async (res) => {
  1274. let canvasWidth = res.width; //图片原始长宽
  1275. let canvasHeight = res.height;
  1276. if (canvasWidth > 2000 || canvasHeight > 2000) {
  1277. uni.compressImage({
  1278. src: self.avatarUrl,
  1279. quality: 75,
  1280. width: "35%",
  1281. height: "35%",
  1282. success: async (rest) => {
  1283. const waitUpload = await self.uploadFile(
  1284. rest.tempFilePath,
  1285. 0
  1286. );
  1287. resolve(waitUpload);
  1288. },
  1289. });
  1290. } else if (canvasWidth > 1000 || canvasHeight > 1000) {
  1291. uni.compressImage({
  1292. src: self.avatarUrl,
  1293. quality: 75,
  1294. width: "50%",
  1295. height: "50%",
  1296. success: async (rest) => {
  1297. const waitUpload = await self.uploadFile(
  1298. rest.tempFilePath,
  1299. 0
  1300. );
  1301. resolve(waitUpload);
  1302. },
  1303. });
  1304. } else {
  1305. console.log("无需压缩");
  1306. const waitUpload = await self.uploadFile(self.avatarUrl, 0);
  1307. resolve(waitUpload);
  1308. }
  1309. },
  1310. });
  1311. // #endif
  1312. // #ifdef H5
  1313. const waitUpload = await this.uploadFile(this.faceUrl, 0);
  1314. resolve(waitUpload);
  1315. // #endif
  1316. });
  1317. },
  1318. /**
  1319. * 人脸匹配
  1320. */
  1321. faceRecognition() {
  1322. return new Promise((resolve) => {
  1323. // #ifdef MP-WEIXIN
  1324. let fileSystem = uni.getFileSystemManager();
  1325. fileSystem.readFile({
  1326. filePath: `${this.avatarUrl}`,
  1327. encoding: "base64",
  1328. position: 0,
  1329. success: (res) => {
  1330. let base64 = "data:image/jpg;base64," + res.data;
  1331. console.log("试卷-base64Data人脸识别参数:", {
  1332. imageA: base64,
  1333. orderGoodsId: this.orderGoodsId,
  1334. gradeId: this.gradeId,
  1335. });
  1336. this.CompareFace(base64, resolve);
  1337. },
  1338. fail(err) {
  1339. console.error(err, "err");
  1340. },
  1341. });
  1342. // #endif
  1343. // #ifdef H5
  1344. this.CompareFace(this.faceUrl, resolve);
  1345. // #endif
  1346. });
  1347. },
  1348. CompareFace(url, resolve) {
  1349. let timer = setTimeout(() => {
  1350. uni.showToast({
  1351. icon: "none",
  1352. title: "拍照超时,请重新拍照",
  1353. duration: 2000,
  1354. success: () => {
  1355. setTimeout(() => {
  1356. uni.navigateBack();
  1357. }, 1000);
  1358. },
  1359. });
  1360. }, 10 * 1000);
  1361. this.$api
  1362. .faceCertificationCompareFace({
  1363. imageA: url,
  1364. orderGoodsId: this.orderGoodsId,
  1365. gradeId: this.gradeId,
  1366. })
  1367. .then((res) => {
  1368. clearTimeout(timer);
  1369. console.log(res, "人脸识别成功res");
  1370. resolve(res.data.data);
  1371. })
  1372. .catch((err) => {
  1373. clearTimeout(timer);
  1374. // 当前网络延迟,
  1375. console.log("人脸识别错误:", err);
  1376. uni.showModal({
  1377. content: "当前网络延迟",
  1378. showCancel: false,
  1379. success: (resultst) => {
  1380. if (resultst.confirm) {
  1381. uni.navigateBack();
  1382. }
  1383. },
  1384. });
  1385. });
  1386. },
  1387. toTakePhoto() {
  1388. this.popupPhotoShow = false;
  1389. this.openPhoto();
  1390. },
  1391. takePhTips() {
  1392. this.popupPhotoShow = true;
  1393. this.isTaking = false;
  1394. this.photoPopup = false;
  1395. },
  1396. // 确认拍照
  1397. async submitPhoto() {
  1398. if (this.uploadLock) {
  1399. return;
  1400. }
  1401. this.uploadLock = true;
  1402. let compareFaceData = await this.faceRecognition();
  1403. this.compareFaceData = compareFaceData;
  1404. if (compareFaceData >= 80) {
  1405. const waitYS = await this.imageInfos();
  1406. this.postStudyRecord(); //提交记录
  1407. this.photoPopup = false;
  1408. } else {
  1409. uni.showToast({
  1410. title: "人脸匹配不通过,请重新拍照上传",
  1411. icon: "none",
  1412. duration: 2000,
  1413. });
  1414. setTimeout(() => {
  1415. this.uploadLock = false;
  1416. this.openPhoto();
  1417. }, 2000);
  1418. }
  1419. },
  1420. //拍照
  1421. openPhoto() {
  1422. console.log("开始拍照");
  1423. // this.enableAutoRotation = false;
  1424. // #ifdef MP-WEIXIN
  1425. this.photoPopup = true;
  1426. this.isTaking = true;
  1427. uni.setKeepScreenOn({
  1428. keepScreenOn: true,
  1429. });
  1430. uni.authorize({
  1431. scope: "scope.camera",
  1432. success() {},
  1433. });
  1434. // #endif
  1435. // #ifdef H5
  1436. this.isHadCamera();
  1437. // #endif
  1438. },
  1439. isHadCamera() {
  1440. if (
  1441. (window.navigator.mediaDevices &&
  1442. window.navigator.mediaDevices.getUserMedia) ||
  1443. window.navigator.getUserMedia ||
  1444. window.navigator.webkitGetUserMedia ||
  1445. window.navigator.mozGetUserMedia
  1446. ) {
  1447. console.log("getUserMedia----");
  1448. // 调用用户媒体设备, 访问摄像头
  1449. this.getUserMedia(
  1450. {
  1451. video: {
  1452. width: 400,
  1453. height: 300,
  1454. },
  1455. },
  1456. this.photographSuccess,
  1457. this.photographError
  1458. );
  1459. } else {
  1460. console.log("1111没有摄像");
  1461. this.photographError();
  1462. }
  1463. },
  1464. //确认拍照
  1465. takePhoto() {
  1466. // #ifdef MP-WEIXIN
  1467. const ctx = uni.createCameraContext();
  1468. ctx.takePhoto({
  1469. quality: "high",
  1470. success: (res) => {
  1471. console.log(res.tempImagePath);
  1472. this.avatarUrl = res.tempImagePath;
  1473. // self.submitPhoto();
  1474. this.isTaking = false;
  1475. },
  1476. fail: (err) => {
  1477. console.log(err);
  1478. },
  1479. });
  1480. // #endif
  1481. // #ifdef H5
  1482. const canvas = document.createElement("canvas");
  1483. canvas.width = 400;
  1484. canvas.height = 400;
  1485. const context = canvas.getContext("2d");
  1486. const video = document.querySelector("video");
  1487. context.drawImage(video, 0, 0, 400, 400);
  1488. this.faceUrl = canvas.toDataURL("image/png");
  1489. this.isTaking = false;
  1490. // #endif
  1491. },
  1492. /**
  1493. * 是否有上传图片
  1494. */
  1495. hasImgs(bank) {
  1496. return bank.ansText.imageList.length == 0;
  1497. },
  1498. /**
  1499. * 获取试卷类型2考试,1练习
  1500. */
  1501. bankExam() {
  1502. return this.$api.bankExam(this.id).then((res) => {
  1503. this.bankType = res.data.data.doType;
  1504. this.examData = res.data.data;
  1505. if (this.bankType == 2) {
  1506. this.needBack = true;
  1507. }
  1508. return Promise.resolve();
  1509. });
  1510. },
  1511. /**
  1512. * 点击后退按钮
  1513. */
  1514. clickLeft() {
  1515. //需要拍照没有拍直接返回
  1516. if (this.needPhoto && !this.isTakePhoto) {
  1517. this.isSubmit = true;
  1518. uni.navigateBack({
  1519. delta: 1,
  1520. });
  1521. return;
  1522. }
  1523. if (this.bankType == 1) {
  1524. let ansCount = this.questionOverNum(); //已答题数
  1525. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  1526. //所有题目答完
  1527. if (this.lastCount == 0) {
  1528. // this.testOver = true;
  1529. this.cgType = 7;
  1530. //未答完
  1531. } else {
  1532. this.cgType = 8;
  1533. // this.isLastCount = true;
  1534. }
  1535. this.showpopups = true;
  1536. } else if (this.bankType == 2) {
  1537. let ansCount = this.questionOverNum(); //已答题数
  1538. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  1539. //所有题目答完
  1540. if (this.lastCount == 0) {
  1541. this.testOver = true;
  1542. //未答完
  1543. } else {
  1544. this.isLastCount = true;
  1545. }
  1546. }
  1547. },
  1548. /**
  1549. * 返回上一页
  1550. */
  1551. backPages() {
  1552. this.needBack = false;
  1553. uni.navigateBack({
  1554. delta: 1,
  1555. });
  1556. },
  1557. /**
  1558. * 获取已经回答的题目数
  1559. * hasSpecail (是否包含简答和案例)
  1560. */
  1561. questionOverNum(hasSpecail) {
  1562. let count = 0;
  1563. this.questionList.forEach((item) => {
  1564. if (item.type == 1 || item.type == 2 || item.type == 3) {
  1565. if (item.ques) {
  1566. count++;
  1567. }
  1568. } else if (item.type == 4) {
  1569. //案例题
  1570. if (hasSpecail) {
  1571. let isOver = item.jsonStr.every((jsonItem, indexs) => {
  1572. if (
  1573. jsonItem.type == 1 ||
  1574. jsonItem.type == 2 ||
  1575. jsonItem.type == 3
  1576. ) {
  1577. if (item.ques[indexs]) {
  1578. return true;
  1579. } else {
  1580. return false;
  1581. }
  1582. } else if (jsonItem.type == 5) {
  1583. console.log(jsonItem, 111);
  1584. if (
  1585. item.ques[indexs] &&
  1586. (item.ques[indexs].text.length ||
  1587. item.ques[indexs].imageList.length)
  1588. ) {
  1589. return true;
  1590. } else {
  1591. return false;
  1592. }
  1593. }
  1594. });
  1595. if (isOver) {
  1596. count++;
  1597. console.log(item, 444);
  1598. }
  1599. }
  1600. } else if (item.type == 5) {
  1601. //简答题
  1602. if (hasSpecail) {
  1603. if (
  1604. item.ques &&
  1605. (item.ques.text.length || item.ques.imageList.length)
  1606. ) {
  1607. count++;
  1608. }
  1609. }
  1610. }
  1611. });
  1612. return count;
  1613. },
  1614. /**
  1615. * 是否做完所有题目
  1616. */
  1617. isDoOver() {
  1618. let questionOverNum = this.questionOverNum(true); //获取已经回答的题目数(包括简答和案例)
  1619. if (this.questionList.length == questionOverNum) {
  1620. //全部做完弹窗
  1621. this.cgType = 9;
  1622. this.showpopups = true;
  1623. }
  1624. },
  1625. /**
  1626. * 暂不交卷
  1627. */
  1628. noSubmit() {
  1629. //设为允许退出页面
  1630. this.needBack = false;
  1631. uni.navigateBack({
  1632. delta: 1,
  1633. });
  1634. },
  1635. /**
  1636. * 不离开
  1637. */
  1638. noLeave() {
  1639. this.isLastCount = false;
  1640. },
  1641. /**
  1642. * 立即离开并交卷
  1643. */
  1644. leaveNow() {
  1645. this.isSubmit = true;
  1646. uni.navigateBack({
  1647. delta: 1,
  1648. });
  1649. //需要拍照没有拍,返回不扣次数
  1650. if (this.needPhoto && !this.isTakePhoto) {
  1651. return;
  1652. }
  1653. this.submit("leaveNow");
  1654. return;
  1655. let score = 0; //计算总分
  1656. let reportStatus = 0;
  1657. let number = 0;
  1658. let doQuestionIds = []; //做过的题目id
  1659. let doQuestionNum = 0; //做过的题目数量
  1660. let passScore = 0;
  1661. let allScore = 0; //总分
  1662. this.questionList.forEach((item, index) => {
  1663. passScore = item.passScore;
  1664. if (item.type == 1) {
  1665. if (item.ques == item.ans) {
  1666. item.scoreResult = item.score;
  1667. score += item.score;
  1668. number++;
  1669. } else {
  1670. item.scoreResult = 0;
  1671. }
  1672. if (item.ques) {
  1673. doQuestionNum++;
  1674. doQuestionIds.push(item.questionId);
  1675. }
  1676. allScore += item.score;
  1677. } else if (item.type == 2) {
  1678. let isRight =
  1679. item.ques &&
  1680. item.ques.every((quesItem, quesIndex) => {
  1681. return item.ques[quesIndex] == item.ans[quesIndex];
  1682. });
  1683. if (isRight) {
  1684. //全对
  1685. item.scoreResult = item.score;
  1686. score += item.score;
  1687. number++;
  1688. } else {
  1689. let hasPart = false;
  1690. let checkboxScore = 1; //获取单题总分数
  1691. item.ques &&
  1692. item.ques.forEach((ques, quesIndex) => {
  1693. //选错一个全扣
  1694. if (item.ques) {
  1695. if (item.ans.indexOf(item.ques[quesIndex]) == -1) {
  1696. checkboxScore = 0;
  1697. }
  1698. } else {
  1699. checkboxScore = 0;
  1700. }
  1701. });
  1702. //没选错
  1703. if (checkboxScore) {
  1704. checkboxScore = 0;
  1705. item.ans.forEach((ans, quesIndex) => {
  1706. //漏选扣一部分,对n题给n X partScore 分
  1707. if (item.ques) {
  1708. if (item.ques.indexOf(item.ans[quesIndex]) != -1) {
  1709. checkboxScore += item.partScore;
  1710. hasPart = true;
  1711. }
  1712. } else {
  1713. checkboxScore = 0;
  1714. }
  1715. });
  1716. }
  1717. if (!hasPart) {
  1718. item.scoreResult = 0;
  1719. } else {
  1720. item.scoreResult = checkboxScore;
  1721. }
  1722. score += checkboxScore;
  1723. }
  1724. if (item.ques && item.ques.length) {
  1725. doQuestionNum++;
  1726. doQuestionIds.push(item.questionId);
  1727. }
  1728. allScore += item.score;
  1729. } else if (item.type == 3) {
  1730. if (item.ques == item.ans) {
  1731. item.scoreResult = item.score;
  1732. score += item.score;
  1733. number++;
  1734. } else {
  1735. item.scoreResult = 0;
  1736. }
  1737. if (item.ques) {
  1738. doQuestionNum++;
  1739. doQuestionIds.push(item.questionId);
  1740. }
  1741. allScore += item.score;
  1742. } else {
  1743. allScore += item.score;
  1744. }
  1745. });
  1746. if (score >= passScore) {
  1747. reportStatus = 1;
  1748. } else {
  1749. reportStatus = 0;
  1750. }
  1751. this.$api
  1752. .bankRecordEdit({
  1753. moduleId: this.moduleId || 0,
  1754. chapterId: this.chapterId || 0,
  1755. sectionId: this.sectionId || 0,
  1756. gradeId: this.gradeId,
  1757. courseId: this.courseId,
  1758. orderGoodsId: this.orderGoodsId,
  1759. goodsId: this.goodsId,
  1760. examId: this.id,
  1761. recordId: this.recordId,
  1762. reportStatus: reportStatus,
  1763. rightQuestionNum: number,
  1764. doQuestionNum: doQuestionNum,
  1765. status: 1,
  1766. doQuestionIds: doQuestionIds.join(","),
  1767. performance: score,
  1768. totalScore: allScore,
  1769. type: this.examType,
  1770. // examTime: parseInt(this.allTimes),
  1771. // doTime: parseInt(this.allTimes) - parseInt(this.lastTime),
  1772. // historyExamJson: JSON.stringify(this.questionList)
  1773. })
  1774. .then((res) => {});
  1775. },
  1776. /**
  1777. * 立即交卷
  1778. */
  1779. submitNow() {
  1780. this.showpopups = false;
  1781. this.needBack = false;
  1782. this.submit();
  1783. },
  1784. /**
  1785. * 离开页面统计回答正确题数
  1786. */
  1787. examRecordEdit() {
  1788. if (!this.isSubmit) {
  1789. this.submit("leave");
  1790. return;
  1791. let number = 0;
  1792. let score = 0;
  1793. let doQuestionNum = 0;
  1794. let reportStatus = 0;
  1795. let lessQuestionNum = 0;
  1796. this.questionList.forEach((item, index) => {
  1797. if (item.type == 1) {
  1798. if (item.ques == item.ans) {
  1799. score += item.score;
  1800. number++;
  1801. }
  1802. if (item.ques) {
  1803. doQuestionNum++;
  1804. }
  1805. } else if (item.type == 2) {
  1806. let isRight =
  1807. item.ques &&
  1808. item.ques.every((quesItem, quesIndex) => {
  1809. return item.ques[quesIndex] == item.ans[quesIndex];
  1810. });
  1811. if (isRight) {
  1812. score += item.score;
  1813. number++;
  1814. } else {
  1815. let hasPart = false;
  1816. let checkboxScore = 1; //获取单题总分数
  1817. item.ques.forEach((ques, quesIndex) => {
  1818. //选错一个全扣
  1819. if (item.ques) {
  1820. if (item.ans.indexOf(item.ques[quesIndex]) == -1) {
  1821. checkboxScore = 0;
  1822. }
  1823. } else {
  1824. checkboxScore = 0;
  1825. }
  1826. });
  1827. //没选错
  1828. if (checkboxScore) {
  1829. checkboxScore = 0;
  1830. item.ans.forEach((ans, quesIndex) => {
  1831. //漏选扣一部分
  1832. if (item.ques) {
  1833. if (item.ques.indexOf(item.ans[quesIndex]) == -1) {
  1834. checkboxScore += item.partScore;
  1835. hasPart = true;
  1836. }
  1837. } else {
  1838. checkboxScore = 0;
  1839. }
  1840. });
  1841. }
  1842. if (!hasPart) {
  1843. item.scoreResult = 0;
  1844. } else {
  1845. lessQuestionNum++;
  1846. item.scoreResult = checkboxScore;
  1847. score += checkboxScore;
  1848. // number++;
  1849. }
  1850. }
  1851. if (item.ques && item.ques.length) {
  1852. doQuestionNum++;
  1853. }
  1854. } else if (item.type == 3) {
  1855. if (item.ques == item.ans) {
  1856. score += item.score;
  1857. number++;
  1858. }
  1859. if (item.ques) {
  1860. doQuestionNum++;
  1861. }
  1862. } else if (item == 4) {
  1863. if (item.ques.length) {
  1864. doQuestionNum++;
  1865. }
  1866. } else if (item.type == 5) {
  1867. if (item.ques) {
  1868. doQuestionNum++;
  1869. }
  1870. }
  1871. });
  1872. if (score >= 60) {
  1873. reportStatus = 1;
  1874. }
  1875. this.$api
  1876. .bankRecordEdit({
  1877. moduleId: this.moduleId || 0,
  1878. chapterId: this.chapterId || 0,
  1879. sectionId: this.sectionId || 0,
  1880. gradeId: this.gradeId,
  1881. courseId: this.courseId,
  1882. orderGoodsId: this.orderGoodsId,
  1883. goodsId: this.goodsId,
  1884. examId: this.id,
  1885. recordId: this.recordId,
  1886. lessQuestionNum: lessQuestionNum,
  1887. performance: score,
  1888. reportStatus: reportStatus,
  1889. status: 1,
  1890. type: this.examType,
  1891. // historyExamJson: JSON.stringify(this.questionList)
  1892. })
  1893. .then((res) => {});
  1894. }
  1895. },
  1896. /**
  1897. * @param {Object} second倒计时过滤器
  1898. */
  1899. countdown(second) {
  1900. if (second) {
  1901. let h = parseInt((second / 60 / 60) % 24); // 计算小时
  1902. let m = parseInt((second / 60) % 60); // 计算分数
  1903. let s = parseInt(second % 60); // 计算当前秒数
  1904. if (h < 10) h = "0" + h;
  1905. if (m < 10) m = "0" + m;
  1906. if (s < 10) s = "0" + s;
  1907. return h + ":" + m + ":" + s;
  1908. } else {
  1909. return "";
  1910. }
  1911. },
  1912. /**
  1913. * 请求题目列表
  1914. */
  1915. goodsQuestionList() {
  1916. this.$api[
  1917. this.doMode == 3 ? "goodsRandomQuestionList" : "goodsQuestionList"
  1918. ]({
  1919. examId: this.id,
  1920. goodsId: this.goodsId,
  1921. orderGoodsId: this.orderGoodsId,
  1922. from: 2,
  1923. }).then(async (res) => {
  1924. if (res.data.code == 500) {
  1925. uni.showModal({
  1926. showCancel: false,
  1927. content: "该试卷暂无题目",
  1928. success: (k) => {
  1929. if (k.confirm) {
  1930. this.isSubmit = true;
  1931. uni.navigateBack();
  1932. }
  1933. },
  1934. });
  1935. return;
  1936. }
  1937. let data = res.data.data;
  1938. if (this.doMode == 3) {
  1939. this.simulateExamId = data.simulateExamId;
  1940. data = data.questionList;
  1941. }
  1942. if (!data.length) {
  1943. this.hideDialog();
  1944. uni.showModal({
  1945. showCancel: false,
  1946. content: "该试卷暂无题目",
  1947. success: function (k) {
  1948. if (k.confirm) {
  1949. uni.navigateBack();
  1950. }
  1951. },
  1952. });
  1953. return;
  1954. }
  1955. this.allTimes = data[0].answerTime * 60;
  1956. this.lastTime = data[0].answerTime && data[0].answerTime * 60;
  1957. data.forEach((item, index) => {
  1958. if (typeof item.jsonStr == "string") {
  1959. item.jsonStr = JSON.parse(item.jsonStr);
  1960. if (item.type == 2) {
  1961. //多选
  1962. item.jsonStr.forEach((str) => {
  1963. str.optionsId = "" + str.optionsId;
  1964. });
  1965. let arr = item.answerQuestion.split(",");
  1966. arr.forEach((a, i) => {
  1967. arr[i] = "" + a;
  1968. });
  1969. item.ans = arr;
  1970. item.analysisContent &&
  1971. (item.analysisContent = item.analysisContent.replace(
  1972. /<img/gi,
  1973. '<img style="max-width:100%;"'
  1974. ));
  1975. item.content &&
  1976. (item.content = item.content.replace(
  1977. /<img/gi,
  1978. '<img style="max-width:100%;"'
  1979. ));
  1980. return;
  1981. } else if (item.type == 5) {
  1982. //简答题
  1983. item.ansText = {
  1984. text: "",
  1985. imageList: [],
  1986. };
  1987. item.ques = {
  1988. text: "",
  1989. imageList: [],
  1990. };
  1991. item.analysisContent &&
  1992. (item.analysisContent = item.analysisContent.replace(
  1993. /<img/gi,
  1994. '<img style="max-width:100%;"'
  1995. ));
  1996. item.content &&
  1997. (item.content = item.content.replace(
  1998. /<img/gi,
  1999. '<img style="max-width:100%;"'
  2000. ));
  2001. } else if (item.type == 4) {
  2002. //案例题
  2003. console.log(item.jsonStr);
  2004. item.ques = [];
  2005. item.current = 0;
  2006. let ansArr = [];
  2007. item.jsonStr.forEach((json, index) => {
  2008. if (json.type == 1) {
  2009. ansArr[index] = json.answerQuestion;
  2010. json.content &&
  2011. (json.content = json.content.replace(
  2012. /<img/gi,
  2013. '<img style="max-width:100%;"'
  2014. ));
  2015. } else if (json.type == 2) {
  2016. json.optionsList.forEach((str) => {
  2017. str.optionsId = "" + str.optionsId;
  2018. });
  2019. let arr = json.answerQuestion.split(",");
  2020. arr.forEach((a, i) => {
  2021. arr[i] = "" + a;
  2022. });
  2023. ansArr[index] = arr;
  2024. json.content &&
  2025. (json.content = json.content.replace(
  2026. /<img/gi,
  2027. '<img style="max-width:100%;"'
  2028. ));
  2029. } else if (json.type == 3) {
  2030. ansArr[index] = json.answerQuestion;
  2031. json.content &&
  2032. (json.content = json.content.replace(
  2033. /<img/gi,
  2034. '<img style="max-width:100%;"'
  2035. ));
  2036. } else if (json.type == 5) {
  2037. ansArr[index] = {
  2038. text: "",
  2039. imageList: [],
  2040. };
  2041. json.ansText = {
  2042. text: "",
  2043. imageList: [],
  2044. };
  2045. json.content &&
  2046. (json.content = json.content.replace(
  2047. /<img/gi,
  2048. '<img style="max-width:100%;"'
  2049. ));
  2050. }
  2051. });
  2052. item.analysisContent &&
  2053. (item.analysisContent = item.analysisContent.replace(
  2054. /<img/gi,
  2055. '<img style="max-width:100%;"'
  2056. ));
  2057. item.content &&
  2058. (item.content = item.content.replace(
  2059. /<img/gi,
  2060. '<img style="max-width:100%;"'
  2061. ));
  2062. item.ans = ansArr;
  2063. return;
  2064. }
  2065. item.content &&
  2066. (item.content = item.content.replace(
  2067. /<img/gi,
  2068. '<img style="max-width:100%;"'
  2069. ));
  2070. item.ans = item.answerQuestion;
  2071. }
  2072. });
  2073. this.questionList = data;
  2074. this.lastCount = this.questionList.length;
  2075. this.getCollectInfo(this.current);
  2076. await this.examRecord();
  2077. });
  2078. },
  2079. /**
  2080. * 记录总题数,获取recordId
  2081. * hasSpecial (是否包含简答和案例) true 包含 false 不包含
  2082. */
  2083. examRecord(hasSpecial) {
  2084. return new Promise((resolve) => {
  2085. let questionList = 0;
  2086. // if(!hasSpecial) {
  2087. this.questionList.forEach((item, index) => {
  2088. if (item.type == 1 || item.type == 2 || item.type == 3) {
  2089. questionList++;
  2090. }
  2091. });
  2092. // } else {
  2093. // questionList = this.questionList.length;
  2094. // }
  2095. this.$api
  2096. .bankRecord({
  2097. courseId: this.courseId,
  2098. // chapterExamId: this.chapterId || 0,
  2099. // moduleExamId: this.moduleId || 0,
  2100. chapterId: this.chapterId || 0,
  2101. moduleId: this.moduleId || 0,
  2102. sectionId: this.sectionId || 0,
  2103. examId: this.id,
  2104. goodsId: this.goodsId,
  2105. orderGoodsId: this.orderGoodsId,
  2106. gradeId: this.gradeId,
  2107. totalQuestionNum: questionList,
  2108. allQuestionNum: this.questionList.length,
  2109. type: this.examType,
  2110. simulateExamId: this.simulateExamId,
  2111. doMode: this.doMode,
  2112. })
  2113. .then((res) => {
  2114. this.recordId = res.data.data;
  2115. if (this.needPhoto) {
  2116. if (!this.learning && this.examType != 2) {
  2117. if (uni.getStorageSync("tabkePhotoShow")) {
  2118. // #ifdef MP-WEIXIN
  2119. this.photoPopup = true; //拍照
  2120. this.isTaking = true;
  2121. // #endif
  2122. // #ifdef H5
  2123. this.isHadCamera();
  2124. // #endif
  2125. } else {
  2126. this.popupPhotoShow = true;
  2127. uni.setStorageSync("tabkePhotoShow", 1); // 本地缓存用来判断是否已经弹出过弹窗
  2128. }
  2129. }
  2130. } else {
  2131. if (this.lastTime) {
  2132. this.timer = setInterval(() => {
  2133. if (this.lastTime <= 0) {
  2134. clearInterval(this.timer);
  2135. uni.showToast({
  2136. icon: "none",
  2137. mask: true,
  2138. title: "考试时间已到,系统将自动交卷",
  2139. duration: 10000,
  2140. });
  2141. this.submit();
  2142. return;
  2143. }
  2144. this.lastTime--;
  2145. }, 1000);
  2146. }
  2147. resolve();
  2148. }
  2149. });
  2150. });
  2151. },
  2152. /**
  2153. * @param {Object} e单选点击
  2154. */
  2155. radioSelect(optionsId, bindex) {
  2156. // if (this.questionList[bindex].ques) return;
  2157. if (this.questionList[bindex].ques && this.bankType == 1) {
  2158. return;
  2159. }
  2160. this.$set(this.questionList[bindex], "ques", optionsId);
  2161. // if ((bindex + 1) < this.questionList.length) {
  2162. // this.current = bindex + 1
  2163. // }
  2164. this.isDoOver();
  2165. },
  2166. /**
  2167. * @param {Object} e案例单选点击
  2168. */
  2169. radioSelectChild(optionsId, ansIndex, bindex) {
  2170. // if (this.questionList[bindex].ques[ansIndex]) return;
  2171. if (this.questionList[bindex].ques[ansIndex] && this.bankType == 1) {
  2172. return;
  2173. }
  2174. this.$set(this.questionList[bindex].ques, ansIndex, optionsId);
  2175. this.isDoOver();
  2176. },
  2177. /**
  2178. * @param {Object} 多选点击
  2179. */
  2180. checkboxSelect(optionsId, bindex, index) {
  2181. if (this.questionList[bindex].ques && this.bankType == 1) {
  2182. return;
  2183. }
  2184. this.$set(
  2185. this.questionList[bindex].jsonStr[index],
  2186. "checked",
  2187. !this.questionList[bindex].jsonStr[index].checked
  2188. );
  2189. },
  2190. /**
  2191. * @param {Object} 案例多选点击
  2192. */
  2193. checkboxSelectChild(bindex, ansIndex, childIndex) {
  2194. if (this.questionList[bindex].ques[ansIndex] && this.bankType == 1) {
  2195. return;
  2196. }
  2197. this.$set(
  2198. this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex],
  2199. "checked",
  2200. !this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex]
  2201. .checked
  2202. );
  2203. },
  2204. isCheckboxChecked(arr) {
  2205. return arr.some((item) => {
  2206. if (item.checked) {
  2207. return true;
  2208. }
  2209. });
  2210. },
  2211. /**
  2212. * @param {Object} 多选确认
  2213. */
  2214. checkboxSubmit(bindex) {
  2215. // if (this.questionList[bindex].ques) return;
  2216. if (this.questionList[bindex].ques && this.bankType == 1) {
  2217. return;
  2218. }
  2219. let arr = [];
  2220. this.questionList[bindex].jsonStr.forEach((item) => {
  2221. if (item.checked) {
  2222. arr.push(item.optionsId);
  2223. }
  2224. });
  2225. if (!arr.length) {
  2226. delete this.questionList[bindex].ques;
  2227. uni.showToast({
  2228. title: "请选择答案",
  2229. icon: "none",
  2230. });
  2231. return;
  2232. }
  2233. this.$set(this.questionList[bindex], "ques", arr);
  2234. this.$u.toast("已确认答案");
  2235. this.isDoOver();
  2236. // let isWrong = this.questionList[bindex].ques.some(
  2237. // (quesItem, quesIndex) => {
  2238. // return (
  2239. // this.questionList[bindex].ques[quesIndex] !=
  2240. // this.questionList[bindex].ans[quesIndex]
  2241. // );
  2242. // }
  2243. // );
  2244. // let isWrong = this.questionList[bindex].ques.some((item, i) => {
  2245. // return this.questionList[bindex].ans.indexOf(item) == -1;
  2246. // })
  2247. },
  2248. /**
  2249. * @param {Object} 案例多选确认
  2250. */
  2251. checkboxSubmitChild(bindex, ansIndex) {
  2252. // if (this.questionList[bindex].ques[ansIndex]) return;
  2253. if (this.questionList[bindex].ques[ansIndex] && this.bankType == 1) {
  2254. return;
  2255. }
  2256. let arr = [];
  2257. this.questionList[bindex].jsonStr[ansIndex].optionsList.forEach(
  2258. (item) => {
  2259. if (item.checked) {
  2260. arr.push(item.optionsId);
  2261. }
  2262. }
  2263. );
  2264. if (!arr.length) {
  2265. delete this.questionList[bindex].ques[ansIndex];
  2266. uni.showToast({
  2267. title: "请选择答案",
  2268. icon: "none",
  2269. });
  2270. return;
  2271. }
  2272. this.$set(this.questionList[bindex].ques, ansIndex, arr);
  2273. this.$u.toast("已确认答案");
  2274. this.isDoOver();
  2275. },
  2276. /**
  2277. * @param {Object} index
  2278. * @param {Object} bindex
  2279. * 判断题
  2280. */
  2281. judgeSelect(index, bindex) {
  2282. // if (this.questionList[bindex].ques) return;
  2283. if (this.questionList[bindex].ques && this.bankType == 1) {
  2284. return;
  2285. }
  2286. this.$set(this.questionList[bindex], "ques", index == 0 ? "1" : "0");
  2287. this.isDoOver();
  2288. },
  2289. /**
  2290. * @param {Object} ansindex
  2291. * @param {Object} childindex
  2292. * @param {Object} bindex
  2293. * 案例判断题
  2294. */
  2295. judgeSelectChild(ansindex, childindex, bindex) {
  2296. // if (this.questionList[bindex].ques[ansindex]) return;
  2297. if (this.questionList[bindex].ques[ansindex] && this.bankType == 1) {
  2298. return;
  2299. }
  2300. this.$set(
  2301. this.questionList[bindex].ques,
  2302. ansindex,
  2303. childindex == 0 ? "1" : "0"
  2304. );
  2305. this.isDoOver();
  2306. },
  2307. openFooterTab() {
  2308. this.show = true;
  2309. },
  2310. hideDialog() {
  2311. this.showDialog = false;
  2312. },
  2313. changeIndex(index) {
  2314. this.current = index;
  2315. },
  2316. swiperChange(e) {
  2317. this.current = e.detail.current;
  2318. this.getCollectInfo(this.current);
  2319. },
  2320. /**
  2321. * @param {Object} current
  2322. * 获取收藏信息
  2323. */
  2324. getCollectInfo(current) {
  2325. this.$api
  2326. .getCollectInfo({
  2327. examId: this.id,
  2328. questionId: this.questionList[current].questionId,
  2329. goodsId: this.goodsId,
  2330. orderGoodsId: this.orderGoodsId,
  2331. })
  2332. .then((res) => {
  2333. if (res.data.code == 500) {
  2334. this.$set(this.collectList, current, false);
  2335. } else if (res.data.code == 200) {
  2336. this.$set(this.collectList, current, res.data.data);
  2337. }
  2338. });
  2339. },
  2340. /**
  2341. * @param {Object} state
  2342. * @param {Object} index
  2343. * 收藏
  2344. */
  2345. collect(state, index) {
  2346. if (!state) {
  2347. this.$api
  2348. .collectQuestion({
  2349. examId: this.id,
  2350. questionId: this.questionList[index].questionId,
  2351. goodsId: this.goodsId || "",
  2352. orderGoodsId: this.orderGoodsId,
  2353. doMode: this.doMode,
  2354. })
  2355. .then((res) => {
  2356. if (res.data.code == 200) {
  2357. this.$set(this.collectList, index, true);
  2358. uni.showToast({
  2359. title: "收藏成功",
  2360. duration: 2000,
  2361. icon: "none",
  2362. });
  2363. this.getCollectInfo(index);
  2364. }
  2365. });
  2366. } else {
  2367. this.$api
  2368. .deleteCollectQuestion(this.collectList[index].collectQuestionId)
  2369. .then((res) => {
  2370. if (res.data.code == 200) {
  2371. this.$set(this.collectList, index, false);
  2372. uni.showToast({
  2373. title: "取消收藏成功",
  2374. duration: 2000,
  2375. icon: "none",
  2376. });
  2377. }
  2378. });
  2379. }
  2380. return;
  2381. },
  2382. pdsubmit() {
  2383. let ansCount = this.questionOverNum(true); //已答题数
  2384. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  2385. //没有答完
  2386. if (this.lastCount !== 0) {
  2387. this.cgType = 6;
  2388. this.showpopups = true;
  2389. return;
  2390. }
  2391. if (this.bankType == 2) {
  2392. if (this.lastTime > 0) {
  2393. let lastTime = this.countdown(this.lastTime);
  2394. uni.showModal({
  2395. title: "提示",
  2396. content: `时间还剩余${lastTime},确定交卷吗?`,
  2397. confirmText: "交卷",
  2398. cancelText: "继续答题",
  2399. success: (res) => {
  2400. if (res.confirm) {
  2401. //确定
  2402. this.submit();
  2403. } else {
  2404. //取消
  2405. }
  2406. },
  2407. });
  2408. return;
  2409. }
  2410. }
  2411. this.submit();
  2412. },
  2413. /**
  2414. * 交卷
  2415. */
  2416. submit(typesubmit) {
  2417. console.log("交卷", typesubmit);
  2418. let score = 0; //计算总分
  2419. let reportStatus = 0;
  2420. let number = 0; //做对的题目数量
  2421. let doQuestionNum = 0; //做过的题目数量
  2422. let allScore = 0; //总分
  2423. let passScore = 0;
  2424. let doWrongQuestionIds = []; //错题和未做题id(客观题)
  2425. let doQuestionIds = []; //做过的题目id
  2426. let rightQuestionIds = []; //做对的题目id
  2427. let lessQuestionNum = 0;
  2428. this.questionList.forEach((item, index) => {
  2429. passScore = item.passScore;
  2430. if (item.type == 1) {
  2431. //正确
  2432. if (item.ques == item.ans) {
  2433. item.scoreResult = item.score;
  2434. score += item.score;
  2435. number++;
  2436. rightQuestionIds.push(item.questionId);
  2437. } else {
  2438. //错误
  2439. item.scoreResult = 0;
  2440. if (item.ques) {
  2441. doWrongQuestionIds.push(item.questionId);
  2442. }
  2443. }
  2444. allScore += item.score;
  2445. if (item.ques) {
  2446. doQuestionNum++;
  2447. doQuestionIds.push(item.questionId);
  2448. }
  2449. } else if (item.type == 2) {
  2450. let isRight =
  2451. item.ans &&
  2452. item.ans.every((quesItem, quesIndex) => {
  2453. if (item.ques) {
  2454. return item.ques[quesIndex] == item.ans[quesIndex];
  2455. } else {
  2456. return false;
  2457. }
  2458. });
  2459. if (isRight) {
  2460. score += item.score;
  2461. number++;
  2462. item.scoreResult = item.score;
  2463. rightQuestionIds.push(item.questionId);
  2464. } else {
  2465. let hasPart = false;
  2466. let checkboxScore = 1; //获取单题总分数
  2467. item.ques &&
  2468. item.ques.forEach((ques, quesIndex) => {
  2469. //选错一个全扣
  2470. if (item.ques) {
  2471. if (item.ans.indexOf(item.ques[quesIndex]) == -1) {
  2472. checkboxScore = 0;
  2473. }
  2474. } else {
  2475. checkboxScore = 0;
  2476. }
  2477. });
  2478. console.log(checkboxScore);
  2479. //没选错
  2480. if (checkboxScore) {
  2481. checkboxScore = 0;
  2482. item.ans.forEach((ans, quesIndex) => {
  2483. //漏选扣一部分,对n题给n X partScore 分
  2484. if (item.ques) {
  2485. if (item.ques.indexOf(item.ans[quesIndex]) != -1) {
  2486. checkboxScore += item.partScore;
  2487. hasPart = true;
  2488. }
  2489. } else {
  2490. checkboxScore = 0;
  2491. }
  2492. });
  2493. }
  2494. if (!hasPart) {
  2495. //0分
  2496. item.scoreResult = 0;
  2497. if (item.ques) {
  2498. doWrongQuestionIds.push(item.questionId);
  2499. }
  2500. } else {
  2501. //部分分
  2502. // number++;
  2503. // doWrongQuestionIds.push(item.questionId);
  2504. lessQuestionNum++;
  2505. item.scoreResult = checkboxScore;
  2506. score += checkboxScore;
  2507. // rightQuestionIds.push(item.questionId)
  2508. }
  2509. }
  2510. allScore += item.score;
  2511. if (item.ques && item.ques.length) {
  2512. doQuestionNum++;
  2513. doQuestionIds.push(item.questionId);
  2514. }
  2515. } else if (item.type == 3) {
  2516. if (item.ques == item.ans) {
  2517. item.scoreResult = item.score;
  2518. score += item.score;
  2519. number++;
  2520. rightQuestionIds.push(item.questionId);
  2521. } else {
  2522. item.scoreResult = 0;
  2523. if (item.ques) {
  2524. doWrongQuestionIds.push(item.questionId);
  2525. }
  2526. }
  2527. allScore += item.score;
  2528. if (item.ques) {
  2529. doQuestionNum++;
  2530. doQuestionIds.push(item.questionId);
  2531. }
  2532. } else if (item.type == 4) {
  2533. allScore += item.score;
  2534. if (item.ques && item.ques.length) {
  2535. doQuestionNum++;
  2536. doQuestionIds.push(item.questionId);
  2537. }
  2538. } else if (item.type == 5) {
  2539. allScore += item.score;
  2540. if (item.ques && (item.ques.imageList || item.ques.text)) {
  2541. doQuestionNum++;
  2542. doQuestionIds.push(item.questionId);
  2543. }
  2544. }
  2545. });
  2546. //大于分及格
  2547. if (score >= passScore) {
  2548. reportStatus = 1;
  2549. } else {
  2550. reportStatus = 0;
  2551. }
  2552. clearInterval(this.timer);
  2553. //交卷
  2554. this.$api
  2555. .bankRecordEdit({
  2556. moduleId: this.moduleId || 0,
  2557. chapterId: this.chapterId || 0,
  2558. sectionId: this.sectionId || 0,
  2559. gradeId: this.gradeId,
  2560. examId: this.id,
  2561. goodsId: this.goodsId,
  2562. orderGoodsId: this.orderGoodsId,
  2563. reportStatus: reportStatus,
  2564. recordId: this.recordId,
  2565. courseId: this.courseId,
  2566. rightQuestionNum: number,
  2567. lessQuestionNum: lessQuestionNum,
  2568. status: 1,
  2569. doQuestionIds: doQuestionIds.join(","),
  2570. rightQuestionIds: rightQuestionIds.join(","),
  2571. doQuestionNum: doQuestionNum,
  2572. performance: score,
  2573. totalScore: allScore,
  2574. type: this.examType,
  2575. examTime: parseInt(this.allTimes),
  2576. doTime: parseInt(this.allTimes) - parseInt(this.lastTime),
  2577. historyExamJson: JSON.stringify(this.questionList),
  2578. })
  2579. .then((res) => {
  2580. this.isSubmit = true;
  2581. if (res.data.code == 200) {
  2582. uni.showToast({
  2583. title: "交卷成功",
  2584. duration: 1000,
  2585. mask: true,
  2586. icon: "none",
  2587. });
  2588. if (!typesubmit) {
  2589. console.log("跳转----");
  2590. setTimeout(() => {
  2591. uni.redirectTo({
  2592. url:
  2593. "/pages2/class/question_report?rightQuestionNum=" +
  2594. number +
  2595. "&doWrongQuestionNum=" +
  2596. doWrongQuestionIds.length +
  2597. "&score=" +
  2598. score +
  2599. "&totalScore=" +
  2600. allScore +
  2601. "&reportStatus=" +
  2602. reportStatus +
  2603. "&lessQuestionNum=" +
  2604. lessQuestionNum +
  2605. "&examId=" +
  2606. this.id +
  2607. "&recordId=" +
  2608. this.recordId +
  2609. "&type=" +
  2610. this.examType +
  2611. "&orderGoodsId=" +
  2612. this.orderGoodsId,
  2613. });
  2614. }, 1000);
  2615. }
  2616. }
  2617. });
  2618. //错题集id提交(客观题)
  2619. this.$api
  2620. .examWrongRecord({
  2621. moduleId: this.moduleId || 0,
  2622. chapterId: this.chapterId || 0,
  2623. sectionId: this.sectionId || 0,
  2624. gradeId: this.gradeId,
  2625. courseId: this.courseId,
  2626. examId: this.id,
  2627. goodsId: this.goodsId,
  2628. orderGoodsId: this.orderGoodsId,
  2629. questionIds: doWrongQuestionIds,
  2630. recordId: this.recordId,
  2631. type: 2, // 视频课程的传2
  2632. doMode: this.doMode,
  2633. })
  2634. .then((res) => {})
  2635. .catch((err) => {});
  2636. },
  2637. /**
  2638. * @param {Object} imgIndex
  2639. * @param {Object} bankIndex
  2640. * 删除简答图片
  2641. */
  2642. deleteImg(imgIndex, bankIndex) {
  2643. this.questionList[bankIndex].ansText.imageList.splice(imgIndex, 1);
  2644. },
  2645. /**
  2646. * @param {Object} imgIndex
  2647. * @param {Object} bankIndex
  2648. * @param {Object} ansIndex
  2649. * 删除案例题简答图片
  2650. */
  2651. deleteImgChild(imgIndex, bankIndex, ansIndex) {
  2652. this.questionList[bankIndex].jsonStr[ansIndex].ansText.imageList.splice(
  2653. imgIndex,
  2654. 1
  2655. );
  2656. },
  2657. /**
  2658. * @param {Object} bankindex
  2659. * 选择上传图片
  2660. */
  2661. chooseImg(bankindex) {
  2662. if (
  2663. this.questionList[bankindex] &&
  2664. this.questionList[bankindex].ansText &&
  2665. this.questionList[bankindex].ansText.imageList.length >= 4
  2666. ) {
  2667. uni.showToast({
  2668. icon: "none",
  2669. title: "最多选择4张",
  2670. });
  2671. return;
  2672. }
  2673. uni.chooseImage({
  2674. count: 1, //默认9
  2675. sizeType: ["compressed"], //可以指定是原图还是压缩图,默认二者都有
  2676. sourceType: ["album", "camera"], //从相册选择
  2677. success: (res) => {
  2678. let self = this;
  2679. // console.log(JSON.stringify(res.tempFilePaths));
  2680. let img = res.tempFilePaths[0];
  2681. uni.getImageInfo({
  2682. src: img,
  2683. success: async (res) => {
  2684. let canvasWidth = res.width; //图片原始长宽
  2685. let canvasHeight = res.height;
  2686. if (canvasWidth > 1000 || canvasHeight > 1000) {
  2687. uni.compressImage({
  2688. src: img,
  2689. quality: 75,
  2690. width: "50%",
  2691. height: "50%",
  2692. success: async (rest) => {
  2693. const dir = await self.uploadFile(rest.tempFilePath, 0);
  2694. this.questionList[bankindex].ansText.imageList.push(dir);
  2695. },
  2696. });
  2697. } else {
  2698. const dir = await self.uploadFile(img, 0);
  2699. this.questionList[bankindex].ansText.imageList.push(dir);
  2700. }
  2701. },
  2702. });
  2703. },
  2704. });
  2705. },
  2706. /**
  2707. * @param {Object} bankindex
  2708. * @param {Object} ansindex
  2709. * 案例题选择上传图片
  2710. */
  2711. chooseImgChild(bankindex, ansindex) {
  2712. uni.chooseImage({
  2713. count: 1, //默认9
  2714. sizeType: ["compressed"], //可以指定是原图还是压缩图,默认二者都有
  2715. sourceType: ["album", "camera"], //从相册选择
  2716. success: (res) => {
  2717. let self = this;
  2718. // console.log(JSON.stringify(res.tempFilePaths));
  2719. let img = res.tempFilePaths[0];
  2720. uni.getImageInfo({
  2721. src: img,
  2722. success: async (res) => {
  2723. let canvasWidth = res.width; //图片原始长宽
  2724. let canvasHeight = res.height;
  2725. if (canvasWidth > 1000 || canvasHeight > 1000) {
  2726. uni.compressImage({
  2727. src: img,
  2728. quality: 75,
  2729. width: "50%",
  2730. height: "50%",
  2731. success: async (rest) => {
  2732. const dir = await self.uploadFile(rest.tempFilePath, 0);
  2733. this.questionList[bankindex].jsonStr[
  2734. ansindex
  2735. ].ansText.imageList.push(dir);
  2736. },
  2737. });
  2738. } else {
  2739. const dir = await self.uploadFile(img, 0);
  2740. this.questionList[bankindex].jsonStr[
  2741. ansindex
  2742. ].ansText.imageList.push(dir);
  2743. }
  2744. },
  2745. });
  2746. },
  2747. });
  2748. },
  2749. /**
  2750. * @param {Object} type
  2751. * @param {Object} bankindex
  2752. * 简答题答案确认
  2753. */
  2754. submitAns(bankindex) {
  2755. console.log(this.questionList[bankindex]);
  2756. if (
  2757. !this.questionList[bankindex].ansText.text &&
  2758. !this.questionList[bankindex].ansText.imageList.length
  2759. ) {
  2760. uni.showToast({
  2761. title: "请输入内容或上传图片",
  2762. duration: 2000,
  2763. icon: "none",
  2764. });
  2765. return;
  2766. }
  2767. this.$set(this.questionList[bankindex], "ques", {
  2768. imageList: this.questionList[bankindex].ansText.imageList,
  2769. text: this.questionList[bankindex].ansText.text,
  2770. });
  2771. this.$u.toast("已确认答案");
  2772. this.isDoOver();
  2773. },
  2774. /**
  2775. * @param {Object} bankindex
  2776. * @param {Object} ansindex
  2777. * 案例题简答答案确认
  2778. */
  2779. submitAnsChild(bankindex, ansindex) {
  2780. if (
  2781. !this.questionList[bankindex].jsonStr[ansindex].ansText.text &&
  2782. !this.questionList[bankindex].jsonStr[ansindex].ansText.imageList.length
  2783. ) {
  2784. uni.showToast({
  2785. title: "请输入内容或上传图片",
  2786. duration: 2000,
  2787. icon: "none",
  2788. });
  2789. return;
  2790. }
  2791. this.$set(this.questionList[bankindex].ques, ansindex, {
  2792. imageList:
  2793. this.questionList[bankindex].jsonStr[ansindex].ansText.imageList,
  2794. text: this.questionList[bankindex].jsonStr[ansindex].ansText.text,
  2795. });
  2796. this.$u.toast("已确认答案");
  2797. this.isDoOver();
  2798. },
  2799. isCheck(item, index) {
  2800. if (this.questionList[index].ques) {
  2801. return true;
  2802. }
  2803. },
  2804. isRight(item, index) {
  2805. //单选
  2806. if (this.questionList[index].ques) {
  2807. if (item.type == 1) {
  2808. return this.questionList[index].ques == this.questionList[index].ans;
  2809. //多选
  2810. } else if (item.type == 2) {
  2811. //每一项都相等
  2812. return this.questionList[index].ans.every((item, i) => {
  2813. return item == this.questionList[index].ques[i];
  2814. });
  2815. //判断
  2816. } else if (item.type == 3) {
  2817. return this.questionList[index].ques == this.questionList[index].ans;
  2818. // } else if (item.type == 5) {
  2819. // if(this.questionList[index].ques.text){
  2820. // return true
  2821. // }else{
  2822. // return false
  2823. // }
  2824. } else {
  2825. return false;
  2826. }
  2827. } else {
  2828. return false;
  2829. }
  2830. },
  2831. right(bankIndex, ansIndex, option) {
  2832. if (
  2833. this.questionList[bankIndex].ques[ansIndex] &&
  2834. this.questionList[bankIndex].ans[ansIndex]
  2835. ) {
  2836. if (
  2837. this.questionList[bankIndex].ques[ansIndex].indexOf(
  2838. option.optionsId
  2839. ) != -1 ||
  2840. this.questionList[bankIndex].ans[ansIndex].indexOf(
  2841. option.optionsId
  2842. ) != -1
  2843. ) {
  2844. return true;
  2845. } else {
  2846. return false;
  2847. }
  2848. } else {
  2849. return false;
  2850. }
  2851. },
  2852. wrong(bankIndex, ansIndex, option) {
  2853. if (
  2854. this.questionList[bankIndex].ques[ansIndex] &&
  2855. this.questionList[bankIndex].ans[ansIndex]
  2856. ) {
  2857. if (
  2858. this.questionList[bankIndex].ques[ansIndex].indexOf(
  2859. option.optionsId
  2860. ) != -1 &&
  2861. this.questionList[bankIndex].ans[ansIndex].indexOf(
  2862. option.optionsId
  2863. ) == -1
  2864. ) {
  2865. return true;
  2866. } else {
  2867. return false;
  2868. }
  2869. } else {
  2870. return false;
  2871. }
  2872. },
  2873. isWrong(item, index) {
  2874. if (this.questionList[index].ques) {
  2875. //单选
  2876. if (item.type == 1) {
  2877. return this.questionList[index].ques != this.questionList[index].ans;
  2878. //多选
  2879. } else if (item.type == 2) {
  2880. //每一项都相等
  2881. return this.questionList[index].ques.some((item, i) => {
  2882. return this.questionList[index].ans.indexOf(item) == -1;
  2883. });
  2884. //判断
  2885. } else if (item.type == 3) {
  2886. return this.questionList[index].ques != this.questionList[index].ans;
  2887. } else {
  2888. return false;
  2889. }
  2890. } else {
  2891. return false;
  2892. }
  2893. },
  2894. isPart(item, index) {
  2895. if (this.questionList[index].ques) {
  2896. if (item.type == 2) {
  2897. let isWrong = this.questionList[index].ques.some((item, i) => {
  2898. return this.questionList[index].ans.indexOf(item) == -1;
  2899. });
  2900. let isRight = this.questionList[index].ans.every((item, i) => {
  2901. return item == this.questionList[index].ques[i];
  2902. });
  2903. if (!isRight && !isWrong) {
  2904. return true;
  2905. }
  2906. }
  2907. } else {
  2908. return false;
  2909. }
  2910. },
  2911. isOver(item, index) {
  2912. if (this.questionList[index].ques) {
  2913. if (item.type == 4) {
  2914. //案例题
  2915. let isOver = item.jsonStr.every((jsonItem, indexs) => {
  2916. if (
  2917. jsonItem.type == 1 ||
  2918. jsonItem.type == 2 ||
  2919. jsonItem.type == 3
  2920. ) {
  2921. if (item.ques[indexs]) {
  2922. return true;
  2923. } else {
  2924. return false;
  2925. }
  2926. } else if (jsonItem.type == 5) {
  2927. if (
  2928. item.ques[indexs] &&
  2929. (item.ques[indexs].text || item.ques[indexs].imageList.length)
  2930. ) {
  2931. console.log("chil");
  2932. return true;
  2933. } else {
  2934. return false;
  2935. }
  2936. }
  2937. });
  2938. if (isOver) {
  2939. return true;
  2940. } else {
  2941. return false;
  2942. }
  2943. } else if (item.type == 5) {
  2944. //简答题
  2945. //每一项都相等
  2946. if (item.ques && (item.ques.imageList.length || item.ques.text)) {
  2947. return true;
  2948. }
  2949. //判断
  2950. } else {
  2951. return false;
  2952. }
  2953. } else {
  2954. return false;
  2955. }
  2956. },
  2957. tabSelect(index, bankindex) {
  2958. this.$set(this.questionList[bankindex], "current", index);
  2959. },
  2960. /**
  2961. * 退出全屏
  2962. */
  2963. exitFullscreen() {
  2964. try {
  2965. var de = document;
  2966. // console.log(de);
  2967. if (de.exitFullscreen) {
  2968. de.exitFullscreen();
  2969. } else if (de.mozCancelFullScreen) {
  2970. de.mozCancelFullScreen();
  2971. } else if (de.webkitCancelFullScreen) {
  2972. de.webkitCancelFullScreen();
  2973. }
  2974. } catch (err) {}
  2975. },
  2976. fullele() {
  2977. return (
  2978. document.fullscreenElement ||
  2979. document.webkitFullscreenElement ||
  2980. document.msFullscreenElement ||
  2981. document.mozFullScreenElement ||
  2982. null
  2983. );
  2984. },
  2985. //判断是否全屏
  2986. isFullScreen() {
  2987. return !!(document.webkitIsFullScreen || this.fullele());
  2988. },
  2989. getUserMedia(constraints, success, error) {
  2990. console.log("getUserMedia===", constraints, "success:", success);
  2991. if (window.navigator.mediaDevices.getUserMedia) {
  2992. // 最新的标准API
  2993. window.navigator.mediaDevices
  2994. .getUserMedia(constraints)
  2995. .then(success)
  2996. .catch(error);
  2997. } else if (window.navigator.webkitGetUserMedia) {
  2998. // webkit核心浏览器
  2999. window.navigator.webkitGetUserMedia(constraints, success, error);
  3000. } else if (window.navigator.mozGetUserMedia) {
  3001. // firfox浏览器
  3002. window.navigator.mozGetUserMedia(constraints, success, error);
  3003. } else if (window.navigator.getUserMedia) {
  3004. // 旧版API
  3005. window.navigator.getUserMedia(constraints, success, error);
  3006. }
  3007. },
  3008. photographSuccess(stream) {
  3009. console.log("有摄像头---", stream);
  3010. this.photoPopup = true;
  3011. this.isTaking = true;
  3012. this.$nextTick(() => {
  3013. const video = document.querySelector("video");
  3014. console.log("video:", video);
  3015. video.srcObject = stream;
  3016. video.play();
  3017. });
  3018. },
  3019. photographError(err) {
  3020. console.log("没有摄像头:", err);
  3021. uni.showModal({
  3022. title: "提示",
  3023. content:
  3024. "课程学习需要开启摄像头进行拍照,经检测您的设备无摄像头可使用,请检测环境是否支持。",
  3025. cancelText: "取消",
  3026. confirmText: "确定",
  3027. success: (res) => {
  3028. if (res.confirm) {
  3029. uni.navigateBack();
  3030. } else if (res.cancel) {
  3031. }
  3032. },
  3033. });
  3034. },
  3035. },
  3036. };
  3037. </script>
  3038. <style lang="scss" scoped>
  3039. .photoBox {
  3040. width: 100%;
  3041. // background-color: #ffffff;
  3042. // border-radius: 24px 24px 0px 0px;
  3043. .photoTop {
  3044. width: 100%;
  3045. height: 74rpx;
  3046. border-radius: 20px 20px 0px 0px;
  3047. background-color: #ffffff;
  3048. display: flex;
  3049. align-items: center;
  3050. justify-content: center;
  3051. padding: 0rpx 38rpx;
  3052. .sqzz {
  3053. width: 28rpx;
  3054. height: 28rpx;
  3055. display: flex;
  3056. align-items: center;
  3057. justify-content: center;
  3058. }
  3059. .centersq {
  3060. color: #333;
  3061. font-size: 30rpx;
  3062. font-weight: 500;
  3063. }
  3064. }
  3065. .photoCenter {
  3066. width: 750rpx;
  3067. height: 75vh;
  3068. position: relative;
  3069. .center_camera {
  3070. width: 100%;
  3071. height: 75vh;
  3072. position: fixed;
  3073. .head_take {
  3074. width: 100%;
  3075. height: 75vh;
  3076. display: flex;
  3077. flex-direction: column;
  3078. }
  3079. .headTake_up {
  3080. width: 100%;
  3081. height: 100rpx;
  3082. }
  3083. .headTake_minddle {
  3084. display: flex;
  3085. .min_img {
  3086. width: 500rpx;
  3087. height: 550rpx;
  3088. }
  3089. .min_left,
  3090. .min_right {
  3091. flex: 1;
  3092. height: 550rpx;
  3093. }
  3094. }
  3095. .headTake_down {
  3096. width: 100%;
  3097. flex: 1;
  3098. }
  3099. .color {
  3100. background-color: #333;
  3101. opacity: 0.5;
  3102. }
  3103. .photo_v {
  3104. width: 100%;
  3105. height: 100%;
  3106. }
  3107. .mask {
  3108. width: 500rpx;
  3109. height: 550rpx;
  3110. position: absolute;
  3111. top: 100rpx;
  3112. left: 0;
  3113. right: 0;
  3114. bottom: 0;
  3115. margin: 0 auto;
  3116. box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.4);
  3117. }
  3118. }
  3119. .custom {
  3120. width: 750rpx;
  3121. height: 75vh;
  3122. position: absolute;
  3123. z-index: 1000;
  3124. top: 0;
  3125. left: 0;
  3126. image {
  3127. width: 100%;
  3128. height: 100%;
  3129. }
  3130. }
  3131. }
  3132. .photoBoxbtns {
  3133. display: flex;
  3134. .takePhoto_btn {
  3135. width: 100%;
  3136. display: flex;
  3137. align-items: center;
  3138. justify-content: space-between;
  3139. background: #a9a7a9;
  3140. padding: 40rpx 26rpx;
  3141. .middle_btn {
  3142. width: 120rpx;
  3143. height: 120rpx;
  3144. border-radius: 40rpx;
  3145. border: 4rpx solid #ffffff;
  3146. display: flex;
  3147. align-items: center;
  3148. justify-content: center;
  3149. }
  3150. .square {
  3151. width: 96rpx;
  3152. height: 96rpx;
  3153. background: #ffffff;
  3154. border-radius: 28rpx;
  3155. }
  3156. .rights {
  3157. font-size: 32rpx;
  3158. font-weight: 500;
  3159. color: #ffffff;
  3160. }
  3161. }
  3162. .btnResult {
  3163. height: 100rpx;
  3164. width: 100%;
  3165. background-color: #07c160;
  3166. text-align: center;
  3167. line-height: 100rpx;
  3168. color: #fff;
  3169. font-size: 32rpx;
  3170. font-weight: bold;
  3171. }
  3172. }
  3173. }
  3174. .navbar {
  3175. position: relative;
  3176. z-index: 20000;
  3177. }
  3178. .questionBank {
  3179. width: 100%;
  3180. height: 100vh;
  3181. display: flex;
  3182. flex-direction: column;
  3183. }
  3184. .swiper {
  3185. width: 100%;
  3186. flex: 1;
  3187. }
  3188. .lisSty {
  3189. margin-bottom: 16rpx;
  3190. display: flex;
  3191. .flex_auto {
  3192. flex: 1;
  3193. word-break: break-all;
  3194. }
  3195. }
  3196. .activeTI {
  3197. vertical-align: middle;
  3198. display: inline-block;
  3199. border: 1rpx solid #eee;
  3200. border-radius: 50rpx;
  3201. height: 48rpx;
  3202. line-height: 46rpx;
  3203. text-align: center;
  3204. width: 48rpx;
  3205. margin-right: 15rpx;
  3206. color: #666;
  3207. font-size: 30rpx;
  3208. &.right {
  3209. color: #fff;
  3210. background: #36c75a;
  3211. }
  3212. &.wrong {
  3213. color: #fff;
  3214. background: #ff3b30;
  3215. }
  3216. &.checked,
  3217. &.user_choose {
  3218. color: #fff;
  3219. background: #007aff;
  3220. }
  3221. }
  3222. .submit_checkbox {
  3223. position: fixed;
  3224. left: 0;
  3225. right: 0;
  3226. bottom: 120rpx;
  3227. margin: 20rpx auto;
  3228. width: 526rpx;
  3229. height: 80rpx;
  3230. background: rgba(0, 122, 255, 1);
  3231. color: #fff;
  3232. text-align: center;
  3233. line-height: 80rpx;
  3234. font-size: 30rpx;
  3235. border-radius: 40rpx;
  3236. &.disabled {
  3237. opacity: 0.6;
  3238. }
  3239. }
  3240. .titles {
  3241. overflow: hidden;
  3242. margin-bottom: 24rpx;
  3243. }
  3244. .titBox {
  3245. padding: 41rpx 25rpx 24rpx 25rpx;
  3246. }
  3247. .titBox_title {
  3248. padding: 21rpx;
  3249. }
  3250. .tabs {
  3251. margin: 10rpx;
  3252. display: flex;
  3253. .tab {
  3254. margin: 0 4rpx;
  3255. padding: 10rpx 13rpx;
  3256. text-align: center;
  3257. color: #007aff;
  3258. font-size: 28rpx;
  3259. border-radius: 16rpx;
  3260. background: #fff;
  3261. &.current {
  3262. color: #fff;
  3263. background: #007aff;
  3264. }
  3265. }
  3266. }
  3267. .ans {
  3268. margin: 8rpx 8rpx 8rpx;
  3269. .ans_input {
  3270. border-radius: 16rpx;
  3271. background: #fff;
  3272. .top {
  3273. border-bottom: 1rpx solid #eeeeee;
  3274. padding: 16rpx;
  3275. display: flex;
  3276. align-items: center;
  3277. .icon {
  3278. margin-right: 20rpx;
  3279. width: 40rpx;
  3280. height: 38rpx;
  3281. }
  3282. .progress {
  3283. flex: 1;
  3284. }
  3285. .submit {
  3286. width: 168rpx;
  3287. height: 48rpx;
  3288. line-height: 48rpx;
  3289. text-align: center;
  3290. color: #fff;
  3291. font-size: 30rpx;
  3292. background: #007aff;
  3293. border-radius: 24rpx;
  3294. &.disabled {
  3295. opacity: 0.6;
  3296. }
  3297. }
  3298. }
  3299. .textarea {
  3300. textarea {
  3301. width: 100%;
  3302. height: 287rpx;
  3303. padding: 10rpx;
  3304. }
  3305. }
  3306. .imgs {
  3307. overflow: hidden;
  3308. display: flex;
  3309. width: 100%;
  3310. .img {
  3311. width: 104rpx;
  3312. height: 104rpx;
  3313. border-radius: 8rpx;
  3314. position: relative;
  3315. margin: 20rpx;
  3316. text {
  3317. position: absolute;
  3318. right: -15rpx;
  3319. top: -15rpx;
  3320. width: 30rpx;
  3321. height: 30rpx;
  3322. text-align: center;
  3323. line-height: 30rpx;
  3324. color: #fff;
  3325. background: #ff3b30;
  3326. border-radius: 50%;
  3327. }
  3328. image {
  3329. width: 100%;
  3330. height: 100%;
  3331. }
  3332. }
  3333. }
  3334. }
  3335. .ans_submit {
  3336. padding: 16rpx;
  3337. border-radius: 16rpx;
  3338. background: #fff;
  3339. .imgs {
  3340. overflow: hidden;
  3341. display: flex;
  3342. width: 100%;
  3343. .img {
  3344. width: 104rpx;
  3345. height: 104rpx;
  3346. border-radius: 8rpx;
  3347. position: relative;
  3348. margin: 20rpx;
  3349. image {
  3350. width: 100%;
  3351. height: 100%;
  3352. }
  3353. }
  3354. }
  3355. }
  3356. }
  3357. .leftLetters {
  3358. display: flex;
  3359. align-items: center;
  3360. width: 220rpx;
  3361. .btnType {
  3362. padding: 5rpx 10rpx;
  3363. border: 1rpx solid #007aff;
  3364. border-radius: 10rpx;
  3365. background-color: rgba(0, 122, 255, 0.1);
  3366. font-size: 28rpx;
  3367. color: #007aff;
  3368. margin-right: 15rpx;
  3369. }
  3370. }
  3371. .firstLetter {
  3372. display: flex;
  3373. justify-content: space-between;
  3374. align-items: center;
  3375. margin-bottom: 30rpx;
  3376. }
  3377. .popupView {
  3378. height: 100%;
  3379. padding-bottom: 100rpx;
  3380. .popupTops {
  3381. height: 77rpx;
  3382. border-bottom: 1rpx solid #eee;
  3383. text-align: center;
  3384. line-height: 77rpx;
  3385. font-size: 24rpx;
  3386. color: #999;
  3387. position: relative;
  3388. .topIcon {
  3389. position: absolute;
  3390. top: 10rpx;
  3391. left: 50%;
  3392. transform: translateX(-50%);
  3393. width: 80rpx;
  3394. height: 8rpx;
  3395. background-color: #999;
  3396. border-radius: 4rpx;
  3397. }
  3398. }
  3399. .popupContent {
  3400. }
  3401. }
  3402. .pageContent {
  3403. position: relative;
  3404. background-color: #eaeef1;
  3405. height: 100%;
  3406. padding-top: 8rpx;
  3407. padding-bottom: 100rpx;
  3408. overflow-y: scroll;
  3409. }
  3410. .pad_8 {
  3411. background-color: #fff;
  3412. margin: 0rpx 8rpx 8rpx;
  3413. border-radius: 16rpx;
  3414. &.no-margin {
  3415. margin-top: -16rpx;
  3416. border-radius: 0 0 16rpx 16rpx;
  3417. }
  3418. }
  3419. .answer {
  3420. height: 80rpx;
  3421. line-height: 80rpx;
  3422. padding: 0rpx 24rpx;
  3423. display: flex;
  3424. align-items: center;
  3425. justify-content: space-between;
  3426. color: #666;
  3427. font-size: 30rpx;
  3428. }
  3429. .footer_btn {
  3430. background-color: #fff;
  3431. z-index: 10078;
  3432. position: fixed;
  3433. bottom: 0rpx;
  3434. display: flex;
  3435. align-items: center;
  3436. justify-content: space-between;
  3437. width: 100%;
  3438. height: 98rpx;
  3439. padding: 0rpx 38rpx;
  3440. border-top: 1rpx solid #eee;
  3441. .flex_center {
  3442. flex: 1;
  3443. display: flex;
  3444. justify-content: center;
  3445. align-items: center;
  3446. flex-direction: column;
  3447. margin: 0 200rpx;
  3448. font-size: 24rpx;
  3449. color: #999999;
  3450. .up-icon {
  3451. margin-bottom: 18rpx;
  3452. width: 100%;
  3453. display: flex;
  3454. justify-content: center;
  3455. image {
  3456. width: 58rpx;
  3457. height: 21rpx;
  3458. }
  3459. }
  3460. }
  3461. .collect {
  3462. visibility: hidden;
  3463. width: 100rpx;
  3464. &.show {
  3465. visibility: visible;
  3466. }
  3467. > view {
  3468. display: flex;
  3469. flex-direction: column;
  3470. align-items: center;
  3471. justify-content: center;
  3472. image {
  3473. width: 32rpx;
  3474. height: 32rpx;
  3475. margin-bottom: 6rpx;
  3476. }
  3477. view {
  3478. font-size: 24rpx;
  3479. color: #999999;
  3480. }
  3481. }
  3482. }
  3483. }
  3484. .boxSty {
  3485. padding: 44rpx 41rpx 0rpx;
  3486. }
  3487. .liListSty {
  3488. border: 1rpx solid #eeeeee;
  3489. width: 88rpx;
  3490. height: 88rpx;
  3491. border-radius: 32rpx;
  3492. text-align: center;
  3493. line-height: 88rpx;
  3494. color: #333;
  3495. font-size: 32rpx;
  3496. float: left;
  3497. margin: 20rpx 23rpx;
  3498. &.isRight {
  3499. border: 1rpx solid #eeeeee;
  3500. color: #fff;
  3501. background: #36c75a;
  3502. }
  3503. &.isWrong {
  3504. border: 1rpx solid #eeeeee;
  3505. color: #fff;
  3506. background: #ff3b30;
  3507. }
  3508. &.isPart {
  3509. border: 1rpx solid #eeeeee;
  3510. color: #fff;
  3511. background: #ffc53d;
  3512. }
  3513. &.isOver {
  3514. border: 1rpx solid #eeeeee;
  3515. color: #fff;
  3516. background: blue;
  3517. }
  3518. &.check_ans {
  3519. border: 1rpx solid #eeeeee;
  3520. color: #fff;
  3521. background: #007aff;
  3522. }
  3523. }
  3524. .answerInfos {
  3525. padding: 25rpx 25rpx 25rpx 23rpx;
  3526. }
  3527. .answerTitle {
  3528. margin-bottom: 28rpx;
  3529. color: #666;
  3530. font-size: 30rpx;
  3531. }
  3532. .answerContent {
  3533. font-size: 30rpx;
  3534. color: #666;
  3535. }
  3536. .textChild {
  3537. display: inline-block;
  3538. vertical-align: middle;
  3539. }
  3540. .dialog {
  3541. position: fixed;
  3542. left: 0;
  3543. top: 0;
  3544. width: 100%;
  3545. height: 100%;
  3546. background-color: rgba(0, 0, 0, 0.8);
  3547. display: flex;
  3548. flex-direction: column;
  3549. align-items: center;
  3550. justify-content: center;
  3551. z-index: 20000;
  3552. .text {
  3553. font-size: 32rpx;
  3554. color: #ffffff;
  3555. text-align: center;
  3556. }
  3557. .btn {
  3558. width: 242rpx;
  3559. height: 82rpx;
  3560. border: 2rpx solid #ffffff;
  3561. border-radius: 16rpx;
  3562. text-align: center;
  3563. line-height: 82rpx;
  3564. margin: 41rpx auto;
  3565. color: #fff;
  3566. font-size: 32rpx;
  3567. }
  3568. }
  3569. .dialog-arrow {
  3570. padding-top: 124rpx;
  3571. position: fixed;
  3572. left: 0;
  3573. top: 0;
  3574. width: 100%;
  3575. height: 100%;
  3576. background-color: rgba(0, 0, 0, 0.8);
  3577. z-index: 20000;
  3578. .pointer {
  3579. margin-left: 87rpx;
  3580. display: block;
  3581. width: 95rpx;
  3582. height: 98rpx;
  3583. }
  3584. .text {
  3585. padding-left: 177rpx;
  3586. font-size: 32rpx;
  3587. color: #ffffff;
  3588. }
  3589. .btn {
  3590. width: 242rpx;
  3591. height: 82rpx;
  3592. border: 2rpx solid #ffffff;
  3593. border-radius: 16rpx;
  3594. text-align: center;
  3595. line-height: 82rpx;
  3596. margin: 500rpx auto 0;
  3597. color: #fff;
  3598. font-size: 32rpx;
  3599. }
  3600. }
  3601. .dialog_wrap {
  3602. position: fixed;
  3603. left: 0;
  3604. top: 0;
  3605. width: 100%;
  3606. height: 100%;
  3607. z-index: 9999999999;
  3608. .bg {
  3609. background: rgba(0, 0, 0, 0.3);
  3610. position: absolute;
  3611. left: 0;
  3612. top: 0;
  3613. width: 100%;
  3614. height: 100%;
  3615. }
  3616. .dialog {
  3617. position: absolute;
  3618. left: 50%;
  3619. top: 50%;
  3620. transform: translate3D(-50%, -50%, 0);
  3621. width: 640rpx;
  3622. height: 439rpx;
  3623. background: #ffffff;
  3624. border-radius: 24rpx;
  3625. .title {
  3626. font-size: 30rpx;
  3627. font-weight: bold;
  3628. color: #333333;
  3629. line-height: 48rpx;
  3630. text-align: center;
  3631. margin-top: 40rpx;
  3632. }
  3633. .content {
  3634. margin: 35rpx 35rpx 0;
  3635. font-size: 30rpx;
  3636. color: #666666;
  3637. line-height: 48rpx;
  3638. }
  3639. .btns {
  3640. margin-top: 35rpx;
  3641. display: flex;
  3642. align-items: center;
  3643. justify-content: center;
  3644. .btn {
  3645. width: 200rpx;
  3646. height: 80rpx;
  3647. line-height: 80rpx;
  3648. text-align: center;
  3649. background: #f5f5f5;
  3650. border-radius: 40rpx;
  3651. font-size: 30rpx;
  3652. color: rgba(0, 122, 255, 1);
  3653. background: #f5f5f5;
  3654. margin: 0 20rpx;
  3655. &.active {
  3656. color: #f5f5f5;
  3657. background: rgba(0, 122, 255, 1);
  3658. }
  3659. }
  3660. }
  3661. }
  3662. }
  3663. .popboxs {
  3664. width: 100%;
  3665. height: 100%;
  3666. display: flex;
  3667. flex-direction: column;
  3668. align-items: center;
  3669. }
  3670. .classTops {
  3671. flex-shrink: 0;
  3672. padding: 39rpx 0rpx 4rpx;
  3673. font-weight: bold;
  3674. color: #333;
  3675. font-size: 30rpx;
  3676. }
  3677. .textStys {
  3678. width: 100%;
  3679. flex: 1;
  3680. padding: 36rpx;
  3681. }
  3682. .classFootsty {
  3683. flex-shrink: 0;
  3684. display: flex;
  3685. align-items: center;
  3686. justify-content: center;
  3687. padding: 10rpx 0rpx 40rpx;
  3688. .btnsty {
  3689. width: 200rpx;
  3690. height: 80rpx;
  3691. border-radius: 40rpx;
  3692. font-weight: bold;
  3693. font-size: 30rpx;
  3694. text-align: center;
  3695. line-height: 80rpx;
  3696. }
  3697. .btns1 {
  3698. background-color: #f5f5f5;
  3699. color: #007aff;
  3700. }
  3701. .btns2 {
  3702. margin-left: 40rpx;
  3703. background-color: #007aff;
  3704. color: #ffffff;
  3705. }
  3706. }
  3707. </style>