questionBank.vue 110 KB

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