questionBank.vue 98 KB

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