questionBank.vue 61 KB

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