questionBank.vue 91 KB

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