questionBank.vue 109 KB

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