questionBank.vue 93 KB

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