questionBank.vue 61 KB

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