questionBank.vue 100 KB

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