questionBank.vue 84 KB

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