questionBank.vue 97 KB

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