questionBank.vue 109 KB

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