index.vue 94 KB

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