questionBank.vue 98 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406
  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="examType != 2 && 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. console.log('examType:', this.examType)
  888. this.id = option.id;
  889. this.goodsId = option.goodsid;
  890. this.chapterId = option.chapterId;
  891. this.courseId = option.courseId;
  892. this.sectionId = option.sectionId
  893. this.moduleId = option.moduleId;
  894. this.isFromVideo = option.isFromVideo || "";
  895. this.gradeId = option.gradeId || "";
  896. this.orderGoodsId = Number(option.orderGoodsId);
  897. this.learning = option.learning
  898. console.log('learning:', this.learning)
  899. let isBack = option.isback;
  900. let showDialog = uni.getStorageSync("showDialog");
  901. if (showDialog) {
  902. this.showDialog = false;
  903. } else {
  904. this.showDialog = true;
  905. this.originShowDialog = true
  906. uni.setStorageSync("showDialog", "1");
  907. }
  908. //考试时候用手势或者返回键 被迫返回做题
  909. if (isBack) {
  910. console.log(getApp());
  911. let app = getApp();
  912. let globalData = app.globalData;
  913. for (var k in globalData.bankData) {
  914. this[k] = globalData.bankData[k];
  915. }
  916. this.showArrow = true;
  917. //需要拍没拍过直接弹出摄像头
  918. if (this.needPhoto && !this.isTakePhoto) {
  919. if (this.learning != 1) {
  920. this.photoPopup = true;
  921. this.isTaking = true;
  922. this.avatarUrl = "";
  923. }
  924. } else {
  925. //不需要拍照
  926. if (this.lastTime) {
  927. this.timer = setInterval(() => {
  928. if (this.lastTime <= 0) {
  929. clearInterval(this.timer);
  930. uni.showToast({
  931. icon: "none",
  932. mask: true,
  933. title: "考试时间已到,系统将自动交卷",
  934. duration: 10000,
  935. });
  936. this.submit();
  937. return;
  938. }
  939. this.lastTime--;
  940. }, 1000);
  941. }
  942. }
  943. } else {
  944. await this.getGoodsDetail();
  945. // 请求题目列表
  946. this.goodsQuestionList();
  947. this.bankExam();
  948. }
  949. },
  950. onUnload() {
  951. if (this.isSubmit) {
  952. clearInterval(this.timer);
  953. return;
  954. }
  955. if (this.needPhoto && !this.isTakePhoto) {
  956. return;
  957. }
  958. //考试试卷 阻止ios手势返回,自动跳回答题页
  959. if (this.needBack) {
  960. let app = getApp();
  961. app.globalData.bankData = this.$data;
  962. clearInterval(this.timer);
  963. uni.navigateTo({
  964. url:
  965. "/pages2/class/questionBank?id=" +
  966. this.id +
  967. "&goodsid=" +
  968. this.goodsId +
  969. "&isback=true&orderGoodsId=" +
  970. this.orderGoodsId,
  971. });
  972. } else {
  973. //点击返回按钮确认允许退出,交卷
  974. clearInterval(this.timer);
  975. this.examRecordEdit();
  976. }
  977. },
  978. methods: {
  979. getGoodsDetail() {
  980. return new Promise((resolve) => {
  981. let self = this;
  982. this.$api.goodsDetail(this.goodsId).then((res) => {
  983. self.goodsDetail = res.data.data;
  984. if (self.goodsDetail.goodsPhotoExamConfig) {
  985. let goodsPhotoExamConfig = JSON.parse(
  986. self.goodsDetail.goodsPhotoExamConfig
  987. );
  988. if (goodsPhotoExamConfig.photograph > 0) {
  989. self.needPhoto = true;
  990. }
  991. }
  992. resolve();
  993. });
  994. });
  995. },
  996. reTake() {
  997. this.isTaking = true;
  998. },
  999. postStudyRecord() {
  1000. let self = this;
  1001. let data = {
  1002. photo: self.ossAvatarUrl,
  1003. recordId: self.recordId,
  1004. };
  1005. if (this.ossAvatarUrl) {
  1006. data.similarity = this.compareFaceData // 相似度
  1007. }
  1008. // console.log(data, "拍照提交");
  1009. this.$api.studyExamPhotoRecord(data).then((res) => {
  1010. // console.log(res, "拍照提交结果");
  1011. if (res.data.code != 200) {
  1012. uni.showToast({
  1013. icon: "none",
  1014. mask: true,
  1015. title: res.data.msg,
  1016. duration: 10000,
  1017. });
  1018. return;
  1019. }
  1020. self.ossAvatarUrl = "";
  1021. self.isTakePhoto = true;
  1022. //拍照
  1023. if (this.lastTime) {
  1024. this.timer = setInterval(() => {
  1025. if (this.lastTime <= 0) {
  1026. clearInterval(this.timer);
  1027. uni.showToast({
  1028. icon: "none",
  1029. mask: true,
  1030. title: "考试时间已到,系统将自动交卷",
  1031. duration: 10000,
  1032. });
  1033. this.submit();
  1034. return;
  1035. }
  1036. this.lastTime--;
  1037. }, 1000);
  1038. }
  1039. });
  1040. },
  1041. uploadFile(options, int) {
  1042. var self = this;
  1043. return new Promise((resolve, reject) => {
  1044. var data = {
  1045. imageStatus: int,
  1046. gradeId: this.gradeId,
  1047. };
  1048. self.$api.aliyunpolicy(data).then((res) => {
  1049. if (res.data.code != 200) {
  1050. self.$method.showToast("签名错误" + JSON.stringify(res.data));
  1051. return;
  1052. }
  1053. var ossToken = res.data.data.resultContent;
  1054. if (ossToken.host == null || ossToken.host == undefined) {
  1055. self.$method.showToast("上传路径报错" + JSON.stringify(res.data));
  1056. return;
  1057. }
  1058. uni.uploadFile({
  1059. url: ossToken.host,
  1060. name: "file",
  1061. filePath: options,
  1062. fileType: "image",
  1063. header: {
  1064. AuthorizationToken: "WX " + uni.getStorageSync("token"),
  1065. },
  1066. formData: {
  1067. key: ossToken.dir,
  1068. OSSAccessKeyId: ossToken.accessid,
  1069. policy: ossToken.policy,
  1070. Signature: ossToken.signature,
  1071. callback: ossToken.callback,
  1072. success_action_status: 200,
  1073. },
  1074. success: (result) => {
  1075. // if (result.statusCode === 200) {
  1076. self.ossAvatarUrl = ossToken.dir;
  1077. resolve(ossToken.dir);
  1078. // } else {
  1079. // uni.showToast({
  1080. // title: "上传失败",
  1081. // icon: "none",
  1082. // });
  1083. // return;
  1084. // }
  1085. },
  1086. fail: (error) => {
  1087. uni.showToast({
  1088. title: "上传接口报错" + error,
  1089. icon: "none",
  1090. });
  1091. return;
  1092. },
  1093. });
  1094. });
  1095. });
  1096. },
  1097. imageInfos() {
  1098. var self = this;
  1099. return new Promise((resolve, reject) => {
  1100. uni.getImageInfo({
  1101. src: self.avatarUrl,
  1102. success: async (res) => {
  1103. let canvasWidth = res.width; //图片原始长宽
  1104. let canvasHeight = res.height;
  1105. if (canvasWidth > 2000 || canvasHeight > 2000) {
  1106. uni.compressImage({
  1107. src: self.avatarUrl,
  1108. quality: 75,
  1109. width: "35%",
  1110. height: "35%",
  1111. success: async (rest) => {
  1112. const waitUpload = await self.uploadFile(
  1113. rest.tempFilePath,
  1114. 0
  1115. );
  1116. resolve(waitUpload);
  1117. },
  1118. });
  1119. } else if (canvasWidth > 1000 || canvasHeight > 1000) {
  1120. uni.compressImage({
  1121. src: self.avatarUrl,
  1122. quality: 75,
  1123. width: "50%",
  1124. height: "50%",
  1125. success: async (rest) => {
  1126. const waitUpload = await self.uploadFile(
  1127. rest.tempFilePath,
  1128. 0
  1129. );
  1130. resolve(waitUpload);
  1131. },
  1132. });
  1133. } else {
  1134. console.log("无需压缩");
  1135. const waitUpload = await self.uploadFile(self.avatarUrl, 0);
  1136. resolve(waitUpload);
  1137. }
  1138. },
  1139. });
  1140. });
  1141. },
  1142. /**
  1143. * 人脸匹配
  1144. */
  1145. faceRecognition() {
  1146. return new Promise((resolve) => {
  1147. let fileSystem = uni.getFileSystemManager();
  1148. fileSystem.readFile({
  1149. filePath: `${this.avatarUrl}`,
  1150. encoding: "base64",
  1151. position: 0,
  1152. success: (res) => {
  1153. let base64 = "data:image/jpg;base64," + res.data;
  1154. this.$api
  1155. .faceCertificationCompareFace({
  1156. imageA: base64,
  1157. orderGoodsId: this.orderGoodsId,
  1158. gradeId: this.gradeId,
  1159. })
  1160. .then((res) => {
  1161. resolve(res.data.data);
  1162. });
  1163. },
  1164. fail(err) {
  1165. console.error(err, "err");
  1166. },
  1167. });
  1168. });
  1169. },
  1170. async submitPhoto() {
  1171. let compareFaceData = await this.faceRecognition();
  1172. this.compareFaceData = compareFaceData
  1173. if (compareFaceData == 0) {
  1174. uni.showToast({
  1175. title: "人脸匹配不通过,请重新拍照上传",
  1176. icon: "none",
  1177. duration: 2000,
  1178. });
  1179. // setTimeout(() => {
  1180. // this.uploadLock = false;
  1181. // this.openPhoto();
  1182. // }, 2000);
  1183. return;
  1184. }
  1185. if (compareFaceData >= 80) {
  1186. const waitYS = await this.imageInfos();
  1187. this.postStudyRecord(); //提交记录
  1188. this.photoPopup = false;
  1189. }
  1190. },
  1191. //确认拍照
  1192. takePhoto() {
  1193. var self = this;
  1194. const ctx = uni.createCameraContext();
  1195. ctx.takePhoto({
  1196. quality: "high",
  1197. success: (res) => {
  1198. console.log(res.tempImagePath);
  1199. self.avatarUrl = res.tempImagePath;
  1200. // self.submitPhoto();
  1201. this.isTaking = false;
  1202. },
  1203. fail: (err) => {
  1204. console.log(err);
  1205. },
  1206. });
  1207. },
  1208. /**
  1209. * 是否有上传图片
  1210. */
  1211. hasImgs(bank) {
  1212. return bank.ansText.imageList.length == 0;
  1213. },
  1214. /**
  1215. * 获取试卷类型2考试,1练习
  1216. */
  1217. bankExam() {
  1218. this.$api.bankExam(this.id).then((res) => {
  1219. this.bankType = res.data.data.doType;
  1220. if (this.bankType == 2) {
  1221. this.needBack = true;
  1222. }
  1223. });
  1224. },
  1225. /**
  1226. * 点击后退按钮
  1227. */
  1228. clickLeft() {
  1229. //需要拍照没有拍直接返回
  1230. if (this.needPhoto && !this.isTakePhoto) {
  1231. this.isSubmit = true;
  1232. uni.navigateBack({
  1233. delta: 1,
  1234. });
  1235. return;
  1236. }
  1237. if (this.bankType == 1) {
  1238. let ansCount = this.questionOverNum(); //已答题数
  1239. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  1240. //所有题目答完
  1241. if (this.lastCount == 0) {
  1242. // this.testOver = true;
  1243. this.cgType = 7;
  1244. //未答完
  1245. } else {
  1246. this.cgType = 8;
  1247. // this.isLastCount = true;
  1248. }
  1249. this.showpopups = true;
  1250. } else if (this.bankType == 2) {
  1251. let ansCount = this.questionOverNum(); //已答题数
  1252. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  1253. //所有题目答完
  1254. if (this.lastCount == 0) {
  1255. this.testOver = true;
  1256. //未答完
  1257. } else {
  1258. this.isLastCount = true;
  1259. }
  1260. }
  1261. },
  1262. /**
  1263. * 返回上一页
  1264. */
  1265. backPages() {
  1266. this.needBack = false;
  1267. uni.navigateBack({
  1268. delta: 1,
  1269. });
  1270. },
  1271. /**
  1272. * 获取已经回答的题目数
  1273. * hasSpecail (是否包含简答和案例)
  1274. */
  1275. questionOverNum(hasSpecail) {
  1276. let count = 0;
  1277. this.questionList.forEach((item) => {
  1278. if (item.type == 1 || item.type == 2 || item.type == 3) {
  1279. if (item.ques) {
  1280. count++;
  1281. }
  1282. } else if (item.type == 4) {
  1283. //案例题
  1284. if (hasSpecail) {
  1285. let isOver = item.jsonStr.every((jsonItem, indexs) => {
  1286. if (
  1287. jsonItem.type == 1 ||
  1288. jsonItem.type == 2 ||
  1289. jsonItem.type == 3
  1290. ) {
  1291. if (item.ques[indexs]) {
  1292. return true;
  1293. } else {
  1294. return false;
  1295. }
  1296. } else if (jsonItem.type == 5) {
  1297. console.log(jsonItem, 111);
  1298. if (
  1299. item.ques[indexs] &&
  1300. (item.ques[indexs].text.length ||
  1301. item.ques[indexs].imageList.length)
  1302. ) {
  1303. return true;
  1304. } else {
  1305. return false;
  1306. }
  1307. }
  1308. });
  1309. if (isOver) {
  1310. count++;
  1311. console.log(item, 444);
  1312. }
  1313. }
  1314. } else if (item.type == 5) {
  1315. //简答题
  1316. if (hasSpecail) {
  1317. if (
  1318. item.ques &&
  1319. (item.ques.text.length || item.ques.imageList.length)
  1320. ) {
  1321. count++;
  1322. }
  1323. }
  1324. }
  1325. });
  1326. return count;
  1327. },
  1328. /**
  1329. * 是否做完所有题目
  1330. */
  1331. isDoOver() {
  1332. let questionOverNum = this.questionOverNum(true); //获取已经回答的题目数(包括简答和案例)
  1333. if (this.questionList.length == questionOverNum) {
  1334. //全部做完弹窗
  1335. this.cgType = 9;
  1336. this.showpopups = true;
  1337. }
  1338. },
  1339. /**
  1340. * 暂不交卷
  1341. */
  1342. noSubmit() {
  1343. //设为允许退出页面
  1344. this.needBack = false;
  1345. uni.navigateBack({
  1346. delta: 1,
  1347. });
  1348. },
  1349. /**
  1350. * 不离开
  1351. */
  1352. noLeave() {
  1353. this.isLastCount = false;
  1354. },
  1355. /**
  1356. * 立即离开并交卷
  1357. */
  1358. leaveNow() {
  1359. this.isSubmit = true;
  1360. uni.navigateBack({
  1361. delta: 1,
  1362. });
  1363. //需要拍照没有拍,返回不扣次数
  1364. if (this.needPhoto && !this.isTakePhoto) {
  1365. return;
  1366. }
  1367. this.submit('leaveNow')
  1368. return
  1369. let score = 0; //计算总分
  1370. let reportStatus = 0;
  1371. let number = 0;
  1372. let doQuestionIds = []; //做过的题目id
  1373. let doQuestionNum = 0; //做过的题目数量
  1374. let passScore = 0;
  1375. let allScore = 0; //总分
  1376. this.questionList.forEach((item, index) => {
  1377. passScore = item.passScore;
  1378. if (item.type == 1) {
  1379. if (item.ques == item.ans) {
  1380. item.scoreResult = item.score;
  1381. score += item.score;
  1382. number++;
  1383. } else {
  1384. item.scoreResult = 0;
  1385. }
  1386. if (item.ques) {
  1387. doQuestionNum++;
  1388. doQuestionIds.push(item.questionId);
  1389. }
  1390. allScore += item.score;
  1391. } else if (item.type == 2) {
  1392. let isRight =
  1393. item.ques &&
  1394. item.ques.every((quesItem, quesIndex) => {
  1395. return item.ques[quesIndex] == item.ans[quesIndex];
  1396. });
  1397. if (isRight) {
  1398. //全对
  1399. item.scoreResult = item.score;
  1400. score += item.score;
  1401. number++;
  1402. } else {
  1403. let hasPart = false;
  1404. let checkboxScore = 1; //获取单题总分数
  1405. item.ques &&
  1406. item.ques.forEach((ques, quesIndex) => {
  1407. //选错一个全扣
  1408. if (item.ques) {
  1409. if (item.ans.indexOf(item.ques[quesIndex]) == -1) {
  1410. checkboxScore = 0;
  1411. }
  1412. } else {
  1413. checkboxScore = 0;
  1414. }
  1415. });
  1416. //没选错
  1417. if (checkboxScore) {
  1418. checkboxScore = 0;
  1419. item.ans.forEach((ans, quesIndex) => {
  1420. //漏选扣一部分,对n题给n X partScore 分
  1421. if (item.ques) {
  1422. if (item.ques.indexOf(item.ans[quesIndex]) != -1) {
  1423. checkboxScore += item.partScore;
  1424. hasPart = true;
  1425. }
  1426. } else {
  1427. checkboxScore = 0;
  1428. }
  1429. });
  1430. }
  1431. if (!hasPart) {
  1432. item.scoreResult = 0;
  1433. } else {
  1434. item.scoreResult = checkboxScore;
  1435. }
  1436. score += checkboxScore;
  1437. }
  1438. if (item.ques && item.ques.length) {
  1439. doQuestionNum++;
  1440. doQuestionIds.push(item.questionId);
  1441. }
  1442. allScore += item.score;
  1443. } else if (item.type == 3) {
  1444. if (item.ques == item.ans) {
  1445. item.scoreResult = item.score;
  1446. score += item.score;
  1447. number++;
  1448. } else {
  1449. item.scoreResult = 0;
  1450. }
  1451. if (item.ques) {
  1452. doQuestionNum++;
  1453. doQuestionIds.push(item.questionId);
  1454. }
  1455. allScore += item.score;
  1456. } else {
  1457. allScore += item.score;
  1458. }
  1459. });
  1460. if (score >= passScore) {
  1461. reportStatus = 1;
  1462. } else {
  1463. reportStatus = 0;
  1464. }
  1465. this.$api
  1466. .bankRecordEdit({
  1467. moduleId: this.moduleId || 0,
  1468. chapterId: this.chapterId || 0,
  1469. sectionId: this.sectionId || 0,
  1470. gradeId: this.gradeId,
  1471. courseId: this.courseId,
  1472. orderGoodsId: this.orderGoodsId,
  1473. goodsId: this.goodsId,
  1474. examId: this.id,
  1475. recordId: this.recordId,
  1476. reportStatus: reportStatus,
  1477. rightQuestionNum: number,
  1478. doQuestionNum: doQuestionNum,
  1479. status: 1,
  1480. doQuestionIds: doQuestionIds.join(","),
  1481. performance: score,
  1482. totalScore: allScore,
  1483. type: this.examType,
  1484. // examTime: parseInt(this.allTimes),
  1485. // doTime: parseInt(this.allTimes) - parseInt(this.lastTime),
  1486. // historyExamJson: JSON.stringify(this.questionList)
  1487. })
  1488. .then((res) => {});
  1489. },
  1490. /**
  1491. * 立即交卷
  1492. */
  1493. submitNow() {
  1494. this.showpopups = false;
  1495. this.needBack = false;
  1496. this.submit();
  1497. },
  1498. /**
  1499. * 离开页面统计回答正确题数
  1500. */
  1501. examRecordEdit() {
  1502. if (!this.isSubmit) {
  1503. this.submit('leave')
  1504. return
  1505. let number = 0;
  1506. let score = 0;
  1507. let doQuestionNum = 0;
  1508. let reportStatus = 0;
  1509. let lessQuestionNum = 0;
  1510. this.questionList.forEach((item, index) => {
  1511. if (item.type == 1) {
  1512. if (item.ques == item.ans) {
  1513. score += item.score;
  1514. number++;
  1515. }
  1516. if (item.ques) {
  1517. doQuestionNum++;
  1518. }
  1519. } else if (item.type == 2) {
  1520. let isRight =
  1521. item.ques &&
  1522. item.ques.every((quesItem, quesIndex) => {
  1523. return item.ques[quesIndex] == item.ans[quesIndex];
  1524. });
  1525. if (isRight) {
  1526. score += item.score;
  1527. number++;
  1528. } else {
  1529. let hasPart = false;
  1530. let checkboxScore = 1; //获取单题总分数
  1531. item.ques.forEach((ques, quesIndex) => {
  1532. //选错一个全扣
  1533. if (item.ques) {
  1534. if (item.ans.indexOf(item.ques[quesIndex]) == -1) {
  1535. checkboxScore = 0;
  1536. }
  1537. } else {
  1538. checkboxScore = 0;
  1539. }
  1540. });
  1541. //没选错
  1542. if (checkboxScore) {
  1543. checkboxScore = 0;
  1544. item.ans.forEach((ans, quesIndex) => {
  1545. //漏选扣一部分
  1546. if (item.ques) {
  1547. if (item.ques.indexOf(item.ans[quesIndex]) == -1) {
  1548. checkboxScore += item.partScore;
  1549. hasPart = true;
  1550. }
  1551. } else {
  1552. checkboxScore = 0;
  1553. }
  1554. });
  1555. }
  1556. if (!hasPart) {
  1557. item.scoreResult = 0;
  1558. } else {
  1559. lessQuestionNum++
  1560. item.scoreResult = checkboxScore;
  1561. score += checkboxScore;
  1562. // number++;
  1563. }
  1564. }
  1565. if (item.ques && item.ques.length) {
  1566. doQuestionNum++;
  1567. }
  1568. } else if (item.type == 3) {
  1569. if (item.ques == item.ans) {
  1570. score += item.score;
  1571. number++;
  1572. }
  1573. if (item.ques) {
  1574. doQuestionNum++;
  1575. }
  1576. } else if (item == 4) {
  1577. if (item.ques.length) {
  1578. doQuestionNum++;
  1579. }
  1580. } else if (item.type == 5) {
  1581. if (item.ques) {
  1582. doQuestionNum++;
  1583. }
  1584. }
  1585. });
  1586. if (score >= 60) {
  1587. reportStatus = 1;
  1588. }
  1589. this.$api
  1590. .bankRecordEdit({
  1591. moduleId: this.moduleId || 0,
  1592. chapterId: this.chapterId || 0,
  1593. sectionId: this.sectionId || 0,
  1594. gradeId: this.gradeId,
  1595. courseId: this.courseId,
  1596. orderGoodsId: this.orderGoodsId,
  1597. goodsId: this.goodsId,
  1598. examId: this.id,
  1599. recordId: this.recordId,
  1600. lessQuestionNum:lessQuestionNum,
  1601. performance: score,
  1602. reportStatus: reportStatus,
  1603. status: 1,
  1604. type: this.examType,
  1605. // historyExamJson: JSON.stringify(this.questionList)
  1606. })
  1607. .then((res) => {});
  1608. }
  1609. },
  1610. /**
  1611. * @param {Object} second倒计时过滤器
  1612. */
  1613. countdown(second) {
  1614. if (second) {
  1615. let h = parseInt((second / 60 / 60) % 24); // 计算小时
  1616. let m = parseInt((second / 60) % 60); // 计算分数
  1617. let s = parseInt(second % 60); // 计算当前秒数
  1618. if (h < 10) h = "0" + h;
  1619. if (m < 10) m = "0" + m;
  1620. if (s < 10) s = "0" + s;
  1621. return h + ":" + m + ":" + s;
  1622. } else {
  1623. return "";
  1624. }
  1625. },
  1626. /**
  1627. * 请求题目列表
  1628. */
  1629. goodsQuestionList() {
  1630. this.$api
  1631. .goodsQuestionList({
  1632. examId: this.id,
  1633. })
  1634. .then(async (res) => {
  1635. if (!res.data.data.length) {
  1636. this.hideDialog();
  1637. uni.showModal({
  1638. showCancel: false,
  1639. content: "该试卷暂无题目",
  1640. success: function (k) {
  1641. if (k.confirm) {
  1642. uni.navigateBack();
  1643. }
  1644. },
  1645. });
  1646. return;
  1647. }
  1648. this.allTimes = res.data.data[0].answerTime * 60;
  1649. this.lastTime =
  1650. res.data.data[0].answerTime && res.data.data[0].answerTime * 60;
  1651. res.data.data.forEach((item, index) => {
  1652. if (typeof item.jsonStr == "string") {
  1653. item.jsonStr = JSON.parse(item.jsonStr);
  1654. if (item.type == 2) {
  1655. //多选
  1656. item.jsonStr.forEach((str) => {
  1657. str.optionsId = "" + str.optionsId;
  1658. });
  1659. let arr = item.answerQuestion.split(",");
  1660. arr.forEach((a, i) => {
  1661. arr[i] = "" + a;
  1662. });
  1663. item.ans = arr;
  1664. item.analysisContent &&
  1665. (item.analysisContent = item.analysisContent.replace(
  1666. /<img/gi,
  1667. '<img style="max-width:100%;"'
  1668. ));
  1669. item.content &&
  1670. (item.content = item.content.replace(
  1671. /<img/gi,
  1672. '<img style="max-width:100%;"'
  1673. ));
  1674. return;
  1675. } else if (item.type == 5) {
  1676. //简答题
  1677. item.ansText = {
  1678. text: "",
  1679. imageList: [],
  1680. };
  1681. item.ques = {
  1682. text: "",
  1683. imageList: [],
  1684. };
  1685. item.analysisContent &&
  1686. (item.analysisContent = item.analysisContent.replace(
  1687. /<img/gi,
  1688. '<img style="max-width:100%;"'
  1689. ));
  1690. item.content &&
  1691. (item.content = item.content.replace(
  1692. /<img/gi,
  1693. '<img style="max-width:100%;"'
  1694. ));
  1695. } else if (item.type == 4) {
  1696. //案例题
  1697. console.log(item.jsonStr);
  1698. item.ques = [];
  1699. item.current = 0;
  1700. let ansArr = [];
  1701. item.jsonStr.forEach((json, index) => {
  1702. if (json.type == 1) {
  1703. ansArr[index] = json.answerQuestion;
  1704. json.content &&
  1705. (json.content = json.content.replace(
  1706. /<img/gi,
  1707. '<img style="max-width:100%;"'
  1708. ));
  1709. } else if (json.type == 2) {
  1710. json.optionsList.forEach((str) => {
  1711. str.optionsId = "" + str.optionsId;
  1712. });
  1713. let arr = json.answerQuestion.split(",");
  1714. arr.forEach((a, i) => {
  1715. arr[i] = "" + a;
  1716. });
  1717. ansArr[index] = arr;
  1718. json.content &&
  1719. (json.content = json.content.replace(
  1720. /<img/gi,
  1721. '<img style="max-width:100%;"'
  1722. ));
  1723. } else if (json.type == 3) {
  1724. ansArr[index] = json.answerQuestion;
  1725. json.content &&
  1726. (json.content = json.content.replace(
  1727. /<img/gi,
  1728. '<img style="max-width:100%;"'
  1729. ));
  1730. } else if (json.type == 5) {
  1731. ansArr[index] = {
  1732. text: "",
  1733. imageList: [],
  1734. };
  1735. json.ansText = {
  1736. text: "",
  1737. imageList: [],
  1738. };
  1739. json.content &&
  1740. (json.content = json.content.replace(
  1741. /<img/gi,
  1742. '<img style="max-width:100%;"'
  1743. ));
  1744. }
  1745. });
  1746. item.analysisContent &&
  1747. (item.analysisContent = item.analysisContent.replace(
  1748. /<img/gi,
  1749. '<img style="max-width:100%;"'
  1750. ));
  1751. item.content &&
  1752. (item.content = item.content.replace(
  1753. /<img/gi,
  1754. '<img style="max-width:100%;"'
  1755. ));
  1756. item.ans = ansArr;
  1757. return;
  1758. }
  1759. item.content &&
  1760. (item.content = item.content.replace(
  1761. /<img/gi,
  1762. '<img style="max-width:100%;"'
  1763. ));
  1764. item.ans = item.answerQuestion;
  1765. }
  1766. });
  1767. this.questionList = res.data.data;
  1768. this.lastCount = this.questionList.length;
  1769. this.getCollectInfo(this.current)
  1770. await this.examRecord();
  1771. });
  1772. },
  1773. /**
  1774. * 记录总题数,获取recordId
  1775. * hasSpecial (是否包含简答和案例) true 包含 false 不包含
  1776. */
  1777. examRecord(hasSpecial) {
  1778. return new Promise((resolve) => {
  1779. let questionList = 0;
  1780. // if(!hasSpecial) {
  1781. this.questionList.forEach((item, index) => {
  1782. if (item.type == 1 || item.type == 2 || item.type == 3) {
  1783. questionList++;
  1784. }
  1785. });
  1786. // } else {
  1787. // questionList = this.questionList.length;
  1788. // }
  1789. this.$api
  1790. .bankRecord({
  1791. courseId: this.courseId,
  1792. chapterExamId: this.chapterId || 0,
  1793. moduleExamId: this.moduleId || 0,
  1794. sectionId: this.sectionId || 0,
  1795. examId: this.id,
  1796. goodsId: this.goodsId,
  1797. orderGoodsId: this.orderGoodsId,
  1798. gradeId: this.gradeId,
  1799. totalQuestionNum: questionList,
  1800. allQuestionNum: this.questionList.length,
  1801. type: this.examType,
  1802. })
  1803. .then((res) => {
  1804. this.recordId = res.data.data;
  1805. if (this.needPhoto) {
  1806. if (this.learning != 1) {
  1807. this.photoPopup = true; //拍照
  1808. this.isTaking = true;
  1809. }
  1810. } else {
  1811. if (this.lastTime) {
  1812. this.timer = setInterval(() => {
  1813. if (this.lastTime <= 0) {
  1814. clearInterval(this.timer);
  1815. uni.showToast({
  1816. icon: "none",
  1817. mask: true,
  1818. title: "考试时间已到,系统将自动交卷",
  1819. duration: 10000,
  1820. });
  1821. this.submit();
  1822. return;
  1823. }
  1824. this.lastTime--;
  1825. }, 1000);
  1826. }
  1827. resolve();
  1828. }
  1829. });
  1830. });
  1831. },
  1832. /**
  1833. * @param {Object} e单选点击
  1834. */
  1835. radioSelect(optionsId, bindex) {
  1836. // if (this.questionList[bindex].ques) return;
  1837. if (this.questionList[bindex].ques && this.bankType == 1) {
  1838. return
  1839. }
  1840. this.$set(this.questionList[bindex], "ques", optionsId);
  1841. // if ((bindex + 1) < this.questionList.length) {
  1842. // this.current = bindex + 1
  1843. // }
  1844. this.isDoOver();
  1845. },
  1846. /**
  1847. * @param {Object} e案例单选点击
  1848. */
  1849. radioSelectChild(optionsId, ansIndex, bindex) {
  1850. // if (this.questionList[bindex].ques[ansIndex]) return;
  1851. if (this.questionList[bindex].ques[ansIndex] && this.bankType == 1) {
  1852. return
  1853. }
  1854. this.$set(this.questionList[bindex].ques, ansIndex, optionsId);
  1855. this.isDoOver();
  1856. },
  1857. /**
  1858. * @param {Object} 多选点击
  1859. */
  1860. checkboxSelect(optionsId, bindex, index) {
  1861. if (this.questionList[bindex].ques && this.bankType == 1) {
  1862. return
  1863. }
  1864. this.$set(
  1865. this.questionList[bindex].jsonStr[index],
  1866. "checked",
  1867. !this.questionList[bindex].jsonStr[index].checked
  1868. );
  1869. console.log('this.questionList[bindex].jsonStr:', this.questionList[bindex].jsonStr[index])
  1870. },
  1871. /**
  1872. * @param {Object} 案例多选点击
  1873. */
  1874. checkboxSelectChild(bindex, ansIndex, childIndex) {
  1875. if (this.questionList[bindex].ques[ansIndex] && this.bankType == 1) {
  1876. return
  1877. }
  1878. this.$set(
  1879. this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex],
  1880. "checked",
  1881. !this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex]
  1882. .checked
  1883. );
  1884. },
  1885. isCheckboxChecked(arr) {
  1886. return arr.some((item) => {
  1887. if (item.checked) {
  1888. return true;
  1889. }
  1890. });
  1891. },
  1892. /**
  1893. * @param {Object} 多选确认
  1894. */
  1895. checkboxSubmit(bindex) {
  1896. // if (this.questionList[bindex].ques) return;
  1897. if (this.questionList[bindex].ques && this.bankType == 1) {
  1898. return
  1899. }
  1900. let arr = [];
  1901. this.questionList[bindex].jsonStr.forEach((item) => {
  1902. if (item.checked) {
  1903. arr.push(item.optionsId);
  1904. }
  1905. });
  1906. if (!arr.length) {
  1907. delete this.questionList[bindex].ques
  1908. uni.showToast({
  1909. title: "请选择答案",
  1910. icon: "none",
  1911. });
  1912. return;
  1913. }
  1914. this.$set(this.questionList[bindex], "ques", arr);
  1915. this.$u.toast('已确认答案')
  1916. this.isDoOver();
  1917. // let isWrong = this.questionList[bindex].ques.some(
  1918. // (quesItem, quesIndex) => {
  1919. // return (
  1920. // this.questionList[bindex].ques[quesIndex] !=
  1921. // this.questionList[bindex].ans[quesIndex]
  1922. // );
  1923. // }
  1924. // );
  1925. // let isWrong = this.questionList[bindex].ques.some((item, i) => {
  1926. // return this.questionList[bindex].ans.indexOf(item) == -1;
  1927. // })
  1928. },
  1929. /**
  1930. * @param {Object} 案例多选确认
  1931. */
  1932. checkboxSubmitChild(bindex, ansIndex) {
  1933. // if (this.questionList[bindex].ques[ansIndex]) return;
  1934. if (this.questionList[bindex].ques[ansIndex] && this.bankType == 1) {
  1935. return
  1936. }
  1937. let arr = [];
  1938. this.questionList[bindex].jsonStr[ansIndex].optionsList.forEach(
  1939. (item) => {
  1940. if (item.checked) {
  1941. arr.push(item.optionsId);
  1942. }
  1943. }
  1944. );
  1945. if (!arr.length) {
  1946. delete this.questionList[bindex].ques[ansIndex]
  1947. uni.showToast({
  1948. title: "请选择答案",
  1949. icon: "none",
  1950. });
  1951. return;
  1952. }
  1953. this.$set(this.questionList[bindex].ques, ansIndex, arr);
  1954. this.$u.toast('已确认答案')
  1955. this.isDoOver();
  1956. },
  1957. /**
  1958. * @param {Object} index
  1959. * @param {Object} bindex
  1960. * 判断题
  1961. */
  1962. judgeSelect(index, bindex) {
  1963. // if (this.questionList[bindex].ques) return;
  1964. if (this.questionList[bindex].ques && this.bankType == 1) {
  1965. return
  1966. }
  1967. this.$set(this.questionList[bindex], "ques", index == 0 ? '1' : '0');
  1968. this.isDoOver();
  1969. },
  1970. /**
  1971. * @param {Object} ansindex
  1972. * @param {Object} childindex
  1973. * @param {Object} bindex
  1974. * 案例判断题
  1975. */
  1976. judgeSelectChild(ansindex, childindex, bindex) {
  1977. // if (this.questionList[bindex].ques[ansindex]) return;
  1978. if (this.questionList[bindex].ques[ansindex] && this.bankType == 1) {
  1979. return
  1980. }
  1981. this.$set(this.questionList[bindex].ques, ansindex, childindex == 0 ? '1' : '0');
  1982. this.isDoOver();
  1983. },
  1984. openFooterTab() {
  1985. this.show = true;
  1986. },
  1987. hideDialog() {
  1988. this.showDialog = false;
  1989. },
  1990. changeIndex(index) {
  1991. this.current = index;
  1992. },
  1993. swiperChange(e) {
  1994. this.current = e.detail.current;
  1995. this.getCollectInfo(this.current)
  1996. },
  1997. /**
  1998. * @param {Object} current
  1999. * 获取收藏信息
  2000. */
  2001. getCollectInfo(current) {
  2002. this.$api
  2003. .getCollectInfo({
  2004. examId: this.id,
  2005. questionId: this.questionList[current].questionId,
  2006. goodsId: this.goodsId,
  2007. orderGoodsId: this.orderGoodsId,
  2008. })
  2009. .then((res) => {
  2010. if (res.data.code == 500) {
  2011. this.$set(this.collectList, current, false);
  2012. } else if (res.data.code == 200) {
  2013. this.$set(this.collectList, current, res.data.data);
  2014. }
  2015. });
  2016. },
  2017. /**
  2018. * @param {Object} state
  2019. * @param {Object} index
  2020. * 收藏
  2021. */
  2022. collect(state, index) {
  2023. if (!state) {
  2024. this.$api.collectQuestion({
  2025. examId: this.id,
  2026. questionId: this.questionList[index].questionId,
  2027. goodsId: this.goodsId || "",
  2028. orderGoodsId: this.orderGoodsId,
  2029. })
  2030. .then((res) => {
  2031. if (res.data.code == 200) {
  2032. this.$set(this.collectList, index, true);
  2033. uni.showToast({
  2034. title: "收藏成功",
  2035. duration: 2000,
  2036. icon: "none",
  2037. });
  2038. this.getCollectInfo(index);
  2039. }
  2040. });
  2041. } else {
  2042. this.$api
  2043. .deleteCollectQuestion(this.collectList[index].collectQuestionId)
  2044. .then((res) => {
  2045. if (res.data.code == 200) {
  2046. this.$set(this.collectList, index, false);
  2047. uni.showToast({
  2048. title: "取消收藏成功",
  2049. duration: 2000,
  2050. icon: "none",
  2051. });
  2052. }
  2053. });
  2054. }
  2055. return;
  2056. },
  2057. pdsubmit() {
  2058. let ansCount = this.questionOverNum(true); //已答题数
  2059. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  2060. //没有答完
  2061. if (this.lastCount !== 0) {
  2062. this.cgType = 6;
  2063. this.showpopups = true;
  2064. return;
  2065. }
  2066. if (this.bankType == 2) {
  2067. if (this.lastTime > 0) {
  2068. let lastTime = this.countdown(this.lastTime);
  2069. uni.showModal({
  2070. title: "提示",
  2071. content: `时间还剩余${lastTime},确定交卷吗?`,
  2072. confirmText: "交卷",
  2073. cancelText: "继续答题",
  2074. success: (res) => {
  2075. if (res.confirm) {
  2076. //确定
  2077. this.submit();
  2078. } else {
  2079. //取消
  2080. }
  2081. },
  2082. });
  2083. return;
  2084. }
  2085. }
  2086. this.submit();
  2087. },
  2088. /**
  2089. * 交卷
  2090. */
  2091. submit(typesubmit) {
  2092. console.log('交卷', typesubmit)
  2093. let score = 0; //计算总分
  2094. let reportStatus = 0;
  2095. let number = 0; //做对的题目数量
  2096. let doQuestionNum = 0; //做过的题目数量
  2097. let allScore = 0; //总分
  2098. let passScore = 0;
  2099. let doWrongQuestionIds = []; //错题和未做题id(客观题)
  2100. let doQuestionIds = []; //做过的题目id
  2101. let rightQuestionIds = []; //做对的题目id
  2102. let lessQuestionNum = 0;
  2103. this.questionList.forEach((item, index) => {
  2104. passScore = item.passScore;
  2105. if (item.type == 1) {
  2106. //正确
  2107. if (item.ques == item.ans) {
  2108. item.scoreResult = item.score;
  2109. score += item.score;
  2110. number++;
  2111. rightQuestionIds.push(item.questionId);
  2112. } else {
  2113. //错误
  2114. item.scoreResult = 0;
  2115. if (item.ques) {
  2116. doWrongQuestionIds.push(item.questionId);
  2117. }
  2118. }
  2119. allScore += item.score;
  2120. if (item.ques) {
  2121. doQuestionNum++;
  2122. doQuestionIds.push(item.questionId);
  2123. }
  2124. } else if (item.type == 2) {
  2125. let isRight =
  2126. item.ans &&
  2127. item.ans.every((quesItem, quesIndex) => {
  2128. if (item.ques) {
  2129. return item.ques[quesIndex] == item.ans[quesIndex];
  2130. } else {
  2131. return false;
  2132. }
  2133. });
  2134. if (isRight) {
  2135. score += item.score;
  2136. number++;
  2137. item.scoreResult = item.score;
  2138. rightQuestionIds.push(item.questionId);
  2139. } else {
  2140. let hasPart = false;
  2141. let checkboxScore = 1; //获取单题总分数
  2142. item.ques &&
  2143. item.ques.forEach((ques, quesIndex) => {
  2144. //选错一个全扣
  2145. if (item.ques) {
  2146. if (item.ans.indexOf(item.ques[quesIndex]) == -1) {
  2147. checkboxScore = 0;
  2148. }
  2149. } else {
  2150. checkboxScore = 0;
  2151. }
  2152. });
  2153. console.log(checkboxScore);
  2154. //没选错
  2155. if (checkboxScore) {
  2156. checkboxScore = 0;
  2157. item.ans.forEach((ans, quesIndex) => {
  2158. //漏选扣一部分,对n题给n X partScore 分
  2159. if (item.ques) {
  2160. if (item.ques.indexOf(item.ans[quesIndex]) != -1) {
  2161. checkboxScore += item.partScore;
  2162. hasPart = true;
  2163. }
  2164. } else {
  2165. checkboxScore = 0;
  2166. }
  2167. });
  2168. }
  2169. if (!hasPart) {
  2170. //0分
  2171. item.scoreResult = 0;
  2172. if (item.ques) {
  2173. doWrongQuestionIds.push(item.questionId);
  2174. }
  2175. } else {
  2176. //部分分
  2177. // number++;
  2178. // doWrongQuestionIds.push(item.questionId);
  2179. lessQuestionNum++
  2180. item.scoreResult = checkboxScore;
  2181. score += checkboxScore;
  2182. // rightQuestionIds.push(item.questionId)
  2183. }
  2184. }
  2185. allScore += item.score;
  2186. if (item.ques && item.ques.length) {
  2187. doQuestionNum++;
  2188. doQuestionIds.push(item.questionId);
  2189. }
  2190. } else if (item.type == 3) {
  2191. if (item.ques == item.ans) {
  2192. item.scoreResult = item.score;
  2193. score += item.score;
  2194. number++;
  2195. rightQuestionIds.push(item.questionId);
  2196. } else {
  2197. item.scoreResult = 0;
  2198. if (item.ques) {
  2199. doWrongQuestionIds.push(item.questionId);
  2200. }
  2201. }
  2202. allScore += item.score;
  2203. if (item.ques) {
  2204. doQuestionNum++;
  2205. doQuestionIds.push(item.questionId);
  2206. }
  2207. } else if (item.type == 4) {
  2208. allScore += item.score;
  2209. if (item.ques && item.ques.length) {
  2210. doQuestionNum++;
  2211. doQuestionIds.push(item.questionId);
  2212. }
  2213. } else if (item.type == 5) {
  2214. allScore += item.score;
  2215. if (item.ques && (item.ques.imageList || item.ques.text)) {
  2216. doQuestionNum++;
  2217. doQuestionIds.push(item.questionId);
  2218. }
  2219. }
  2220. });
  2221. //大于分及格
  2222. if (score >= passScore) {
  2223. reportStatus = 1;
  2224. } else {
  2225. reportStatus = 0;
  2226. }
  2227. clearInterval(this.timer);
  2228. //交卷
  2229. this.$api
  2230. .bankRecordEdit({
  2231. moduleId: this.moduleId || 0,
  2232. chapterId: this.chapterId || 0,
  2233. sectionId: this.sectionId || 0,
  2234. gradeId: this.gradeId,
  2235. examId: this.id,
  2236. goodsId: this.goodsId,
  2237. orderGoodsId: this.orderGoodsId,
  2238. reportStatus: reportStatus,
  2239. recordId: this.recordId,
  2240. courseId: this.courseId,
  2241. rightQuestionNum: number,
  2242. lessQuestionNum: lessQuestionNum,
  2243. status: 1,
  2244. doQuestionIds: doQuestionIds.join(","),
  2245. rightQuestionIds: rightQuestionIds.join(','),
  2246. doQuestionNum: doQuestionNum,
  2247. performance: score,
  2248. totalScore: allScore,
  2249. type: this.examType,
  2250. examTime: parseInt(this.allTimes),
  2251. doTime: parseInt(this.allTimes) - parseInt(this.lastTime),
  2252. historyExamJson: JSON.stringify(this.questionList)
  2253. })
  2254. .then((res) => {
  2255. this.isSubmit = true;
  2256. if (res.data.code == 200) {
  2257. uni.showToast({
  2258. title: "交卷成功",
  2259. duration: 1000,
  2260. mask: true,
  2261. icon: "none",
  2262. });
  2263. if (!typesubmit) {
  2264. console.log('跳转----')
  2265. setTimeout(() => {
  2266. uni.redirectTo({
  2267. url:
  2268. "/pages2/class/question_report?rightQuestionNum=" +
  2269. number +
  2270. "&doWrongQuestionNum=" +
  2271. doWrongQuestionIds.length +
  2272. "&score=" +
  2273. score +
  2274. "&totalScore=" +
  2275. allScore +
  2276. "&reportStatus=" +
  2277. reportStatus +
  2278. "&lessQuestionNum=" +
  2279. lessQuestionNum +
  2280. "&examId=" + this.id + '&recordId=' + this.recordId + '&type=' + this.examType + '&orderGoodsId='+ this.orderGoodsId,
  2281. });
  2282. }, 1000);
  2283. }
  2284. }
  2285. });
  2286. //错题集id提交(客观题)
  2287. this.$api
  2288. .examWrongRecord({
  2289. moduleId: this.moduleId || 0,
  2290. chapterId: this.chapterId || 0,
  2291. sectionId: this.sectionId || 0,
  2292. gradeId: this.gradeId,
  2293. courseId: this.courseId,
  2294. examId: this.id,
  2295. goodsId: this.goodsId,
  2296. orderGoodsId: this.orderGoodsId,
  2297. questionIds: doWrongQuestionIds,
  2298. recordId: this.recordId,
  2299. type: 2, // 视频课程的传2
  2300. })
  2301. .then((res) => {})
  2302. .catch((err) => {})
  2303. },
  2304. /**
  2305. * @param {Object} imgIndex
  2306. * @param {Object} bankIndex
  2307. * 删除简答图片
  2308. */
  2309. deleteImg(imgIndex, bankIndex) {
  2310. this.questionList[bankIndex].ansText.imageList.splice(imgIndex, 1);
  2311. },
  2312. /**
  2313. * @param {Object} imgIndex
  2314. * @param {Object} bankIndex
  2315. * @param {Object} ansIndex
  2316. * 删除案例题简答图片
  2317. */
  2318. deleteImgChild(imgIndex, bankIndex, ansIndex) {
  2319. this.questionList[bankIndex].jsonStr[ansIndex].ansText.imageList.splice(
  2320. imgIndex,
  2321. 1
  2322. );
  2323. },
  2324. /**
  2325. * @param {Object} bankindex
  2326. * 选择上传图片
  2327. */
  2328. chooseImg(bankindex) {
  2329. if (
  2330. this.questionList[bankindex] &&
  2331. this.questionList[bankindex].ansText &&
  2332. this.questionList[bankindex].ansText.imageList.length >= 4
  2333. ) {
  2334. uni.showToast({
  2335. icon: "none",
  2336. title: "最多选择4张",
  2337. });
  2338. return;
  2339. }
  2340. uni.chooseImage({
  2341. count: 1, //默认9
  2342. sizeType: ["compressed"], //可以指定是原图还是压缩图,默认二者都有
  2343. sourceType: ["album", "camera"], //从相册选择
  2344. success: (res) => {
  2345. let self = this;
  2346. // console.log(JSON.stringify(res.tempFilePaths));
  2347. let img = res.tempFilePaths[0];
  2348. uni.getImageInfo({
  2349. src: img,
  2350. success: async (res) => {
  2351. let canvasWidth = res.width; //图片原始长宽
  2352. let canvasHeight = res.height;
  2353. if (canvasWidth > 1000 || canvasHeight > 1000) {
  2354. uni.compressImage({
  2355. src: img,
  2356. quality: 75,
  2357. width: "50%",
  2358. height: "50%",
  2359. success: async (rest) => {
  2360. const dir = await self.uploadFile(rest.tempFilePath, 0);
  2361. this.questionList[bankindex].ansText.imageList.push(dir);
  2362. },
  2363. });
  2364. } else {
  2365. const dir = await self.uploadFile(img, 0);
  2366. this.questionList[bankindex].ansText.imageList.push(dir);
  2367. }
  2368. },
  2369. });
  2370. },
  2371. });
  2372. },
  2373. /**
  2374. * @param {Object} bankindex
  2375. * @param {Object} ansindex
  2376. * 案例题选择上传图片
  2377. */
  2378. chooseImgChild(bankindex, ansindex) {
  2379. uni.chooseImage({
  2380. count: 1, //默认9
  2381. sizeType: ["compressed"], //可以指定是原图还是压缩图,默认二者都有
  2382. sourceType: ["album", "camera"], //从相册选择
  2383. success: (res) => {
  2384. let self = this;
  2385. // console.log(JSON.stringify(res.tempFilePaths));
  2386. let img = res.tempFilePaths[0];
  2387. uni.getImageInfo({
  2388. src: img,
  2389. success: async (res) => {
  2390. let canvasWidth = res.width; //图片原始长宽
  2391. let canvasHeight = res.height;
  2392. if (canvasWidth > 1000 || canvasHeight > 1000) {
  2393. uni.compressImage({
  2394. src: img,
  2395. quality: 75,
  2396. width: "50%",
  2397. height: "50%",
  2398. success: async (rest) => {
  2399. const dir = await self.uploadFile(rest.tempFilePath, 0);
  2400. this.questionList[bankindex].jsonStr[
  2401. ansindex
  2402. ].ansText.imageList.push(dir);
  2403. },
  2404. });
  2405. } else {
  2406. const dir = await self.uploadFile(img, 0);
  2407. this.questionList[bankindex].jsonStr[
  2408. ansindex
  2409. ].ansText.imageList.push(dir);
  2410. }
  2411. },
  2412. });
  2413. },
  2414. });
  2415. },
  2416. /**
  2417. * @param {Object} type
  2418. * @param {Object} bankindex
  2419. * 简答题答案确认
  2420. */
  2421. submitAns(bankindex) {
  2422. console.log(this.questionList[bankindex]);
  2423. if (
  2424. !this.questionList[bankindex].ansText.text &&
  2425. !this.questionList[bankindex].ansText.imageList.length
  2426. ) {
  2427. uni.showToast({
  2428. title: "请输入内容或上传图片",
  2429. duration: 2000,
  2430. icon: "none",
  2431. });
  2432. return;
  2433. }
  2434. this.$set(this.questionList[bankindex], "ques", {
  2435. imageList: this.questionList[bankindex].ansText.imageList,
  2436. text: this.questionList[bankindex].ansText.text,
  2437. });
  2438. this.isDoOver();
  2439. },
  2440. /**
  2441. * @param {Object} bankindex
  2442. * @param {Object} ansindex
  2443. * 案例题简答答案确认
  2444. */
  2445. submitAnsChild(bankindex, ansindex) {
  2446. if (
  2447. !this.questionList[bankindex].jsonStr[ansindex].ansText.text &&
  2448. !this.questionList[bankindex].jsonStr[ansindex].ansText.imageList.length
  2449. ) {
  2450. uni.showToast({
  2451. title: "请输入内容或上传图片",
  2452. duration: 2000,
  2453. icon: "none",
  2454. });
  2455. return;
  2456. }
  2457. this.$set(this.questionList[bankindex].ques, ansindex, {
  2458. imageList:
  2459. this.questionList[bankindex].jsonStr[ansindex].ansText.imageList,
  2460. text: this.questionList[bankindex].jsonStr[ansindex].ansText.text,
  2461. });
  2462. this.isDoOver();
  2463. },
  2464. isCheck(item, index) {
  2465. if (this.questionList[index].ques) {
  2466. return true
  2467. }
  2468. },
  2469. isRight(item, index) {
  2470. //单选
  2471. if (this.questionList[index].ques) {
  2472. if (item.type == 1) {
  2473. return this.questionList[index].ques == this.questionList[index].ans;
  2474. //多选
  2475. } else if (item.type == 2) {
  2476. //每一项都相等
  2477. return this.questionList[index].ans.every((item, i) => {
  2478. return item == this.questionList[index].ques[i];
  2479. });
  2480. //判断
  2481. } else if (item.type == 3) {
  2482. return this.questionList[index].ques == this.questionList[index].ans;
  2483. // } else if (item.type == 5) {
  2484. // if(this.questionList[index].ques.text){
  2485. // return true
  2486. // }else{
  2487. // return false
  2488. // }
  2489. } else {
  2490. return false;
  2491. }
  2492. } else {
  2493. return false;
  2494. }
  2495. },
  2496. right(bankIndex, ansIndex, option) {
  2497. if (
  2498. this.questionList[bankIndex].ques[ansIndex] &&
  2499. this.questionList[bankIndex].ans[ansIndex]
  2500. ) {
  2501. if (
  2502. this.questionList[bankIndex].ques[ansIndex].indexOf(
  2503. option.optionsId
  2504. ) != -1 ||
  2505. this.questionList[bankIndex].ans[ansIndex].indexOf(
  2506. option.optionsId
  2507. ) != -1
  2508. ) {
  2509. return true;
  2510. } else {
  2511. return false;
  2512. }
  2513. } else {
  2514. return false;
  2515. }
  2516. },
  2517. wrong(bankIndex, ansIndex, option) {
  2518. if (
  2519. this.questionList[bankIndex].ques[ansIndex] &&
  2520. this.questionList[bankIndex].ans[ansIndex]
  2521. ) {
  2522. if (
  2523. this.questionList[bankIndex].ques[ansIndex].indexOf(
  2524. option.optionsId
  2525. ) != -1 &&
  2526. this.questionList[bankIndex].ans[ansIndex].indexOf(
  2527. option.optionsId
  2528. ) == -1
  2529. ) {
  2530. return true;
  2531. } else {
  2532. return false;
  2533. }
  2534. } else {
  2535. return false;
  2536. }
  2537. },
  2538. isWrong(item, index) {
  2539. if (this.questionList[index].ques) {
  2540. //单选
  2541. if (item.type == 1) {
  2542. return this.questionList[index].ques != this.questionList[index].ans;
  2543. //多选
  2544. } else if (item.type == 2) {
  2545. //每一项都相等
  2546. return this.questionList[index].ques.some((item, i) => {
  2547. return this.questionList[index].ans.indexOf(item) == -1;
  2548. });
  2549. //判断
  2550. } else if (item.type == 3) {
  2551. return this.questionList[index].ques != this.questionList[index].ans;
  2552. } else {
  2553. return false;
  2554. }
  2555. } else {
  2556. return false;
  2557. }
  2558. },
  2559. isPart(item, index) {
  2560. if (this.questionList[index].ques) {
  2561. if (item.type == 2) {
  2562. let isWrong = this.questionList[index].ques.some((item, i) => {
  2563. return this.questionList[index].ans.indexOf(item) == -1;
  2564. });
  2565. let isRight = this.questionList[index].ans.every((item, i) => {
  2566. return item == this.questionList[index].ques[i];
  2567. });
  2568. if (!isRight && !isWrong) {
  2569. return true;
  2570. }
  2571. }
  2572. } else {
  2573. return false;
  2574. }
  2575. },
  2576. isOver(item, index) {
  2577. if (this.questionList[index].ques) {
  2578. if (item.type == 4) {
  2579. //案例题
  2580. let isOver = item.jsonStr.every((jsonItem, indexs) => {
  2581. if (
  2582. jsonItem.type == 1 ||
  2583. jsonItem.type == 2 ||
  2584. jsonItem.type == 3
  2585. ) {
  2586. if (item.ques[indexs]) {
  2587. return true;
  2588. } else {
  2589. return false;
  2590. }
  2591. } else if (jsonItem.type == 5) {
  2592. if (
  2593. item.ques[indexs] &&
  2594. (item.ques[indexs].text || item.ques[indexs].imageList.length)
  2595. ) {
  2596. console.log("chil");
  2597. return true;
  2598. } else {
  2599. return false;
  2600. }
  2601. }
  2602. });
  2603. if (isOver) {
  2604. return true;
  2605. } else {
  2606. return false;
  2607. }
  2608. } else if (item.type == 5) {
  2609. //简答题
  2610. //每一项都相等
  2611. if (item.ques && (item.ques.imageList.length || item.ques.text)) {
  2612. return true;
  2613. }
  2614. //判断
  2615. } else {
  2616. return false;
  2617. }
  2618. } else {
  2619. return false;
  2620. }
  2621. },
  2622. tabSelect(index, bankindex) {
  2623. this.$set(this.questionList[bankindex], "current", index);
  2624. },
  2625. },
  2626. };
  2627. </script>
  2628. <style lang="scss" scoped>
  2629. .photoBox {
  2630. width: 100%;
  2631. // background-color: #ffffff;
  2632. // border-radius: 24px 24px 0px 0px;
  2633. .photoTop {
  2634. width: 100%;
  2635. height: 74rpx;
  2636. border-radius: 20px 20px 0px 0px;
  2637. background-color: #ffffff;
  2638. display: flex;
  2639. align-items: center;
  2640. justify-content: center;
  2641. padding: 0rpx 38rpx;
  2642. .sqzz {
  2643. width: 28rpx;
  2644. height: 28rpx;
  2645. display: flex;
  2646. align-items: center;
  2647. justify-content: center;
  2648. }
  2649. .centersq {
  2650. color: #333;
  2651. font-size: 30rpx;
  2652. font-weight: 500;
  2653. }
  2654. }
  2655. .photoCenter {
  2656. width: 750rpx;
  2657. height: 75vh;
  2658. position: relative;
  2659. .center_camera {
  2660. width: 100%;
  2661. height: 75vh;
  2662. // position: fixed;
  2663. .head_take {
  2664. width: 100%;
  2665. height: 75vh;
  2666. display: flex;
  2667. flex-direction: column;
  2668. }
  2669. .headTake_up {
  2670. width: 100%;
  2671. height: 100rpx;
  2672. }
  2673. .headTake_minddle {
  2674. display: flex;
  2675. .min_img {
  2676. width: 500rpx;
  2677. height: 550rpx;
  2678. }
  2679. .min_left, .min_right {
  2680. flex: 1;
  2681. height: 550rpx;
  2682. }
  2683. }
  2684. .headTake_down {
  2685. width: 100%;
  2686. flex: 1;
  2687. }
  2688. .color {
  2689. background-color: #333;
  2690. opacity: 0.5;
  2691. }
  2692. }
  2693. .custom {
  2694. width: 750rpx;
  2695. height: 75vh;
  2696. position: absolute;
  2697. z-index: 1000;
  2698. top: 0;
  2699. left: 0;
  2700. image {
  2701. width: 100%;
  2702. height: 100%;
  2703. }
  2704. }
  2705. }
  2706. .photoBoxbtns {
  2707. display: flex;
  2708. .btnResult {
  2709. height: 100rpx;
  2710. width: 100%;
  2711. background-color: #07c160;
  2712. text-align: center;
  2713. line-height: 100rpx;
  2714. color: #fff;
  2715. font-size: 32rpx;
  2716. font-weight: bold;
  2717. }
  2718. }
  2719. }
  2720. .navbar {
  2721. position: relative;
  2722. z-index: 20000;
  2723. }
  2724. .questionBank {
  2725. width: 100%;
  2726. height: 100vh;
  2727. display: flex;
  2728. flex-direction: column;
  2729. }
  2730. .swiper {
  2731. width: 100%;
  2732. flex: 1;
  2733. }
  2734. .lisSty {
  2735. margin-bottom: 16rpx;
  2736. display: flex;
  2737. .flex_auto {
  2738. flex: 1;
  2739. }
  2740. }
  2741. .activeTI {
  2742. vertical-align: middle;
  2743. display: inline-block;
  2744. border: 1rpx solid #eee;
  2745. border-radius: 50rpx;
  2746. height: 48rpx;
  2747. line-height: 46rpx;
  2748. text-align: center;
  2749. width: 48rpx;
  2750. margin-right: 15rpx;
  2751. color: #666;
  2752. font-size: 30rpx;
  2753. &.right {
  2754. color: #fff;
  2755. background: #36c75a;
  2756. }
  2757. &.wrong {
  2758. color: #fff;
  2759. background: #ff3b30;
  2760. }
  2761. &.checked, &.user_choose {
  2762. color: #fff;
  2763. background: #007aff;
  2764. }
  2765. }
  2766. .submit_checkbox {
  2767. position: fixed;
  2768. left: 0;
  2769. right: 0;
  2770. bottom: 120rpx;
  2771. margin: 20rpx auto;
  2772. width: 526rpx;
  2773. height: 80rpx;
  2774. background: rgba(0, 122, 255, 1);
  2775. color: #fff;
  2776. text-align: center;
  2777. line-height: 80rpx;
  2778. font-size: 30rpx;
  2779. border-radius: 40rpx;
  2780. &.disabled {
  2781. opacity: 0.6;
  2782. }
  2783. }
  2784. .titles {
  2785. overflow: hidden;
  2786. margin-bottom: 24rpx;
  2787. }
  2788. .titBox {
  2789. padding: 41rpx 25rpx 24rpx 25rpx;
  2790. }
  2791. .titBox_title {
  2792. padding: 21rpx;
  2793. }
  2794. .tabs {
  2795. margin: 10rpx;
  2796. display: flex;
  2797. .tab {
  2798. margin: 0 4rpx;
  2799. padding: 10rpx 13rpx;
  2800. text-align: center;
  2801. color: #007aff;
  2802. font-size: 28rpx;
  2803. border-radius: 16rpx;
  2804. background: #fff;
  2805. &.current {
  2806. color: #fff;
  2807. background: #007aff;
  2808. }
  2809. }
  2810. }
  2811. .ans {
  2812. margin: 8rpx 8rpx 8rpx;
  2813. .ans_input {
  2814. border-radius: 16rpx;
  2815. background: #fff;
  2816. .top {
  2817. border-bottom: 1rpx solid #eeeeee;
  2818. padding: 16rpx;
  2819. display: flex;
  2820. align-items: center;
  2821. .icon {
  2822. margin-right: 20rpx;
  2823. width: 40rpx;
  2824. height: 38rpx;
  2825. }
  2826. .progress {
  2827. flex: 1;
  2828. }
  2829. .submit {
  2830. width: 168rpx;
  2831. height: 48rpx;
  2832. line-height: 48rpx;
  2833. text-align: center;
  2834. color: #fff;
  2835. font-size: 30rpx;
  2836. background: #007aff;
  2837. border-radius: 24rpx;
  2838. &.disabled {
  2839. opacity: 0.6;
  2840. }
  2841. }
  2842. }
  2843. .textarea {
  2844. textarea {
  2845. width: 100%;
  2846. height: 287rpx;
  2847. padding: 10rpx;
  2848. }
  2849. }
  2850. .imgs {
  2851. overflow: hidden;
  2852. display: flex;
  2853. width: 100%;
  2854. .img {
  2855. width: 104rpx;
  2856. height: 104rpx;
  2857. border-radius: 8rpx;
  2858. position: relative;
  2859. margin: 20rpx;
  2860. text {
  2861. position: absolute;
  2862. right: -15rpx;
  2863. top: -15rpx;
  2864. width: 30rpx;
  2865. height: 30rpx;
  2866. text-align: center;
  2867. line-height: 30rpx;
  2868. color: #fff;
  2869. background: #ff3b30;
  2870. border-radius: 50%;
  2871. }
  2872. image {
  2873. width: 100%;
  2874. height: 100%;
  2875. }
  2876. }
  2877. }
  2878. }
  2879. .ans_submit {
  2880. padding: 16rpx;
  2881. border-radius: 16rpx;
  2882. background: #fff;
  2883. .imgs {
  2884. overflow: hidden;
  2885. display: flex;
  2886. width: 100%;
  2887. .img {
  2888. width: 104rpx;
  2889. height: 104rpx;
  2890. border-radius: 8rpx;
  2891. position: relative;
  2892. margin: 20rpx;
  2893. image {
  2894. width: 100%;
  2895. height: 100%;
  2896. }
  2897. }
  2898. }
  2899. }
  2900. }
  2901. .leftLetters {
  2902. display: flex;
  2903. align-items: center;
  2904. width: 220rpx;
  2905. .btnType {
  2906. padding: 5rpx 10rpx;
  2907. border: 1rpx solid #007aff;
  2908. border-radius: 10rpx;
  2909. background-color: rgba(0, 122, 255, 0.1);
  2910. font-size: 28rpx;
  2911. color: #007aff;
  2912. margin-right: 15rpx;
  2913. }
  2914. }
  2915. .firstLetter {
  2916. display: flex;
  2917. justify-content: space-between;
  2918. align-items: center;
  2919. margin-bottom: 30rpx;
  2920. }
  2921. .popupView {
  2922. height: 100%;
  2923. padding-bottom: 100rpx;
  2924. .popupTops {
  2925. height: 77rpx;
  2926. border-bottom: 1rpx solid #eee;
  2927. text-align: center;
  2928. line-height: 77rpx;
  2929. font-size: 24rpx;
  2930. color: #999;
  2931. position: relative;
  2932. .topIcon {
  2933. position: absolute;
  2934. top: 10rpx;
  2935. left: 50%;
  2936. transform: translateX(-50%);
  2937. width: 80rpx;
  2938. height: 8rpx;
  2939. background-color: #999;
  2940. border-radius: 4rpx;
  2941. }
  2942. }
  2943. .popupContent {
  2944. }
  2945. }
  2946. .pageContent {
  2947. position: relative;
  2948. background-color: #eaeef1;
  2949. height: 100%;
  2950. padding-top: 8rpx;
  2951. padding-bottom: 100rpx;
  2952. overflow-y: scroll;
  2953. }
  2954. .pad_8 {
  2955. background-color: #fff;
  2956. margin: 0rpx 8rpx 8rpx;
  2957. border-radius: 16rpx;
  2958. &.no-margin {
  2959. margin-top: -16rpx;
  2960. border-radius: 0 0 16rpx 16rpx;
  2961. }
  2962. }
  2963. .answer {
  2964. height: 80rpx;
  2965. line-height: 80rpx;
  2966. padding: 0rpx 24rpx;
  2967. display: flex;
  2968. align-items: center;
  2969. justify-content: space-between;
  2970. color: #666;
  2971. font-size: 30rpx;
  2972. }
  2973. .footer_btn {
  2974. background-color: #fff;
  2975. z-index: 10078;
  2976. position: fixed;
  2977. bottom: 0rpx;
  2978. display: flex;
  2979. align-items: center;
  2980. justify-content: space-between;
  2981. width: 100%;
  2982. height: 98rpx;
  2983. padding: 0rpx 38rpx;
  2984. border-top: 1rpx solid #eee;
  2985. .flex_center {
  2986. flex: 1;
  2987. display: flex;
  2988. justify-content: center;
  2989. align-items: center;
  2990. flex-direction: column;
  2991. margin: 0 200rpx;
  2992. font-size: 24rpx;
  2993. color: #999999;
  2994. .up-icon {
  2995. margin-bottom: 18rpx;
  2996. width: 100%;
  2997. display: flex;
  2998. justify-content: center;
  2999. image {
  3000. width: 58rpx;
  3001. height: 21rpx;
  3002. }
  3003. }
  3004. }
  3005. .collect {
  3006. visibility: hidden;
  3007. width: 100rpx;
  3008. &.show {
  3009. visibility: visible;
  3010. }
  3011. > view {
  3012. display: flex;
  3013. flex-direction: column;
  3014. align-items: center;
  3015. justify-content: center;
  3016. image {
  3017. width: 32rpx;
  3018. height: 32rpx;
  3019. margin-bottom: 6rpx;
  3020. }
  3021. view {
  3022. font-size: 24rpx;
  3023. color: #999999;
  3024. }
  3025. }
  3026. }
  3027. }
  3028. .boxSty {
  3029. padding: 44rpx 41rpx 0rpx;
  3030. }
  3031. .liListSty {
  3032. border: 1rpx solid #eeeeee;
  3033. width: 88rpx;
  3034. height: 88rpx;
  3035. border-radius: 32rpx;
  3036. text-align: center;
  3037. line-height: 88rpx;
  3038. color: #333;
  3039. font-size: 32rpx;
  3040. float: left;
  3041. margin: 20rpx 23rpx;
  3042. &.isRight {
  3043. border: 1rpx solid #eeeeee;
  3044. color: #fff;
  3045. background: #36c75a;
  3046. }
  3047. &.isWrong {
  3048. border: 1rpx solid #eeeeee;
  3049. color: #fff;
  3050. background: #ff3b30;
  3051. }
  3052. &.isPart {
  3053. border: 1rpx solid #eeeeee;
  3054. color: #fff;
  3055. background: #FFC53D;
  3056. }
  3057. &.isOver {
  3058. border: 1rpx solid #eeeeee;
  3059. color: #fff;
  3060. background: blue;
  3061. }
  3062. &.check_ans {
  3063. border: 1rpx solid #eeeeee;
  3064. color: #fff;
  3065. background: #007aff;
  3066. }
  3067. }
  3068. .answerInfos {
  3069. padding: 25rpx 25rpx 25rpx 23rpx;
  3070. }
  3071. .answerTitle {
  3072. margin-bottom: 28rpx;
  3073. color: #666;
  3074. font-size: 30rpx;
  3075. }
  3076. .answerContent {
  3077. font-size: 30rpx;
  3078. color: #666;
  3079. }
  3080. .textChild {
  3081. display: inline-block;
  3082. vertical-align: middle;
  3083. }
  3084. .dialog {
  3085. position: fixed;
  3086. left: 0;
  3087. top: 0;
  3088. width: 100%;
  3089. height: 100%;
  3090. background-color: rgba(0, 0, 0, 0.8);
  3091. display: flex;
  3092. flex-direction: column;
  3093. align-items: center;
  3094. justify-content: center;
  3095. z-index: 20000;
  3096. .text {
  3097. font-size: 32rpx;
  3098. color: #ffffff;
  3099. text-align: center;
  3100. }
  3101. .btn {
  3102. width: 242rpx;
  3103. height: 82rpx;
  3104. border: 2rpx solid #ffffff;
  3105. border-radius: 16rpx;
  3106. text-align: center;
  3107. line-height: 82rpx;
  3108. margin: 41rpx auto;
  3109. color: #fff;
  3110. font-size: 32rpx;
  3111. }
  3112. }
  3113. .dialog-arrow {
  3114. padding-top: 124rpx;
  3115. position: fixed;
  3116. left: 0;
  3117. top: 0;
  3118. width: 100%;
  3119. height: 100%;
  3120. background-color: rgba(0, 0, 0, 0.8);
  3121. z-index: 20000;
  3122. .pointer {
  3123. margin-left: 87rpx;
  3124. display: block;
  3125. width: 95rpx;
  3126. height: 98rpx;
  3127. }
  3128. .text {
  3129. padding-left: 177rpx;
  3130. font-size: 32rpx;
  3131. color: #ffffff;
  3132. }
  3133. .btn {
  3134. width: 242rpx;
  3135. height: 82rpx;
  3136. border: 2rpx solid #ffffff;
  3137. border-radius: 16rpx;
  3138. text-align: center;
  3139. line-height: 82rpx;
  3140. margin: 500rpx auto 0;
  3141. color: #fff;
  3142. font-size: 32rpx;
  3143. }
  3144. }
  3145. .dialog_wrap {
  3146. position: fixed;
  3147. left: 0;
  3148. top: 0;
  3149. width: 100%;
  3150. height: 100%;
  3151. z-index: 9999999999;
  3152. .bg {
  3153. background: rgba(0, 0, 0, 0.3);
  3154. position: absolute;
  3155. left: 0;
  3156. top: 0;
  3157. width: 100%;
  3158. height: 100%;
  3159. }
  3160. .dialog {
  3161. position: absolute;
  3162. left: 50%;
  3163. top: 50%;
  3164. transform: translate3D(-50%, -50%, 0);
  3165. width: 640rpx;
  3166. height: 439rpx;
  3167. background: #ffffff;
  3168. border-radius: 24rpx;
  3169. .title {
  3170. font-size: 30rpx;
  3171. font-weight: bold;
  3172. color: #333333;
  3173. line-height: 48rpx;
  3174. text-align: center;
  3175. margin-top: 40rpx;
  3176. }
  3177. .content {
  3178. margin: 35rpx 35rpx 0;
  3179. font-size: 30rpx;
  3180. color: #666666;
  3181. line-height: 48rpx;
  3182. }
  3183. .btns {
  3184. margin-top: 35rpx;
  3185. display: flex;
  3186. align-items: center;
  3187. justify-content: center;
  3188. .btn {
  3189. width: 200rpx;
  3190. height: 80rpx;
  3191. line-height: 80rpx;
  3192. text-align: center;
  3193. background: #f5f5f5;
  3194. border-radius: 40rpx;
  3195. font-size: 30rpx;
  3196. color: rgba(0, 122, 255, 1);
  3197. background: #f5f5f5;
  3198. margin: 0 20rpx;
  3199. &.active {
  3200. color: #f5f5f5;
  3201. background: rgba(0, 122, 255, 1);
  3202. }
  3203. }
  3204. }
  3205. }
  3206. }
  3207. .popboxs {
  3208. width: 100%;
  3209. height: 100%;
  3210. display: flex;
  3211. flex-direction: column;
  3212. align-items: center;
  3213. }
  3214. .classTops {
  3215. flex-shrink: 0;
  3216. padding: 39rpx 0rpx 4rpx;
  3217. font-weight: bold;
  3218. color: #333;
  3219. font-size: 30rpx;
  3220. }
  3221. .textStys {
  3222. width: 100%;
  3223. flex: 1;
  3224. padding: 36rpx;
  3225. }
  3226. .classFootsty {
  3227. flex-shrink: 0;
  3228. display: flex;
  3229. align-items: center;
  3230. justify-content: center;
  3231. padding: 10rpx 0rpx 40rpx;
  3232. .btnsty {
  3233. width: 200rpx;
  3234. height: 80rpx;
  3235. border-radius: 40rpx;
  3236. font-weight: bold;
  3237. font-size: 30rpx;
  3238. text-align: center;
  3239. line-height: 80rpx;
  3240. }
  3241. .btns1 {
  3242. background-color: #f5f5f5;
  3243. color: #007aff;
  3244. }
  3245. .btns2 {
  3246. margin-left: 40rpx;
  3247. background-color: #007aff;
  3248. color: #ffffff;
  3249. }
  3250. }
  3251. </style>