questionBank.vue 98 KB

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