questionBank.vue 99 KB

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