questionBank.vue 100 KB

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