questionBank.vue 60 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379
  1. <template>
  2. <view class="questionBank">
  3. <uni-nav-bar @clickLeft="clickLeft" left-icon="back" :statusBar="true" title="试卷"></uni-nav-bar>
  4. <swiper class="swiper" :current="current" @change="swiperChange" :interval="interval">
  5. <swiper-item v-for="(bank, bankIndex) in questionList" :key="bankIndex">
  6. <view class="pageContent">
  7. <view class="pad_8 titBox">
  8. <view class="firstLetter">
  9. <view class="leftLetters">
  10. <view class="btnType">
  11. <text v-if="bank.type == 1">单选</text>
  12. <text v-if="bank.type == 2">多选</text>
  13. <text v-if="bank.type == 3">判断</text>
  14. <text v-if="bank.type == 4">案例</text>
  15. <text v-if="bank.type == 5">简答</text>
  16. </view>
  17. <text>{{ bankIndex + 1 }}/{{ questionList.length }}</text>
  18. </view>
  19. <view style="color: #666;font-size: 28rpx;">{{ countdown(lastTime) }}</view>
  20. <view class="leftLetters"></view>
  21. </view>
  22. <view class="titles"><rich-text :nodes="bank.content"></rich-text></view>
  23. </view>
  24. <template v-if="bank.type == 1">
  25. <view class="pad_8 titBox no-margin">
  26. <view v-if="!bank.ques">
  27. <view v-for="(item, index) in bank.jsonStr" :key="index" class="lisSty" @click="radioSelect(item.optionsId, bankIndex)">
  28. <view class="activeTI">{{ ast[index] }}</view>
  29. <view class="flex_auto">{{ item.content }}</view>
  30. </view>
  31. </view>
  32. <view v-if="bank.ques">
  33. <view v-for="(item, index) in bank.jsonStr" :key="index" class="lisSty">
  34. <text
  35. :class="{ right: item.optionsId == bank.ques || item.optionsId == bank.ans, wrong: item.optionsId == bank.ques && bank.ques != bank.ans }"
  36. class="activeTI"
  37. >
  38. {{ ast[index] }}
  39. </text>
  40. <view class="flex_auto">{{ item.content }}</view>
  41. </view>
  42. </view>
  43. <view v-if="bank.ques">
  44. <view class="pad_8 answer">
  45. <view>正确答案:{{ ast[bank.ans - 1] }}</view>
  46. <view>我的答案:{{ ast[bank.ques - 1] }}</view>
  47. </view>
  48. <view class="pad_8 answerInfos">
  49. <view class="answerTitle">答案解析</view>
  50. <view class="answerContent"><rich-text :nodes="bank.analysisContent"></rich-text></view>
  51. </view>
  52. </view>
  53. </view>
  54. </template>
  55. <template v-if="bank.type == 2">
  56. <view class="pad_8 titBox no-margin">
  57. <view v-if="!bank.ques">
  58. <view v-for="(item, index) in bank.jsonStr" :key="index" class="lisSty" @click="checkboxSelect(item.optionsId, bankIndex, index)">
  59. <view :class="{ checked: item.checked }" class="activeTI">{{ ast[index] }}</view>
  60. <view class="flex_auto">{{ item.content }}</view>
  61. </view>
  62. </view>
  63. <view v-if="!bank.ques" class="submit_checkbox" @click="checkboxSubmit(bankIndex)">确认答案</view>
  64. <view v-if="bank.ques">
  65. <view v-for="(item, index) in bank.jsonStr" :key="index" class="lisSty">
  66. <text
  67. :class="{
  68. right: bank.ques.indexOf(item.optionsId) != -1 || bank.ans.indexOf(item.optionsId) != -1,
  69. wrong: bank.ques.indexOf(item.optionsId) != -1 && bank.ans.indexOf(item.optionsId) == -1
  70. }"
  71. class="activeTI"
  72. >
  73. {{ ast[index] }}
  74. </text>
  75. <view class="flex_auto">{{ item.content }}</view>
  76. </view>
  77. </view>
  78. <view v-if="bank.ques">
  79. <view class="pad_8 answer">
  80. <view>
  81. 正确答案:
  82. <text v-for="(ansItem,ansItemIndex) in bank.ans" :key="ansItemIndex">{{ ast[ansItem - 1] }}</text>
  83. </view>
  84. <view>
  85. 我的答案:
  86. <text v-for="(quesItem,quesItemIndex) in bank.ques" :key="quesItemIndex">{{ ast[quesItem - 1] }}</text>
  87. </view>
  88. </view>
  89. <view class="pad_8 answerInfos">
  90. <view class="answerTitle">答案解析</view>
  91. <view class="answerContent"><rich-text :nodes="bank.analysisContent"></rich-text></view>
  92. </view>
  93. </view>
  94. </view>
  95. </template>
  96. <template v-if="bank.type == 3">
  97. <view class="pad_8 titBox no-margin">
  98. <view v-if="!bank.ques">
  99. <view v-for="(item, index) in judge" :key="index" class="lisSty" @click="judgeSelect(index, bankIndex)">
  100. <view class="activeTI">{{ ast[index] }}</view>
  101. {{ item }}
  102. </view>
  103. </view>
  104. <view v-if="bank.ques">
  105. <view v-for="(item, index) in judge" :key="index" class="lisSty">
  106. <text :class="{ right: index == bank.ques || index == bank.ans, wrong: index == bank.ques && bank.ques != bank.ans }" class="activeTI">
  107. {{ ast[index] }}
  108. </text>
  109. {{ item }}
  110. </view>
  111. </view>
  112. <view v-if="bank.ques">
  113. <view class="pad_8 answer">
  114. <view>正确答案:{{ ast[bank.ans] }}</view>
  115. <view>我的答案:{{ ast[bank.ques] }}</view>
  116. </view>
  117. <view class="pad_8 answerInfos">
  118. <view class="answerTitle">答案解析</view>
  119. <view class="answerContent"><rich-text :nodes="bank.analysisContent"></rich-text></view>
  120. </view>
  121. </view>
  122. </view>
  123. </template>
  124. <!-- 简答题 -->
  125. <template v-if="bank.type == 5">
  126. <view class="pad_8 titBox">
  127. <view class="ans">
  128. <view class="ans_input" v-if="!bank.ques || (!bank.ques.text && !bank.ques.imageList.length)">
  129. <view class="top flex">
  130. <image :data-index="bankIndex" class="icon" @click="chooseImg(bankIndex)" src="/static/camera.png" mode=""></image>
  131. <view class="progress">{{bank.ansText.imageList.length || '0'}}/4</view>
  132. <view class="submit" :class="{disabled:!bank.ansText.text && hasImgs(bank)}" @click="submitAns(bankIndex)">确认答案</view>
  133. </view>
  134. <view class="textarea"><textarea v-model="bank.ansText.text" placeholder="在此输入答案"></textarea></view>
  135. <view class="imgs">
  136. <view class="img" v-for="(img, imgIndex) in bank.ansText.imageList" :key="imgIndex">
  137. <text @click="deleteImg(imgIndex, bankIndex)">x</text>
  138. <image :src="$method.splitImgHost(img, true)"></image>
  139. </view>
  140. </view>
  141. </view>
  142. <view class="ans_submit answerInfos" v-if="bank.ques">
  143. <view class="answerTitle">我的答案:</view>
  144. {{ bank.ques.text }}
  145. <view class="imgs"><image class="img" v-for="(ques,quesIndex) in bank.ques.imageList" :key="quesIndex" :src="$method.splitImgHost(ques, true)"></image></view>
  146. </view>
  147. </view>
  148. <view v-if="bank.ques">
  149. <view class="pad_8 answerInfos">
  150. <view class="answerTitle">答案解析:</view>
  151. <view class="answerContent"><rich-text :nodes="bank.analysisContent"></rich-text></view>
  152. </view>
  153. </view>
  154. </view>
  155. </template>
  156. <!-- 案例题 -->
  157. <template v-if="bank.type == 4">
  158. <view class="pad_8 titBox">
  159. <view class="tabs">
  160. <view
  161. class="tab"
  162. :class="{ current: tabIndex == bank.current }"
  163. :key="tabIndex"
  164. v-for="(tab, tabIndex) in bank.jsonStr"
  165. @click="tabSelect(tabIndex, bankIndex)"
  166. >
  167. 问题{{ tabIndex }}
  168. </view>
  169. </view>
  170. <view v-for="(ansItem, ansIndex) in bank.jsonStr" v-if="bank.current == ansIndex" :key="ansIndex">
  171. <view class="titles"><rich-text :nodes="ansItem.content"></rich-text></view>
  172. <template v-if="ansItem.type == 1">
  173. <view v-if="!bank.ques[ansIndex]">
  174. <view
  175. v-for="(option, childIndex) in ansItem.optionsList"
  176. :key="childIndex"
  177. class="lisSty"
  178. @click="radioSelectChild(option.optionsId, ansIndex, bankIndex)"
  179. >
  180. <view class="activeTI">{{ ast[childIndex] }}</view>
  181. <rich-text class="textChild" :nodes="option.content"></rich-text>
  182. </view>
  183. </view>
  184. <view v-if="bank.ques[ansIndex]">
  185. <view v-for="(option, childIndex) in ansItem.optionsList" :key="childIndex" class="lisSty">
  186. <text
  187. :class="{
  188. right: option.optionsId == bank.ques[ansIndex] || option.optionsId == bank.ans[ansIndex],
  189. wrong: option.optionsId == bank.ques[ansIndex] && bank.ques[ansIndex] != bank.ans[ansIndex]
  190. }"
  191. class="activeTI"
  192. >
  193. {{ ast[childIndex] }}
  194. </text>
  195. <rich-text :nodes="option.content"></rich-text>
  196. </view>
  197. </view>
  198. <view v-if="bank.ques[ansIndex]">
  199. <view class="pad_8 answer">
  200. <view>正确答案:{{ ast[bank.ans[ansIndex] - 1] }}</view>
  201. <view>我的答案:{{ ast[bank.ques[ansIndex] - 1] }}</view>
  202. </view>
  203. <view class="pad_8 answerInfos">
  204. <view class="answerTitle">答案解析</view>
  205. <view class="answerContent"><rich-text :nodes="option.analysisContent"></rich-text></view>
  206. </view>
  207. </view>
  208. </template>
  209. <template v-if="ansItem.type == 2">
  210. <view v-if="!bank.ques[ansIndex]">
  211. <view
  212. v-for="(option, childindex) in ansItem.optionsList"
  213. :key="childindex"
  214. class="lisSty"
  215. @click="checkboxSelectChild(bankIndex, ansIndex, childindex)"
  216. >
  217. <view :class="{ checked: option.checked }" class="activeTI">{{ ast[childindex] }}</view>
  218. <rich-text :nodes="option.content"></rich-text>
  219. </view>
  220. </view>
  221. <view v-if="!bank.ques[ansIndex]" class="submit_checkbox" @click="checkboxSubmitChild(bankIndex, ansIndex)">确认答案</view>
  222. <view v-if="bank.ques && bank.ques[ansIndex]">
  223. <view v-for="(option, childindex) in ansItem.optionsList" :key="childindex" class="lisSty">
  224. <text :class="{ right: right(bankIndex, ansIndex, option), wrong: wrong(bankIndex, ansIndex, option) }" class="activeTI">
  225. {{ ast[childindex] }}
  226. </text>
  227. <rich-text :nodes="option.content"></rich-text>
  228. </view>
  229. </view>
  230. <view v-if="bank.ques[ansIndex]">
  231. <view class="pad_8 answer">
  232. <view>
  233. 正确答案:
  234. <text :key="ansItemIndex1" v-for="(ansItem1,ansItemIndex1) in bank.ans[ansIndex]">{{ ast[ansItem1 - 1] }}</text>
  235. </view>
  236. <view>
  237. 我的答案:
  238. <text :key="quesItemIndex" v-for="(quesItem,quesItemIndex) in bank.ques[ansIndex]">{{ ast[quesItem - 1] }}</text>
  239. </view>
  240. </view>
  241. <view class="pad_8 answerInfos">
  242. <view class="answerTitle">答案解析</view>
  243. <view class="answerContent"><rich-text :nodes="ansItem.analysisContent"></rich-text></view>
  244. </view>
  245. </view>
  246. </template>
  247. <template v-if="ansItem.type == 3">
  248. <view v-if="!bank.ques[ansIndex]">
  249. <view v-for="(option, childindex) in judge" :key="childindex" class="lisSty" @click="judgeSelectChild(ansIndex, childindex, bankIndex)">
  250. <view class="activeTI">{{ ast[childindex] }}</view>
  251. {{ option }}
  252. </view>
  253. </view>
  254. <view v-if="bank.ques[ansIndex]">
  255. <view v-for="(option, childindex) in judge" :key="childindex" class="lisSty">
  256. <text
  257. :class="{
  258. right: childindex == bank.ques[ansIndex] || childindex == bank.ans[ansIndex],
  259. wrong: childindex == bank.ques[ansIndex] && bank.ques[ansIndex] != bank.ans[ansIndex]
  260. }"
  261. class="activeTI"
  262. >
  263. {{ ast[childindex] }}
  264. </text>
  265. {{ option }}
  266. </view>
  267. </view>
  268. <view v-if="bank.ques[ansIndex]">
  269. <view class="pad_8 answer">
  270. <view>正确答案:{{ ast[bank.ans[ansIndex]] }}</view>
  271. <view>我的答案:{{ ast[bank.ques[ansIndex]] }}</view>
  272. </view>
  273. <view class="pad_8 answerInfos">
  274. <view class="answerTitle">答案解析</view>
  275. <view class="answerContent"><rich-text :nodes="ansItem.analysisContent"></rich-text></view>
  276. </view>
  277. </view>
  278. </template>
  279. <!-- 简答题 -->
  280. <template v-if="ansItem.type == 5">
  281. <view class="ans">
  282. <view class="ans_input" v-if="!bank.ques[ansIndex] || (!bank.ques[ansIndex].text && !bank.ques[ansIndex].imageList.length)">
  283. <view class="top flex">
  284. <image class="icon" @click="chooseImgChild(bankIndex, ansIndex)" src="/static/08-10_032.jpg" mode=""></image>
  285. <view class="progress">{{ansItem.ansText.imageList.length || '0'}}/4</view>
  286. <view class="submit" @click="submitAnsChild(bankIndex, ansIndex)">确认答案</view>
  287. </view>
  288. <view class="textarea"><textarea v-model="ansItem.ansText.text" placeholder="在此输入答案"></textarea></view>
  289. <view class="imgs">
  290. <view class="img" :key="imgIndex" v-for="(img, imgIndex) in ansItem.ansText.imageList">
  291. <text @click="deleteImgChild(imgIndex, bankIndex, ansIndex)">x</text>
  292. <image :src="$method.splitImgHost(img, true)"></image>
  293. </view>
  294. </view>
  295. </view>
  296. <view class="ans_submit answerInfos" v-if="bank.ques[ansIndex]">
  297. <view class="answerTitle">我的答案</view>
  298. {{ bank.ques[ansIndex].text }}
  299. <view class="imgs">
  300. <image class="img" :key="quesIndex" v-for="(ques,quesIndex) in bank.ques[ansIndex].imageList" :src="$method.splitImgHost(ques, true)"></image>
  301. </view>
  302. </view>
  303. </view>
  304. <view v-if="bank.ques[ansIndex]">
  305. <view class="pad_8 answerInfos">
  306. <view class="answerTitle">答案解析</view>
  307. <view class="answerContent"><rich-text :nodes="ansItem.analysisContent"></rich-text></view>
  308. </view>
  309. </view>
  310. </template>
  311. </view>
  312. </view>
  313. </template>
  314. <view class="footer_btn">
  315. <view class="collect">
  316. <view v-if="collectList[bankIndex]">
  317. <image src="/static/icon/collected.png" mode=""></image>
  318. <view>取消收藏</view>
  319. </view>
  320. </view>
  321. <view class="flex_center" @click="openFooterTab">
  322. <view class="up-icon">
  323. <image src="/static/up.png"></image>
  324. </view>
  325. 答题卡
  326. </view>
  327. <view class="collect show" @click="pdsubmit">
  328. <view>
  329. <image src="/static/jj.png" mode=""></image>
  330. <view>交卷</view>
  331. </view>
  332. </view>
  333. </view>
  334. </view>
  335. </swiper-item>
  336. </swiper>
  337. <u-popup v-model="show" mode="bottom" border-radius="14" height="680rpx">
  338. <view class="popupView">
  339. <view class="popupTops">
  340. <view class="topIcon"></view>
  341. 点击编号即可跳转至对应题目
  342. </view>
  343. <view class="popupContent">
  344. <scroll-view scroll-y="true" style="height: 506rpx;">
  345. <view class="boxSty">
  346. <view
  347. v-for="(item, index) in questionList"
  348. :key="index"
  349. @click="changeIndex(index)"
  350. :class="{ isRight: isRight(item, index), isWrong: isWrong(item, index) }"
  351. class="liListSty"
  352. >
  353. {{ index + 1 }}
  354. </view>
  355. </view>
  356. </scroll-view>
  357. </view>
  358. </view>
  359. </u-popup>
  360. <view class="dialog" v-if="showDialog">
  361. <view class="text">左右滑动切换上下题</view>
  362. <view class="btn" @click="hideDialog">我知道了</view>
  363. </view>
  364. <view class="dialog_wrap" v-if="testOver">
  365. <view class="bg"></view>
  366. <view class="dialog">
  367. <view class="title">温馨提示</view>
  368. <view class="content">
  369. <view>您已完成所有题目,</view>
  370. <view>快去交卷吧!</view>
  371. </view>
  372. <view class="btns">
  373. <view class="btn" @click="noSubmit()">暂不交卷</view>
  374. <view class="btn active" @click="submitNow()">立即交卷</view>
  375. </view>
  376. </view>
  377. </view>
  378. <view class="dialog_wrap" v-if="isLastCount">
  379. <view class="bg"></view>
  380. <view class="dialog">
  381. <view class="title">温馨提示</view>
  382. <view class="content">
  383. <view>您当前正在测试,还剩{{ lastCount }}道题未完成,离开视为交卷</view>
  384. </view>
  385. <view class="btns">
  386. <view class="btn" @click="noLeave()">暂不离开</view>
  387. <view class="btn active" @click="leaveNow()">继续离开</view>
  388. </view>
  389. </view>
  390. </view>
  391. <u-popup v-model="showpopups" mode="center" border-radius="24" height="439rpx" width="640rpx" :mask-close-able="false">
  392. <view class="popboxs">
  393. <view class="classTops">温馨提示</view>
  394. <view class="textStys">
  395. {{
  396. cgType === 7
  397. ? '您还未交卷,确定结束做题吗?'
  398. : cgType === 8
  399. ? `您还有${lastCount}道题未作答, 现在继续作答,还是下次继续?`
  400. : cgType === 6
  401. ? `您还有${lastCount}道题未作答, 您确定要交卷吗?`
  402. : ''
  403. }}
  404. </view>
  405. <view class="classFootsty" v-if="cgType === 6">
  406. <view class="btnsty btns1" @click="submit">立即交卷</view>
  407. <view class="btnsty btns2" @click="showpopups = false">继续做题</view>
  408. </view>
  409. <view class="classFootsty" v-if="cgType === 7">
  410. <view class="btnsty btns1" @click="showpopups = false">下次继续</view>
  411. <view class="btnsty btns2" @click="backPages">结束做题</view>
  412. </view>
  413. <view class="classFootsty" v-if="cgType === 8">
  414. <view class="btnsty btns1" @click="leaveNow()">下次继续</view>
  415. <view class="btnsty btns2" @click="showpopups = false">继续作答</view>
  416. </view>
  417. </view>
  418. </u-popup>
  419. <u-mask :show="photoPopup" >
  420. <!-- 播放前拍照start -->
  421. <view v-if="photoPopup" :mask-close-able="false" style="bottom: 0;position: fixed;width: 100%;z-index: 999;">
  422. <view class="photoBox">
  423. <view class="photoTop">
  424. <view class="sqzz" v-if="false"><u-icon name="close" color="#333333" size="30" @click="closePhoto"></u-icon></view>
  425. <view class="centersq">请正视手机屏幕</view>
  426. <view class="sqzz"></view>
  427. </view>
  428. <view class="photoCenter">
  429. <view style="width: 100%; height: 979rpx;position: fixed;" v-if="photoPopup">
  430. <camera device-position="front" flash="off" @error="error" style="width: 100%; height: 100%;" ></camera>
  431. </view>
  432. <view class="custom"><image src="@/pages2/static/zhezhao.png" mode=""></image></view>
  433. </view>
  434. <view class="btnResult" @click="takePhoto">拍照</view>
  435. </view>
  436. </view>
  437. </u-mask>
  438. </view>
  439. </template>
  440. <script>
  441. export default {
  442. data() {
  443. return {
  444. photoPopup:false,
  445. showpopups: false,
  446. id: '',
  447. current: 0,
  448. questionList: [],
  449. ast: ['A', 'B', 'C', 'D', 'E', 'F', 'G'],
  450. judge: ['错误', '正确'],
  451. ans: [],
  452. ques: [],
  453. show: false,
  454. showDialog: false,
  455. bankList: [],
  456. collectList: [],
  457. goodsId: '',
  458. recordId: '',
  459. isSubmit: false,
  460. lastTime: 0, //剩余考试时长
  461. allTimes: 0, //总考试时长
  462. timer: null,
  463. wrongList: [],
  464. bankType: 0, //试卷类型
  465. needBack: false, //是否是考试
  466. testOver: false,
  467. isLastCount: false, //是否有未答题目
  468. lastCount: 0, //剩余没有回答的题目数
  469. chapterId: 0,
  470. moduleId: 0,
  471. isFromVideo:'',
  472. gradeId:'',
  473. courseId:0,
  474. cgType: 0 ,//对应设计稿弹窗编码,
  475. avatarUrl:'',
  476. ossAvatarUrl: '',
  477. goodsDetail:{},
  478. isTakePhoto:false,
  479. needPhoto:false //是否需要拍照
  480. };
  481. },
  482. onLoad(option) {
  483. this.id = option.id;
  484. this.goodsId = option.goodsid;
  485. this.chapterId = option.chapterId;
  486. this.courseId = option.courseId;
  487. this.moduleId = option.moduleId;
  488. this.isFromVideo = option.isFromVideo||'';
  489. this.gradeId = option.gradeId || '';
  490. let isBack = option.isback;
  491. let showDialog = uni.getStorageSync('showDialog');
  492. if(showDialog) {
  493. this.showDialog = false;
  494. } else {
  495. this.showDialog = true;
  496. uni.setStorageSync('showDialog','1');
  497. }
  498. //考试时候用手势或者返回键 被迫返回做题
  499. if (isBack) {
  500. console.log(getApp());
  501. let app = getApp();
  502. let globalData = app.globalData;
  503. for (var k in globalData.bankData) {
  504. this[k] = globalData.bankData[k];
  505. }
  506. //需要拍没拍过直接弹出摄像头
  507. if(this.needPhoto && !this.isTakePhoto) {
  508. this.photoPopup = true;
  509. } else { //不需要拍照
  510. if(this.lastTime) {
  511. this.timer = setInterval(() => {
  512. if (this.lastTime <= 0) {
  513. clearInterval(this.timer);
  514. uni.showToast({
  515. icon:'none',
  516. mask:true,
  517. title:'考试时间已到,系统将自动交卷',
  518. duration:10000
  519. })
  520. this.submit();
  521. return;
  522. }
  523. this.lastTime--;
  524. }, 1000);
  525. }
  526. }
  527. } else {
  528. this.goodsQuestionList();
  529. this.bankExam();
  530. this.getGoodsDetail()
  531. }
  532. },
  533. onUnload() {
  534. if (this.isSubmit) {
  535. clearInterval(this.timer)
  536. return;
  537. }
  538. //考试试卷 阻止ios手势返回,自动跳回答题页
  539. if (this.needBack) {
  540. let app = getApp();
  541. app.globalData.bankData = this.$data;
  542. clearInterval(this.timer);
  543. uni.navigateTo({
  544. url: '/pages2/class/questionBank?id=' + this.id + '&goodsid=' + this.goodsId + '&isback=true'
  545. });
  546. } else {
  547. //点击返回按钮确认允许退出,交卷
  548. clearInterval(this.timer)
  549. this.examRecordEdit();
  550. }
  551. },
  552. methods: {
  553. getGoodsDetail() {
  554. let self = this
  555. this.$api.goodsDetail(this.goodsId).then(res => {
  556. self.goodsDetail = res.data.data;
  557. if (self.goodsDetail.goodsPhotoExamConfig) {
  558. let goodsPhotoExamConfig = JSON.parse(self.goodsDetail.goodsPhotoExamConfig);
  559. if (goodsPhotoExamConfig.photograph > 0) {
  560. self.needPhoto = true;
  561. }
  562. }
  563. });
  564. },
  565. postStudyRecord() {
  566. let self = this
  567. let data = {
  568. photo: self.ossAvatarUrl,
  569. recordId: self.recordId
  570. };
  571. this.$api.studyExamPhotoRecord(data).then(res => {
  572. self.ossAvatarUrl = ''
  573. self.isTakePhoto = true;
  574. //拍照
  575. if(this.lastTime) {
  576. this.timer = setInterval(() => {
  577. if (this.lastTime <= 0) {
  578. clearInterval(this.timer);
  579. uni.showToast({
  580. icon:'none',
  581. mask:true,
  582. title:'考试时间已到,系统将自动交卷',
  583. duration:10000
  584. })
  585. this.submit();
  586. return;
  587. }
  588. this.lastTime--;
  589. }, 1000);
  590. }
  591. });
  592. },
  593. uploadFile(options, int) {
  594. var self = this;
  595. return new Promise((resolve, reject) => {
  596. var data = {
  597. imageStatus: int
  598. };
  599. self.$api.aliyunpolicy(data).then(res => {
  600. if (res.data.code != 200) {
  601. self.$method.showToast('签名错误' + JSON.stringify(res.data));
  602. return;
  603. }
  604. var ossToken = res.data.data.resultContent;
  605. if (ossToken.host == null || ossToken.host == undefined) {
  606. self.$method.showToast('上传路径报错' + JSON.stringify(res.data));
  607. return;
  608. }
  609. uni.uploadFile({
  610. url: ossToken.host,
  611. name: 'file',
  612. filePath: options,
  613. fileType: 'image',
  614. header: {
  615. AuthorizationToken: 'WX ' + uni.getStorageSync('token')
  616. },
  617. formData: {
  618. key: ossToken.dir,
  619. OSSAccessKeyId: ossToken.accessid,
  620. policy: ossToken.policy,
  621. Signature: ossToken.signature,
  622. callback: ossToken.callback,
  623. success_action_status: 200
  624. },
  625. success: result => {
  626. if (result.statusCode === 200) {
  627. self.ossAvatarUrl = ossToken.dir;
  628. resolve();
  629. } else {
  630. uni.showToast({
  631. title: '上传失败',
  632. icon: 'none'
  633. });
  634. return;
  635. }
  636. },
  637. fail: error => {
  638. uni.showToast({
  639. title: '上传接口报错' + error,
  640. icon: 'none'
  641. });
  642. return;
  643. }
  644. });
  645. });
  646. });
  647. },
  648. imageInfos() {
  649. var self = this;
  650. return new Promise((resolve, reject) => {
  651. uni.getImageInfo({
  652. src: self.avatarUrl,
  653. success: async res => {
  654. let canvasWidth = res.width; //图片原始长宽
  655. let canvasHeight = res.height;
  656. if (canvasWidth > 1000 || canvasHeight > 1000) {
  657. uni.compressImage({
  658. src: self.avatarUrl,
  659. quality: 75,
  660. width: '50%',
  661. height: '50%',
  662. success: async rest => {
  663. const waitUpload = await self.uploadFile(rest.tempFilePath, 0);
  664. resolve();
  665. }
  666. });
  667. } else {
  668. console.log('无需压缩');
  669. const waitUpload = await self.uploadFile(self.avatarUrl, 0);
  670. resolve();
  671. }
  672. }
  673. });
  674. });
  675. },
  676. async submitPhoto() {
  677. const waitYS = await this.imageInfos();
  678. this.postStudyRecord(); //提交记录
  679. },
  680. //确认拍照
  681. takePhoto() {
  682. var self = this;
  683. const ctx = uni.createCameraContext();
  684. ctx.takePhoto({
  685. quality: 'high',
  686. success: res => {
  687. console.log(res.tempImagePath);
  688. self.avatarUrl = res.tempImagePath;
  689. self.submitPhoto();
  690. self.photoPopup = false;
  691. },
  692. fail: err => {
  693. console.log(err);
  694. }
  695. });
  696. },
  697. /**
  698. * 是否有上传图片
  699. */
  700. hasImgs(bank) {
  701. return bank.ansText.imageList.length == 0;
  702. },
  703. /**
  704. * 获取试卷类型2考试,1练习
  705. */
  706. bankExam() {
  707. this.$api.bankExam(this.id).then(res => {
  708. this.bankType = res.data.data.doType;
  709. if (this.bankType == 2) {
  710. this.needBack = true;
  711. }
  712. });
  713. },
  714. /**
  715. * 点击后退按钮
  716. */
  717. clickLeft() {
  718. if (this.bankType == 1) {
  719. let ansCount = this.questionOverNum(); //已答题数
  720. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  721. //所有题目答完
  722. if (this.lastCount == 0) {
  723. // this.testOver = true;
  724. this.cgType = 7;
  725. //未答完
  726. } else {
  727. this.cgType = 8;
  728. // this.isLastCount = true;
  729. }
  730. this.showpopups = true;
  731. } else if (this.bankType == 2) {
  732. let ansCount = this.questionOverNum(); //已答题数
  733. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  734. //所有题目答完
  735. if (this.lastCount == 0) {
  736. this.testOver = true;
  737. //未答完
  738. } else {
  739. this.isLastCount = true;
  740. }
  741. }
  742. },
  743. /**
  744. * 返回上一页
  745. */
  746. backPages() {
  747. this.needBack = false;
  748. uni.navigateBack({
  749. delta: 1
  750. });
  751. },
  752. /**
  753. * 获取已经回答的题目数
  754. * hasSpecail (是否包含简答和案例)
  755. */
  756. questionOverNum(hasSpecail) {
  757. let count = 0;
  758. this.questionList.forEach(item => {
  759. if (item.type == 1 || item.type == 2 || item.type == 3) {
  760. if (item.ques) {
  761. count++;
  762. }
  763. } else if (item.type == 4) {
  764. //案例题
  765. if(hasSpecail) {
  766. let isOver = item.jsonStr.every((jsonItem, indexs) => {
  767. if (jsonItem.type == 1 || jsonItem.type == 2 || jsonItem.type == 3) {
  768. if (item.ques[indexs]) {
  769. return true;
  770. } else {
  771. return false;
  772. }
  773. } else if (jsonItem.type == 5) {
  774. console.log(jsonItem, 111);
  775. if (item.ques[indexs] && (item.ques[indexs].text.length || item.ques[indexs].imageList.length)) {
  776. return true;
  777. } else {
  778. return false;
  779. }
  780. }
  781. });
  782. if (isOver) {
  783. count++;
  784. console.log(item, 444);
  785. }
  786. }
  787. } else if (item.type == 5) {
  788. //简答题
  789. if(hasSpecail) {
  790. if (item.ques && (item.ques.text.length || item.ques.imageList.length)) {
  791. count++;
  792. }
  793. }
  794. }
  795. });
  796. return count;
  797. },
  798. /**
  799. * 暂不交卷
  800. */
  801. noSubmit() {
  802. //设为允许退出页面
  803. this.needBack = false;
  804. uni.navigateBack({
  805. delta: 1
  806. });
  807. },
  808. /**
  809. * 不离开
  810. */
  811. noLeave() {
  812. this.isLastCount = false;
  813. },
  814. /**
  815. * 立即离开并交卷
  816. */
  817. leaveNow() {
  818. this.isSubmit = true;
  819. uni.navigateBack({
  820. delta: 1
  821. });
  822. let score = 0; //计算总分
  823. let reportStatus = 0;
  824. let number = 0;
  825. let passScore = 0;
  826. let allScore = 0; //总分
  827. this.questionList.forEach((item, index) => {
  828. passScore = item.passScore
  829. if (item.type == 1) {
  830. if (item.ques == item.ans) {
  831. item.scoreResult = item.score;
  832. score += item.score;
  833. number++;
  834. } else {
  835. item.scoreResult = 0;
  836. }
  837. allScore += item.score;
  838. } else if (item.type == 2) {
  839. let isRight =
  840. item.ques &&
  841. item.ques.every((quesItem, quesIndex) => {
  842. return item.ques[quesIndex] == item.ans[quesIndex];
  843. });
  844. if (isRight) { //全对
  845. item.scoreResult = item.score;
  846. score += item.score;
  847. number++;
  848. } else {
  849. let checkboxScore = item.score; //获取单题总分数
  850. item.ques && item.ques.forEach((ques,quesIndex) => {
  851. //选错一个全扣
  852. if(item.ques) {
  853. if(item.ans.indexOf(item.ques[quesIndex]) == -1) {
  854. checkboxScore = 0;
  855. }
  856. } else {
  857. checkboxScore = 0;
  858. }
  859. })
  860. //没选错
  861. if(checkboxScore) {
  862. item.ans.forEach((ans,quesIndex) => {
  863. //漏选扣一部分
  864. if(item.ques) {
  865. if(item.ques.indexOf(item.ans[quesIndex]) == -1) {
  866. checkboxScore -= item.partScore;
  867. }
  868. } else {
  869. checkboxScore = 0;
  870. }
  871. })
  872. }
  873. if(checkboxScore <= 0) {
  874. item.scoreResult = 0;
  875. } else {
  876. item.scoreResult = checkboxScore;
  877. }
  878. score += checkboxScore;
  879. }
  880. allScore += item.score;
  881. } else if (item.type == 3) {
  882. if (item.ques == item.ans) {
  883. item.scoreResult = item.score;
  884. score += item.score;
  885. number++;
  886. } else {
  887. item.scoreResult = 0;
  888. }
  889. allScore += item.score;
  890. }
  891. });
  892. if(score >= passScore) {
  893. reportStatus = 1
  894. } else {
  895. reportStatus = 0
  896. }
  897. this.$api
  898. .bankRecordEdit({
  899. chapterId:this.chapterId || 0,
  900. moduleId:this.moduleId || 0,
  901. examId: this.id,
  902. goodsId: this.goodsId,
  903. recordId:this.recordId,
  904. courseId:this.courseId,
  905. reportStatus:reportStatus,
  906. rightQuestionNum: number,
  907. status: 1,
  908. gradeId:this.gradeId,
  909. performance: score,
  910. totalScore: allScore,
  911. // examTime: parseInt(this.allTimes),
  912. // doTime: parseInt(this.allTimes) - parseInt(this.lastTime),
  913. // historyExamJson: JSON.stringify(this.questionList)
  914. })
  915. .then(res => {});
  916. },
  917. /**
  918. * 立即交卷
  919. */
  920. submitNow() {
  921. this.showpopups = false;
  922. this.needBack = false;
  923. this.submit();
  924. },
  925. /**
  926. * 离开页面统计回答正确题数
  927. */
  928. examRecordEdit() {
  929. if (!this.isSubmit) {
  930. let number = 0;
  931. let score = 0;
  932. let doQuestionNum = 0;
  933. let reportStatus = 0;
  934. this.questionList.forEach((item, index) => {
  935. if (item.type == 1) {
  936. if (item.ques == item.ans) {
  937. score += item.score;
  938. number++;
  939. }
  940. if (item.ques) {
  941. doQuestionNum++;
  942. }
  943. } else if (item.type == 2) {
  944. let isRight =
  945. item.ques &&
  946. item.ques.every((quesItem, quesIndex) => {
  947. return item.ques[quesIndex] == item.ans[quesIndex];
  948. });
  949. if (isRight) {
  950. score += item.score;
  951. number++;
  952. } else {
  953. let checkboxScore = item.score; //获取单题总分数
  954. item.ques.forEach((ques,quesIndex) => {
  955. //选错一个全扣
  956. if(item.ques) {
  957. if(item.ans.indexOf(item.ques[quesIndex]) == -1) {
  958. checkboxScore = 0;
  959. }
  960. } else {
  961. checkboxScore = 0;
  962. }
  963. })
  964. //没选错
  965. if(checkboxScore) {
  966. item.ans.forEach((ans,quesIndex) => {
  967. //漏选扣一部分
  968. if(item.ques) {
  969. if(item.ques.indexOf(item.ans[quesIndex]) == -1) {
  970. checkboxScore -= item.partScore;
  971. }
  972. } else {
  973. checkboxScore = 0;
  974. }
  975. })
  976. }
  977. if(checkboxScore <= 0) {
  978. item.scoreResult = 0;
  979. } else {
  980. item.scoreResult = checkboxScore;
  981. score += checkboxScore;
  982. number++;
  983. }
  984. }
  985. if (item.ques && item.ques.length) {
  986. doQuestionNum++;
  987. }
  988. } else if (item.type == 3) {
  989. if (item.ques == item.ans) {
  990. score += item.score;
  991. number++;
  992. }
  993. if (item.ques) {
  994. doQuestionNum++;
  995. }
  996. } else if (item == 4) {
  997. if (item.ques.length) {
  998. doQuestionNum++;
  999. }
  1000. } else if (item.type == 5) {
  1001. if (item.ques) {
  1002. doQuestionNum++;
  1003. }
  1004. }
  1005. });
  1006. if(score >= 60) {
  1007. reportStatus = 1
  1008. }
  1009. this.$api
  1010. .bankRecordEdit({
  1011. chapterId:this.chapterId || 0,
  1012. moduleId:this.moduleId || 0,
  1013. gradeId:this.gradeId,
  1014. examId: this.id,
  1015. courseId:this.courseId,
  1016. goodsId: this.goodsId,
  1017. recordId:this.recordId,
  1018. performance:score,
  1019. reportStatus:reportStatus,
  1020. status: 1,
  1021. // historyExamJson: JSON.stringify(this.questionList)
  1022. })
  1023. .then(res => {});
  1024. }
  1025. },
  1026. /**
  1027. * @param {Object} second倒计时过滤器
  1028. */
  1029. countdown(second) {
  1030. if (second) {
  1031. let h = parseInt((second / 60 / 60) % 24); // 计算小时
  1032. let m = parseInt((second / 60) % 60); // 计算分数
  1033. let s = parseInt(second % 60); // 计算当前秒数
  1034. if (h < 10) h = '0' + h;
  1035. if (m < 10) m = '0' + m;
  1036. if (s < 10) s = '0' + s;
  1037. return h + ':' + m + ':' + s;
  1038. } else {
  1039. return '';
  1040. }
  1041. },
  1042. /**
  1043. * 请求题目列表
  1044. */
  1045. goodsQuestionList() {
  1046. this.$api
  1047. .goodsQuestionList({
  1048. examId: this.id
  1049. })
  1050. .then(res => {
  1051. if (!res.data.data.length) {
  1052. this.hideDialog();
  1053. uni.showModal({
  1054. showCancel: false,
  1055. content: '该试卷暂无题目',
  1056. success: function(k) {
  1057. if (k.confirm) {
  1058. uni.navigateBack();
  1059. }
  1060. }
  1061. });
  1062. return;
  1063. }
  1064. this.allTimes = res.data.data[0].answerTime * 60;
  1065. this.lastTime = res.data.data[0].answerTime && res.data.data[0].answerTime * 60;
  1066. res.data.data.forEach((item, index) => {
  1067. if (typeof item.jsonStr == 'string') {
  1068. item.jsonStr = JSON.parse(item.jsonStr);
  1069. if (item.type == 2) {
  1070. //多选
  1071. item.jsonStr.forEach(str => {
  1072. str.optionsId = '' + str.optionsId;
  1073. });
  1074. let arr = item.answerQuestion.split(',');
  1075. arr.forEach((a, i) => {
  1076. arr[i] = '' + a;
  1077. });
  1078. item.ans = arr;
  1079. return;
  1080. } else if (item.type == 5) {
  1081. //简答题
  1082. item.ansText = {
  1083. text: '',
  1084. imageList: []
  1085. };
  1086. item.ques = {
  1087. text: '',
  1088. imageList: []
  1089. }
  1090. } else if (item.type == 4) {
  1091. //案例题
  1092. console.log(item.jsonStr);
  1093. item.ques = [];
  1094. item.current = 0;
  1095. let ansArr = [];
  1096. item.jsonStr.forEach((json, index) => {
  1097. if (json.type == 1) {
  1098. ansArr[index] = json.answerQuestion;
  1099. } else if (json.type == 2) {
  1100. json.optionsList.forEach(str => {
  1101. str.optionsId = '' + str.optionsId;
  1102. });
  1103. let arr = json.answerQuestion.split(',');
  1104. arr.forEach((a, i) => {
  1105. arr[i] = '' + a;
  1106. });
  1107. ansArr[index] = arr;
  1108. } else if (json.type == 3) {
  1109. ansArr[index] = json.answerQuestion;
  1110. } else if (json.type == 5) {
  1111. ansArr[index] = {
  1112. text: '',
  1113. imageList: []
  1114. };
  1115. json.ansText = {
  1116. text: '',
  1117. imageList: []
  1118. };
  1119. }
  1120. });
  1121. item.ans = ansArr;
  1122. return;
  1123. }
  1124. item.ans = item.answerQuestion;
  1125. }
  1126. });
  1127. this.questionList = res.data.data;
  1128. this.lastCount = this.questionList.length;
  1129. this.examRecord();
  1130. });
  1131. },
  1132. /**
  1133. * 记录总题数
  1134. * hasSpecial (是否包含简答和案例) true 包含 false 不包含
  1135. */
  1136. examRecord(hasSpecial) {
  1137. let self = this
  1138. let questionList = 0;
  1139. if(!hasSpecial) {
  1140. this.questionList.forEach((item, index) => {
  1141. if(item.type == 1 || item.type == 2 || item.type == 3) {
  1142. questionList++;
  1143. }
  1144. })
  1145. } else {
  1146. questionList = this.questionList.length;
  1147. }
  1148. this.$api
  1149. .bankRecord({
  1150. chapterExamId: this.chapterId || 0,
  1151. moduleExamId: this.moduleId || 0,
  1152. examId: this.id,
  1153. goodsId: this.goodsId,
  1154. gradeId:this.gradeId,
  1155. totalQuestionNum: questionList
  1156. })
  1157. .then(res => {
  1158. this.recordId = res.data.data;
  1159. if(self.needPhoto){
  1160. self.photoPopup = true; //拍照
  1161. } else {
  1162. if(this.lastTime) {
  1163. this.timer = setInterval(() => {
  1164. if (this.lastTime <= 0) {
  1165. clearInterval(this.timer);
  1166. uni.showToast({
  1167. icon:'none',
  1168. mask:true,
  1169. title:'考试时间已到,系统将自动交卷',
  1170. duration:10000
  1171. })
  1172. this.submit();
  1173. return;
  1174. }
  1175. this.lastTime--;
  1176. }, 1000);
  1177. }
  1178. }
  1179. });
  1180. },
  1181. /**
  1182. * @param {Object} e单选点击
  1183. */
  1184. radioSelect(optionsId, bindex) {
  1185. if (this.questionList[bindex].ques) return;
  1186. this.$set(this.questionList[bindex], 'ques', optionsId);
  1187. },
  1188. /**
  1189. * @param {Object} e案例单选点击
  1190. */
  1191. radioSelectChild(optionsId, ansIndex, bindex) {
  1192. if (this.questionList[bindex].ques[ansIndex]) return;
  1193. this.$set(this.questionList[bindex].ques, ansIndex, optionsId);
  1194. },
  1195. /**
  1196. * @param {Object} 多选点击
  1197. */
  1198. checkboxSelect(optionsId, bindex, index) {
  1199. this.$set(this.questionList[bindex].jsonStr[index], 'checked', !this.questionList[bindex].jsonStr[index].checked);
  1200. },
  1201. /**
  1202. * @param {Object} 案例多选点击
  1203. */
  1204. checkboxSelectChild(bindex, ansIndex, childIndex) {
  1205. this.$set(this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex], 'checked', !this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex].checked);
  1206. },
  1207. /**
  1208. * @param {Object} 多选确认
  1209. */
  1210. checkboxSubmit(bindex) {
  1211. if (this.questionList[bindex].ques) return;
  1212. let arr = [];
  1213. this.questionList[bindex].jsonStr.forEach(item => {
  1214. if (item.checked) {
  1215. arr.push(item.optionsId);
  1216. }
  1217. });
  1218. this.$set(this.questionList[bindex], 'ques', arr);
  1219. let isWrong = this.questionList[bindex].ques.some((quesItem, quesIndex) => {
  1220. return this.questionList[bindex].ques[quesIndex] != this.questionList[bindex].ans[quesIndex];
  1221. });
  1222. },
  1223. /**
  1224. * @param {Object} 案例多选确认
  1225. */
  1226. checkboxSubmitChild(bindex, ansIndex) {
  1227. if (this.questionList[bindex].ques[ansIndex]) return;
  1228. let arr = [];
  1229. this.questionList[bindex].jsonStr[ansIndex].optionsList.forEach(item => {
  1230. if (item.checked) {
  1231. arr.push(item.optionsId);
  1232. }
  1233. });
  1234. this.$set(this.questionList[bindex].ques, ansIndex, arr);
  1235. },
  1236. /**
  1237. * @param {Object} index
  1238. * @param {Object} bindex
  1239. * 判断题
  1240. */
  1241. judgeSelect(index, bindex) {
  1242. if (this.questionList[bindex].ques) return;
  1243. this.$set(this.questionList[bindex], 'ques', index + '');
  1244. },
  1245. /**
  1246. * @param {Object} ansindex
  1247. * @param {Object} childindex
  1248. * @param {Object} bindex
  1249. * 案例判断题
  1250. */
  1251. judgeSelectChild(ansindex, childindex, bindex) {
  1252. if (this.questionList[bindex].ques[ansindex]) return;
  1253. this.$set(this.questionList[bindex].ques, ansindex, childindex + '');
  1254. },
  1255. openFooterTab() {
  1256. this.show = true;
  1257. },
  1258. hideDialog() {
  1259. this.showDialog = false;
  1260. },
  1261. changeIndex(index) {
  1262. this.current = index;
  1263. },
  1264. swiperChange(e) {
  1265. this.current = e.detail.current;
  1266. },
  1267. pdsubmit() {
  1268. if (this.bankType == 1) {
  1269. let ansCount = this.questionOverNum(); //已答题数
  1270. this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
  1271. //没有答完
  1272. if (this.lastCount !== 0) {
  1273. this.cgType = 6;
  1274. this.showpopups = true;
  1275. return;
  1276. }
  1277. }
  1278. this.submit();
  1279. },
  1280. /**
  1281. * 交卷
  1282. */
  1283. submit() {
  1284. let score = 0; //计算总分
  1285. let reportStatus = 0;
  1286. let number = 0; //做对的题目数量
  1287. let doQuestionNum = 0; //做过的题目数量
  1288. let allScore = 0; //总分
  1289. let passScore = 0;
  1290. let doWrongQuestionIds = []; //错题和未做题id(客观题)
  1291. let doQuestionIds = []; //做过的题目id
  1292. let rightQuestionIds = []; //做对的题目id
  1293. this.questionList.forEach((item, index) => {
  1294. passScore = item.passScore
  1295. if (item.type == 1) {
  1296. //正确
  1297. if (item.ques == item.ans) {
  1298. item.scoreResult = item.score;
  1299. score += item.score;
  1300. number++;
  1301. rightQuestionIds.push(item.questionId)
  1302. } else { //错误
  1303. item.scoreResult = 0;
  1304. doWrongQuestionIds.push(item.questionId)
  1305. }
  1306. allScore += item.score;
  1307. if (item.ques) {
  1308. doQuestionNum++;
  1309. doQuestionIds.push(item.questionId)
  1310. }
  1311. } else if (item.type == 2) {
  1312. let isRight =
  1313. item.ans &&
  1314. item.ans.every((quesItem, quesIndex) => {
  1315. if(item.ques) {
  1316. return item.ques[quesIndex] == item.ans[quesIndex];
  1317. } else {
  1318. return false;
  1319. }
  1320. });
  1321. if (isRight) {
  1322. score += item.score;
  1323. number++;
  1324. item.scoreResult = item.score;
  1325. rightQuestionIds.push(item.questionId)
  1326. } else {
  1327. let checkboxScore = item.score; //获取单题总分数
  1328. item.ques && item.ques.forEach((ques,quesIndex) => {
  1329. //选错一个全扣
  1330. if(item.ques) {
  1331. if(item.ans.indexOf(item.ques[quesIndex]) == -1) {
  1332. checkboxScore = 0;
  1333. }
  1334. } else {
  1335. checkboxScore = 0;
  1336. }
  1337. })
  1338. console.log(checkboxScore)
  1339. //没选错
  1340. if(checkboxScore) {
  1341. item.ans.forEach((ans,quesIndex) => {
  1342. //漏选扣一部分
  1343. if(item.ques) {
  1344. if(item.ques.indexOf(item.ans[quesIndex]) == -1) {
  1345. checkboxScore -= item.partScore;
  1346. }
  1347. } else {
  1348. checkboxScore = 0;
  1349. }
  1350. })
  1351. }
  1352. if(checkboxScore <= 0) { //0分
  1353. item.scoreResult = 0;
  1354. doWrongQuestionIds.push(item.questionId)
  1355. } else { //部分分
  1356. number++;
  1357. item.scoreResult = checkboxScore;
  1358. score += checkboxScore;
  1359. rightQuestionIds.push(item.questionId)
  1360. }
  1361. }
  1362. allScore += item.score;
  1363. if (item.ques && item.ques.length) {
  1364. doQuestionNum++;
  1365. doQuestionIds.push(item.questionId)
  1366. }
  1367. } else if (item.type == 3) {
  1368. if (item.ques == item.ans) {
  1369. item.scoreResult = item.score;
  1370. score += item.score;
  1371. number++;
  1372. rightQuestionIds.push(item.questionId)
  1373. } else {
  1374. item.scoreResult = 0;
  1375. doWrongQuestionIds.push(item.questionId)
  1376. }
  1377. allScore += item.score;
  1378. if (item.ques) {
  1379. doQuestionNum++;
  1380. doQuestionIds.push(item.questionId)
  1381. }
  1382. } else if (item.type == 4) {
  1383. if (item.ques && item.ques.length) {
  1384. doQuestionNum++;
  1385. }
  1386. } else if (item.type == 5) {
  1387. if (item.ques) {
  1388. doQuestionNum++;
  1389. }
  1390. }
  1391. });
  1392. //大于分及格
  1393. if(score >= passScore) {
  1394. reportStatus = 1
  1395. } else {
  1396. reportStatus = 0
  1397. }
  1398. //交卷
  1399. this.$api
  1400. .bankRecordEdit({
  1401. moduleId:this.moduleId || 0,
  1402. chapterId:this.chapterId || 0,
  1403. gradeId:this.gradeId,
  1404. examId: this.id,
  1405. goodsId: this.goodsId,
  1406. reportStatus:reportStatus,
  1407. recordId: this.recordId,
  1408. courseId:this.courseId,
  1409. // rightQuestionNum: number,
  1410. status: 1,
  1411. // doQuestionIds:doQuestionIds.join(','),
  1412. // rightQuestionIds:rightQuestionIds.join(','),
  1413. // doQuestionNum: doQuestionNum,
  1414. performance: score,
  1415. totalScore: allScore,
  1416. // examTime: parseInt(this.allTimes),
  1417. // doTime: parseInt(this.allTimes) - parseInt(this.lastTime),
  1418. // historyExamJson: JSON.stringify(this.questionList)
  1419. })
  1420. .then(res => {
  1421. this.isSubmit = true;
  1422. if (res.data.code == 200) {
  1423. uni.showToast({
  1424. title: '交卷成功',
  1425. duration: 1000,
  1426. mask:true,
  1427. icon: 'none'
  1428. });
  1429. setTimeout(() => {
  1430. uni.redirectTo({
  1431. url: '/pages2/class/question_report?rightQuestionNum='+number+'&doWrongQuestionNum='+doWrongQuestionIds.length+'&score='+score+'&totalScore='+allScore+'&reportStatus='+reportStatus
  1432. });
  1433. }, 1000);
  1434. }
  1435. });
  1436. },
  1437. /**
  1438. * @param {Object} imgIndex
  1439. * @param {Object} bankIndex
  1440. * 删除简答图片
  1441. */
  1442. deleteImg(imgIndex, bankIndex) {
  1443. this.questionList[bankIndex].ansText.imageList.splice(imgIndex, 1);
  1444. },
  1445. /**
  1446. * @param {Object} imgIndex
  1447. * @param {Object} bankIndex
  1448. * @param {Object} ansIndex
  1449. * 删除案例题简答图片
  1450. */
  1451. deleteImgChild(imgIndex, bankIndex, ansIndex) {
  1452. this.questionList[bankIndex].jsonStr[ansIndex].ansText.imageList.splice(imgIndex, 1);
  1453. },
  1454. /**
  1455. * @param {Object} bankindex
  1456. * 选择上传图片
  1457. */
  1458. chooseImg(bankindex) {
  1459. if(this.questionList[bankindex] && this.questionList[bankindex].ansText && this.questionList[bankindex].ansText.imageList.length >= 4) {
  1460. uni.showToast({
  1461. icon:'none',
  1462. title:'最多选择4张'
  1463. })
  1464. return;
  1465. }
  1466. uni.chooseImage({
  1467. count: 1, //默认9
  1468. sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
  1469. sourceType: ['album', 'camera'], //从相册选择
  1470. success: res => {
  1471. let self = this;
  1472. // console.log(JSON.stringify(res.tempFilePaths));
  1473. let img = res.tempFilePaths[0];
  1474. uni.getImageInfo({
  1475. src: img,
  1476. success: async res => {
  1477. let canvasWidth = res.width; //图片原始长宽
  1478. let canvasHeight = res.height;
  1479. if (canvasWidth > 1000 || canvasHeight > 1000) {
  1480. uni.compressImage({
  1481. src: img,
  1482. quality: 75,
  1483. width: '50%',
  1484. height: '50%',
  1485. success: async rest => {
  1486. const dir = await self.uploadFile(rest.tempFilePath, 0);
  1487. this.questionList[bankindex].ansText.imageList.push(dir);
  1488. }
  1489. });
  1490. } else {
  1491. const dir = await self.uploadFile(img, 0);
  1492. this.questionList[bankindex].ansText.imageList.push(dir);
  1493. }
  1494. }
  1495. });
  1496. }
  1497. });
  1498. },
  1499. /**
  1500. * @param {Object} bankindex
  1501. * @param {Object} ansindex
  1502. * 案例题选择上传图片
  1503. */
  1504. chooseImgChild(bankindex, ansindex) {
  1505. uni.chooseImage({
  1506. count: 1, //默认9
  1507. sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
  1508. sourceType: ['album', 'camera'], //从相册选择
  1509. success: res => {
  1510. let self = this;
  1511. // console.log(JSON.stringify(res.tempFilePaths));
  1512. let img = res.tempFilePaths[0];
  1513. uni.getImageInfo({
  1514. src: img,
  1515. success: async res => {
  1516. let canvasWidth = res.width; //图片原始长宽
  1517. let canvasHeight = res.height;
  1518. if (canvasWidth > 1000 || canvasHeight > 1000) {
  1519. uni.compressImage({
  1520. src: img,
  1521. quality: 75,
  1522. width: '50%',
  1523. height: '50%',
  1524. success: async rest => {
  1525. const dir = await self.uploadFile(rest.tempFilePath, 0);
  1526. this.questionList[bankindex].jsonStr[ansindex].ansText.imageList.push(dir);
  1527. }
  1528. });
  1529. } else {
  1530. const dir = await self.uploadFile(img, 0);
  1531. this.questionList[bankindex].jsonStr[ansindex].ansText.imageList.push(dir);
  1532. }
  1533. }
  1534. });
  1535. }
  1536. });
  1537. },
  1538. uploadFile(options, int) {
  1539. var self = this;
  1540. return new Promise((resolve, reject) => {
  1541. var data = {
  1542. imageStatus: int
  1543. };
  1544. self.$api.aliyunpolicy(data).then(res => {
  1545. console.log(res.data, 6);
  1546. if (res.data.code != 200) {
  1547. self.$method.showToast('签名错误' + JSON.stringify(res.data));
  1548. return;
  1549. }
  1550. var ossToken = res.data.data.resultContent;
  1551. if (ossToken.host == null || ossToken.host == undefined) {
  1552. self.$method.showToast('上传路径报错' + JSON.stringify(res.data));
  1553. return;
  1554. }
  1555. uni.uploadFile({
  1556. url: ossToken.host,
  1557. name: 'file',
  1558. filePath: options,
  1559. fileType: 'image',
  1560. header: {
  1561. AuthorizationToken: 'WX ' + uni.getStorageSync('token')
  1562. },
  1563. formData: {
  1564. key: ossToken.dir,
  1565. OSSAccessKeyId: ossToken.accessid,
  1566. policy: ossToken.policy,
  1567. Signature: ossToken.signature,
  1568. callback: ossToken.callback,
  1569. success_action_status: 200
  1570. },
  1571. success: result => {
  1572. if (result.statusCode === 200) {
  1573. self.ossAvatarUrl = ossToken.dir;
  1574. resolve(ossToken.dir);
  1575. } else {
  1576. uni.showToast({
  1577. title: '上传失败',
  1578. icon: 'none'
  1579. });
  1580. return;
  1581. }
  1582. },
  1583. fail: error => {
  1584. uni.showToast({
  1585. title: '上传接口报错' + error,
  1586. icon: 'none'
  1587. });
  1588. return;
  1589. }
  1590. });
  1591. });
  1592. });
  1593. },
  1594. /**
  1595. * @param {Object} type
  1596. * @param {Object} bankindex
  1597. * 简答题答案确认
  1598. */
  1599. submitAns(bankindex) {
  1600. console.log(this.questionList[bankindex]);
  1601. if (!this.questionList[bankindex].ansText.text && !this.questionList[bankindex].ansText.imageList.length) {
  1602. uni.showToast({
  1603. title: '请输入内容或上传图片',
  1604. duration: 2000,
  1605. icon: 'none'
  1606. });
  1607. return;
  1608. }
  1609. this.$set(this.questionList[bankindex], 'ques', {
  1610. imageList: this.questionList[bankindex].ansText.imageList,
  1611. text: this.questionList[bankindex].ansText.text
  1612. });
  1613. },
  1614. /**
  1615. * @param {Object} bankindex
  1616. * @param {Object} ansindex
  1617. * 案例题简答答案确认
  1618. */
  1619. submitAnsChild(bankindex, ansindex) {
  1620. if (!this.questionList[bankindex].jsonStr[ansindex].ansText.text && !this.questionList[bankindex].jsonStr[ansindex].ansText.imageList.length) {
  1621. uni.showToast({
  1622. title: '请输入内容或上传图片',
  1623. duration: 2000,
  1624. icon: 'none'
  1625. });
  1626. return;
  1627. }
  1628. this.$set(this.questionList[bankindex].ques, ansindex, {
  1629. imageList: this.questionList[bankindex].jsonStr[ansindex].ansText.imageList,
  1630. text: this.questionList[bankindex].jsonStr[ansindex].ansText.text
  1631. });
  1632. },
  1633. isRight(item, index) {
  1634. //单选
  1635. if (this.questionList[index].ques) {
  1636. if (item.type == 1) {
  1637. return this.questionList[index].ques == this.questionList[index].ans;
  1638. //多选
  1639. } else if (item.type == 2) {
  1640. //每一项都相等
  1641. return this.questionList[index].ques.every((item, i) => {
  1642. return item == this.questionList[index].ans[i];
  1643. });
  1644. //判断
  1645. } else if (item.type == 3) {
  1646. return this.questionList[index].ques == this.questionList[index].ans;
  1647. // } else if (item.type == 5) {
  1648. // if(this.questionList[index].ques.text){
  1649. // return true
  1650. // }else{
  1651. // return false
  1652. // }
  1653. } else {
  1654. return false;
  1655. }
  1656. } else {
  1657. return false;
  1658. }
  1659. },
  1660. right(bankIndex, ansIndex, option) {
  1661. if (this.questionList[bankIndex].ques[ansIndex] && this.questionList[bankIndex].ans[ansIndex]) {
  1662. if (this.questionList[bankIndex].ques[ansIndex].indexOf(option.optionsId) != -1 || this.questionList[bankIndex].ans[ansIndex].indexOf(option.optionsId) != -1) {
  1663. return true;
  1664. } else {
  1665. return false;
  1666. }
  1667. } else {
  1668. return false;
  1669. }
  1670. },
  1671. wrong(bankIndex, ansIndex, option) {
  1672. if (this.questionList[bankIndex].ques[ansIndex] && this.questionList[bankIndex].ans[ansIndex]) {
  1673. if (this.questionList[bankIndex].ques[ansIndex].indexOf(option.optionsId) != -1 && this.questionList[bankIndex].ans[ansIndex].indexOf(option.optionsId) == -1) {
  1674. return true;
  1675. } else {
  1676. return false;
  1677. }
  1678. } else {
  1679. return false;
  1680. }
  1681. },
  1682. isWrong(item, index) {
  1683. if (this.questionList[index].ques) {
  1684. //单选
  1685. if (item.type == 1) {
  1686. return this.questionList[index].ques != this.questionList[index].ans;
  1687. //多选
  1688. } else if (item.type == 2) {
  1689. //每一项都相等
  1690. return this.questionList[index].ques.some((item, index) => {
  1691. return item != this.questionList[index].ans;
  1692. });
  1693. //判断
  1694. } else if (item.type == 3) {
  1695. return this.questionList[index].ques != this.questionList[index].ans;
  1696. } else {
  1697. return false;
  1698. }
  1699. } else {
  1700. return false;
  1701. }
  1702. },
  1703. tabSelect(index, bankindex) {
  1704. this.$set(this.questionList[bankindex], 'current', index);
  1705. }
  1706. }
  1707. };
  1708. </script>
  1709. <style lang="scss" scoped>
  1710. .photoBox {
  1711. background-color: #FFFFFF;
  1712. border-radius: 32px 32px 0px 0px;
  1713. .photoTop {
  1714. height: 74upx;
  1715. display: flex;
  1716. align-items: center;
  1717. justify-content: space-between;
  1718. padding: 0upx 38upx;
  1719. .sqzz {
  1720. width: 28upx;
  1721. height: 28upx;
  1722. display: flex;
  1723. align-items: center;
  1724. justify-content: center;
  1725. }
  1726. .centersq {
  1727. color: #333;
  1728. font-size: 30upx;
  1729. font-weight: 500;
  1730. }
  1731. }
  1732. .photoCenter {
  1733. width: 750upx;
  1734. height: 979upx;
  1735. position: relative;
  1736. .custom {
  1737. width: 750upx;
  1738. height: 979upx;
  1739. position: absolute;
  1740. z-index: 1000;
  1741. top: 0;
  1742. left: 0;
  1743. image {
  1744. width: 100%;
  1745. height: 100%;
  1746. }
  1747. }
  1748. }
  1749. .btnResult {
  1750. height: 100rpx;
  1751. width: 100%;
  1752. background-color: #07c160;
  1753. text-align: center;
  1754. line-height: 100upx;
  1755. color: #fff;
  1756. font-size: 32upx;
  1757. font-weight: bold;
  1758. }
  1759. }
  1760. .questionBank {
  1761. width:100%;
  1762. height:100vh;
  1763. display: flex;
  1764. flex-direction: column;
  1765. }
  1766. .swiper {
  1767. width: 100%;
  1768. flex:1;
  1769. }
  1770. .lisSty {
  1771. margin-bottom: 16rpx;
  1772. display: flex;
  1773. .flex_auto {
  1774. flex: 1;
  1775. }
  1776. }
  1777. .activeTI {
  1778. vertical-align: middle;
  1779. display: inline-block;
  1780. border: 1rpx solid #eee;
  1781. border-radius: 50rpx;
  1782. height: 48rpx;
  1783. line-height: 46rpx;
  1784. text-align: center;
  1785. width: 48rpx;
  1786. margin-right: 15rpx;
  1787. color: #666;
  1788. font-size: 30rpx;
  1789. &.right {
  1790. color: #fff;
  1791. background: green;
  1792. }
  1793. &.wrong {
  1794. color: #fff;
  1795. background: red;
  1796. }
  1797. &.checked {
  1798. color: #fff;
  1799. background: blue;
  1800. }
  1801. }
  1802. .submit_checkbox {
  1803. margin: 20rpx auto;
  1804. width: 526rpx;
  1805. height: 80rpx;
  1806. background: rgba(0, 122, 255, 1);
  1807. color: #fff;
  1808. text-align: center;
  1809. line-height: 80rpx;
  1810. font-size: 30rpx;
  1811. border-radius: 40rpx;
  1812. }
  1813. .titles {
  1814. overflow: hidden;
  1815. margin-bottom: 24rpx;
  1816. }
  1817. .titBox {
  1818. padding: 41rpx 25rpx 24rpx 25rpx;
  1819. }
  1820. .tabs {
  1821. margin: 10rpx;
  1822. display: flex;
  1823. .tab {
  1824. margin: 0 10rpx;
  1825. width: 96rpx;
  1826. height: 48rpx;
  1827. line-height: 48rpx;
  1828. text-align: center;
  1829. color: #007aff;
  1830. font-size: 28rpx;
  1831. border-radius: 16rpx;
  1832. &.current {
  1833. color: #fff;
  1834. background: #007aff;
  1835. }
  1836. }
  1837. }
  1838. .ans {
  1839. margin: 8rpx 8rpx 8rpx;
  1840. .ans_input {
  1841. border-radius: 16rpx;
  1842. background: #fff;
  1843. .top {
  1844. border-bottom: 1rpx solid #eeeeee;
  1845. padding: 16rpx;
  1846. display: flex;
  1847. align-items: center;
  1848. .icon {
  1849. margin-right: 20rpx;
  1850. width: 40rpx;
  1851. height: 38rpx;
  1852. }
  1853. .progress {
  1854. flex: 1;
  1855. }
  1856. .submit {
  1857. width: 168rpx;
  1858. height: 48rpx;
  1859. line-height: 48rpx;
  1860. text-align: center;
  1861. color: #fff;
  1862. font-size: 30rpx;
  1863. background: #007aff;
  1864. border-radius: 24rpx;
  1865. &.disabled {
  1866. opacity: 0.6;
  1867. }
  1868. }
  1869. }
  1870. .textarea {
  1871. textarea {
  1872. width: 100%;
  1873. height: 287rpx;
  1874. padding: 10rpx;
  1875. }
  1876. }
  1877. .imgs {
  1878. overflow: hidden;
  1879. display: flex;
  1880. width: 100%;
  1881. .img {
  1882. width: 104rpx;
  1883. height: 104rpx;
  1884. border-radius: 8rpx;
  1885. position: relative;
  1886. margin: 20rpx;
  1887. text {
  1888. position: absolute;
  1889. right: -15rpx;
  1890. top: -15rpx;
  1891. width: 30rpx;
  1892. height: 30rpx;
  1893. text-align: center;
  1894. line-height: 30rpx;
  1895. color: #fff;
  1896. background: red;
  1897. border-radius: 50%;
  1898. }
  1899. image {
  1900. width: 100%;
  1901. height: 100%;
  1902. }
  1903. }
  1904. }
  1905. }
  1906. .ans_submit {
  1907. padding: 16rpx;
  1908. border-radius: 16rpx;
  1909. background: #fff;
  1910. .imgs {
  1911. overflow: hidden;
  1912. display: flex;
  1913. width: 100%;
  1914. .img {
  1915. width: 104rpx;
  1916. height: 104rpx;
  1917. border-radius: 8rpx;
  1918. position: relative;
  1919. margin: 20rpx;
  1920. image {
  1921. width: 100%;
  1922. height: 100%;
  1923. }
  1924. }
  1925. }
  1926. }
  1927. }
  1928. .firstLetter {
  1929. display: flex;
  1930. justify-content: space-between;
  1931. align-items: center;
  1932. margin-bottom: 30rpx;
  1933. .leftLetters {
  1934. display: flex;
  1935. align-items: center;
  1936. width: 220rpx;
  1937. .btnType {
  1938. padding: 5rpx 10rpx;
  1939. border: 1rpx solid #007aff;
  1940. border-radius: 10rpx;
  1941. background-color: rgba(0, 122, 255, 0.1);
  1942. font-size: 28rpx;
  1943. color: #007aff;
  1944. margin-right: 15rpx;
  1945. }
  1946. }
  1947. }
  1948. .popupView {
  1949. height: 100%;
  1950. padding-bottom: 100rpx;
  1951. .popupTops {
  1952. height: 77rpx;
  1953. border-bottom: 1rpx solid #eee;
  1954. text-align: center;
  1955. line-height: 77rpx;
  1956. font-size: 24rpx;
  1957. color: #999;
  1958. position: relative;
  1959. .topIcon {
  1960. position: absolute;
  1961. top: 10rpx;
  1962. left: 50%;
  1963. transform: translateX(-50%);
  1964. width: 80rpx;
  1965. height: 8rpx;
  1966. background-color: #999;
  1967. border-radius: 4rpx;
  1968. }
  1969. }
  1970. .popupContent {
  1971. }
  1972. }
  1973. .pageContent {
  1974. position: relative;
  1975. background-color: #eaeef1;
  1976. height: 100%;
  1977. padding-top: 8rpx;
  1978. padding-bottom: 100rpx;
  1979. overflow-y: scroll;
  1980. }
  1981. .pad_8 {
  1982. background-color: #fff;
  1983. margin: 0rpx 8rpx 8rpx;
  1984. border-radius: 16rpx;
  1985. &.no-margin {
  1986. margin-top:-16rpx;
  1987. border-radius: 0 0 16rpx 16rpx;
  1988. }
  1989. }
  1990. .answer {
  1991. height: 80rpx;
  1992. line-height: 80rpx;
  1993. padding: 0rpx 24rpx;
  1994. display: flex;
  1995. align-items: center;
  1996. justify-content: space-between;
  1997. color: #666;
  1998. font-size: 30rpx;
  1999. }
  2000. .footer_btn {
  2001. background-color: #fff;
  2002. z-index: 10078;
  2003. position: fixed;
  2004. bottom: 0rpx;
  2005. display: flex;
  2006. align-items: center;
  2007. justify-content: space-between;
  2008. width: 100%;
  2009. height: 98rpx;
  2010. padding: 0rpx 38rpx;
  2011. border-top: 1rpx solid #eee;
  2012. .flex_center {
  2013. flex:1;
  2014. display: flex;
  2015. justify-content: center;
  2016. align-items: center;
  2017. flex-direction: column;
  2018. margin:0 200rpx;
  2019. font-size: 24rpx;
  2020. color: #999999;
  2021. .up-icon {
  2022. margin-bottom:18rpx;
  2023. width:100%;
  2024. display: flex;
  2025. justify-content: center;
  2026. image {
  2027. width:58rpx;
  2028. height:21rpx;
  2029. }
  2030. }
  2031. }
  2032. .collect {
  2033. visibility: hidden;
  2034. width:100rpx;
  2035. &.show {
  2036. visibility: visible;
  2037. }
  2038. >view {
  2039. display: flex;
  2040. flex-direction: column;
  2041. align-items: center;
  2042. justify-content: center;
  2043. image {
  2044. width:32rpx;
  2045. height:32rpx;
  2046. margin-bottom:6rpx;
  2047. }
  2048. view {
  2049. font-size: 24rpx;
  2050. color: #999999;
  2051. }
  2052. }
  2053. }
  2054. }
  2055. .boxSty {
  2056. padding: 44rpx 41rpx 0rpx;
  2057. }
  2058. .liListSty {
  2059. border: 1rpx solid #eeeeee;
  2060. width: 88rpx;
  2061. height: 88rpx;
  2062. border-radius: 32rpx;
  2063. text-align: center;
  2064. line-height: 88rpx;
  2065. color: #333;
  2066. font-size: 32rpx;
  2067. float: left;
  2068. margin: 20rpx 23rpx;
  2069. &.isRight {
  2070. border: 1rpx solid #eeeeee;
  2071. color: #fff;
  2072. background: green;
  2073. }
  2074. &.isWrong {
  2075. border: 1rpx solid #eeeeee;
  2076. color: #fff;
  2077. background: red;
  2078. }
  2079. }
  2080. .answerInfos {
  2081. padding: 25rpx 25rpx 25rpx 23rpx;
  2082. }
  2083. .answerTitle {
  2084. margin-bottom: 28rpx;
  2085. color: #666;
  2086. font-size: 30rpx;
  2087. }
  2088. .answerContent {
  2089. font-size: 30rpx;
  2090. color: #666;
  2091. }
  2092. .textChild {
  2093. display: inline-block;
  2094. vertical-align: middle;
  2095. }
  2096. .dialog {
  2097. position: fixed;
  2098. left: 0;
  2099. top: 0;
  2100. width: 100%;
  2101. height: 100%;
  2102. background-color: rgba(0, 0, 0, 0.8);
  2103. display: flex;
  2104. flex-direction: column;
  2105. align-items: center;
  2106. justify-content: center;
  2107. z-index: 20000;
  2108. .text {
  2109. font-size: 32rpx;
  2110. color: #ffffff;
  2111. text-align: center;
  2112. }
  2113. .btn {
  2114. width: 242rpx;
  2115. height: 82rpx;
  2116. border: 2rpx solid #ffffff;
  2117. border-radius: 16rpx;
  2118. text-align: center;
  2119. line-height: 82rpx;
  2120. margin: 41rpx auto;
  2121. color: #fff;
  2122. font-size: 32rpx;
  2123. }
  2124. }
  2125. .dialog_wrap {
  2126. position: fixed;
  2127. left: 0;
  2128. top: 0;
  2129. width: 100%;
  2130. height: 100%;
  2131. z-index: 9999999999;
  2132. .bg {
  2133. background: rgba(0, 0, 0, 0.3);
  2134. position: absolute;
  2135. left: 0;
  2136. top: 0;
  2137. width: 100%;
  2138. height: 100%;
  2139. }
  2140. .dialog {
  2141. position: absolute;
  2142. left: 50%;
  2143. top: 50%;
  2144. transform: translate3D(-50%, -50%, 0);
  2145. width: 640rpx;
  2146. height: 439rpx;
  2147. background: #ffffff;
  2148. border-radius: 24rpx;
  2149. .title {
  2150. font-size: 30rpx;
  2151. font-weight: bold;
  2152. color: #333333;
  2153. line-height: 48rpx;
  2154. text-align: center;
  2155. margin-top: 40rpx;
  2156. }
  2157. .content {
  2158. margin: 35rpx 35rpx 0;
  2159. font-size: 30rpx;
  2160. color: #666666;
  2161. line-height: 48rpx;
  2162. }
  2163. .btns {
  2164. margin-top: 35rpx;
  2165. display: flex;
  2166. align-items: center;
  2167. justify-content: center;
  2168. .btn {
  2169. width: 200rpx;
  2170. height: 80rpx;
  2171. line-height: 80rpx;
  2172. text-align: center;
  2173. background: #f5f5f5;
  2174. border-radius: 40rpx;
  2175. font-size: 30rpx;
  2176. color: rgba(0, 122, 255, 1);
  2177. background: #f5f5f5;
  2178. margin: 0 20rpx;
  2179. &.active {
  2180. color: #f5f5f5;
  2181. background: rgba(0, 122, 255, 1);
  2182. }
  2183. }
  2184. }
  2185. }
  2186. }
  2187. .popboxs {
  2188. width: 100%;
  2189. height: 100%;
  2190. display: flex;
  2191. flex-direction: column;
  2192. align-items: center;
  2193. }
  2194. .classTops {
  2195. flex-shrink: 0;
  2196. padding: 39rpx 0rpx 4rpx;
  2197. font-weight: bold;
  2198. color: #333;
  2199. font-size: 30rpx;
  2200. }
  2201. .textStys {
  2202. width: 100%;
  2203. flex: 1;
  2204. padding: 36rpx;
  2205. }
  2206. .classFootsty {
  2207. flex-shrink: 0;
  2208. display: flex;
  2209. align-items: center;
  2210. justify-content: center;
  2211. padding: 10rpx 0rpx 40rpx;
  2212. .btnsty {
  2213. width: 200rpx;
  2214. height: 80rpx;
  2215. border-radius: 40rpx;
  2216. font-weight: bold;
  2217. font-size: 30rpx;
  2218. text-align: center;
  2219. line-height: 80rpx;
  2220. }
  2221. .btns1 {
  2222. background-color: #f5f5f5;
  2223. color: #007aff;
  2224. }
  2225. .btns2 {
  2226. margin-left: 40rpx;
  2227. background-color: #007aff;
  2228. color: #ffffff;
  2229. }
  2230. }
  2231. </style>