questionBank.vue 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743
  1. <template>
  2. <view id="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">
  23. <rich-text :nodes="bank.content"></rich-text>
  24. </view>
  25. </view>
  26. <view class="pad_8 titBox">
  27. <template v-if="bank.type == 1">
  28. <view v-if="!bank.ques">
  29. <view v-for="(item, index) in bank.jsonStr" :key="index" class="lisSty" @click="radioSelect(item.optionsId,bankIndex)">
  30. <view class="activeTI">{{ ast[index] }}</view>
  31. <view class="flex_auto">{{ item.content }}</view>
  32. </view>
  33. </view>
  34. <view v-if="bank.ques">
  35. <view v-for="(item, index) in bank.jsonStr" :key="index" class="lisSty">
  36. <text :class="{right:(item.optionsId == bank.ques) || (item.optionsId == bank.ans),wrong:(item.optionsId == bank.ques) && (bank.ques != bank.ans)}" class="activeTI">{{ ast[index] }}</text>
  37. <view class="flex_auto">{{ item.content }}</view>
  38. </view>
  39. </view>
  40. <view v-if="bank.ques">
  41. <view class="pad_8 answer">
  42. <view>正确答案:{{ast[bank.ans-1]}}</view>
  43. <view>我的答案:{{ast[bank.ques-1]}}</view>
  44. </view>
  45. <view class="pad_8 answerInfos">
  46. <view class="answerTitle">答案解析</view>
  47. <view class="answerContent">
  48. <rich-text :nodes="bank.analysisContent"></rich-text>
  49. </view>
  50. </view>
  51. </view>
  52. </template>
  53. <template v-if="bank.type == 2">
  54. <view v-if="!bank.ques">
  55. <view v-for="(item, index) in bank.jsonStr" :key="index" class="lisSty" @click="checkboxSelect(item.optionsId,bankIndex,index)">
  56. <view :class="{checked:item.checked}" class="activeTI">{{ ast[index] }}</view>
  57. <view class="flex_auto">{{ item.content }}</view>
  58. </view>
  59. </view>
  60. <view v-if="!bank.ques" class="submit_checkbox" @click="checkboxSubmit(bankIndex)">
  61. 确认答案
  62. </view>
  63. <view v-if="bank.ques">
  64. <view v-for="(item, index) in bank.jsonStr" :key="index" class="lisSty">
  65. <text :class="{right:(bank.ques.indexOf(item.optionsId) != -1 ) || (bank.ans.indexOf(item.optionsId) != -1),wrong:(bank.ques.indexOf(item.optionsId) != -1 ) && (bank.ans.indexOf(item.optionsId) == -1)}" class="activeTI">{{ ast[index] }}</text>
  66. <view class="flex_auto">{{ item.content }}</view>
  67. </view>
  68. </view>
  69. <view v-if="bank.ques">
  70. <view class="pad_8 answer">
  71. <view>正确答案:
  72. <text v-for="ansItem in bank.ans">{{ast[ansItem-1]}}</text>
  73. </view>
  74. <view>我的答案:
  75. <text v-for="quesItem in bank.ques">{{ast[quesItem-1]}}</text>
  76. </view>
  77. </view>
  78. <view class="pad_8 answerInfos">
  79. <view class="answerTitle">答案解析</view>
  80. <view class="answerContent">
  81. <rich-text :nodes="bank.analysisContent"></rich-text>
  82. </view>
  83. </view>
  84. </view>
  85. </template>
  86. <template v-if="bank.type == 3">
  87. <view v-if="!bank.ques">
  88. <view v-for="(item, index) in judge" :key="index" class="lisSty" @click="judgeSelect(index,bankIndex)">
  89. <view class="activeTI">{{ ast[index] }}</view>
  90. {{ item }}
  91. </view>
  92. </view>
  93. <view v-if="bank.ques">
  94. <view v-for="(item, index) in judge" :key="index" class="lisSty">
  95. <text :class="{right:(index == bank.ques) || (index == bank.ans),wrong:(index == bank.ques) && (bank.ques != bank.ans)}" class="activeTI">{{ ast[index] }}</text>
  96. {{ item }}
  97. </view>
  98. </view>
  99. <view v-if="bank.ques">
  100. <view class="pad_8 answer">
  101. <view>正确答案:{{ast[bank.ans]}}</view>
  102. <view>我的答案:{{ast[bank.ques]}}</view>
  103. </view>
  104. <view class="pad_8 answerInfos">
  105. <view class="answerTitle">答案解析</view>
  106. <view class="answerContent">
  107. <rich-text :nodes="bank.analysisContent"></rich-text>
  108. </view>
  109. </view>
  110. </view>
  111. </template>
  112. <!-- 简答题 -->
  113. <template v-if="bank.type == 5">
  114. <view class="ans">
  115. <view class="ans_input" v-if="!bank.ques">
  116. <view class="top flex">
  117. <image :data-index="bankIndex" class="icon" @click="chooseImg(bankIndex)" src="/static/08-10_032.jpg" mode=""></image>
  118. <view class="progress">0/4</view>
  119. <view class="submit" @click="submitAns(bankIndex)" >确认答案</view>
  120. </view>
  121. <view class="textarea">
  122. <textarea v-model="bank.ansText.text" placeholder="在此输入答案"></textarea>
  123. </view>
  124. <view class="imgs">
  125. <view class="img" v-for="(img,imgIndex) in bank.ansText.imageList" >
  126. <text @click="deleteImg(imgIndex,bankIndex)">x</text>
  127. <image :src="$method.splitImgHost(img, true)"></image>
  128. </view>
  129. </view>
  130. </view>
  131. <view class="ans_submit answerInfos" v-if="bank.ques">
  132. <view class="answerTitle">答案我的</view>
  133. {{bank.ques.text}}
  134. <view class="imgs">
  135. <image class="img" v-for="ques in bank.ques.imageList" :src="ques"></image>
  136. </view>
  137. </view>
  138. </view>
  139. <view v-if="bank.ques">
  140. <view class="pad_8 answerInfos">
  141. <view class="answerTitle">答案解析</view>
  142. <view class="answerContent">
  143. <rich-text :nodes="bank.analysisContent"></rich-text>
  144. </view>
  145. </view>
  146. </view>
  147. </template>
  148. <!-- 案例题 -->
  149. <template v-if="bank.type == 4">
  150. <view class="tabs">
  151. <view class="tab" :class="{current:tabIndex == bank.current}" :key="tabIndex" v-for="(tab,tabIndex) in bank.jsonStr" @click="tabSelect(tabIndex,bankIndex)">问题{{tabIndex}}</view>
  152. </view>
  153. <view v-for="(ansItem,ansIndex) in bank.jsonStr" v-if="bank.current == ansIndex" :key="ansIndex">
  154. <view class="titles">
  155. <rich-text :nodes="ansItem.content"></rich-text>
  156. </view>
  157. <template v-if="ansItem.type == 1">
  158. <view v-if="!bank.ques[ansIndex]">
  159. <view v-for="(option, childIndex) in ansItem.optionsList" :key="childIndex" class="lisSty" @click="radioSelectChild(option.optionsId,ansIndex,bankIndex)">
  160. <view class="activeTI">{{ ast[childIndex] }}</view>
  161. <rich-text class="textChild" :nodes="option.content"></rich-text>
  162. </view>
  163. </view>
  164. <view v-if="bank.ques[ansIndex]">
  165. <view v-for="(option, childIndex) in ansItem.optionsList" :key="index" class="lisSty">
  166. <text :class="{right:(option.optionsId == bank.ques[ansIndex]) || (option.optionsId == bank.ans[ansIndex]),wrong:(option.optionsId == bank.ques[ansIndex]) && (bank.ques[ansIndex] != bank.ans[ansIndex])}" class="activeTI">{{ ast[childIndex] }}</text>
  167. <rich-text :nodes="option.content"></rich-text>
  168. </view>
  169. </view>
  170. <view v-if="bank.ques[ansIndex]">
  171. <view class="pad_8 answer">
  172. <view>正确答案:{{ast[bank.ans[ansIndex]-1]}}</view>
  173. <view>我的答案:{{ast[bank.ques[ansIndex]-1]}}</view>
  174. </view>
  175. <view class="pad_8 answerInfos">
  176. <view class="answerTitle">答案解析</view>
  177. <view class="answerContent">
  178. <rich-text :nodes="option.analysisContent"></rich-text>
  179. </view>
  180. </view>
  181. </view>
  182. </template>
  183. <template v-if="ansItem.type == 2">
  184. <view v-if="!bank.ques[ansIndex]">
  185. <view v-for="(option, childindex) in ansItem.optionsList" :key="childindex" class="lisSty" @click="checkboxSelectChild(bankIndex,ansIndex,childindex)">
  186. <view :class="{checked:option.checked}" class="activeTI">{{ ast[childindex] }}</view>
  187. <rich-text :nodes="option.content"></rich-text>
  188. </view>
  189. </view>
  190. <view v-if="!bank.ques[ansIndex]" class="submit_checkbox" @click="checkboxSubmitChild(bankIndex,ansIndex)">
  191. 确认答案
  192. </view>
  193. <view v-if="bank.ques && bank.ques[ansIndex]">
  194. <view v-for="(option, childindex) in ansItem.optionsList" :key="childindex" class="lisSty">
  195. <text :class="{right:right(bankIndex,ansIndex,option),wrong:wrong(bankIndex,ansIndex,option)}" class="activeTI">{{ ast[childindex] }}</text>
  196. <rich-text :nodes="option.content"></rich-text>
  197. </view>
  198. </view>
  199. <view v-if="bank.ques[ansIndex]">
  200. <view class="pad_8 answer">
  201. <view>正确答案:
  202. <text v-for="ansItem1 in bank.ans[ansIndex]">{{ast[ansItem1-1]}}</text>
  203. </view>
  204. <view>我的答案:
  205. <text v-for="quesItem in bank.ques[ansIndex]">{{ast[quesItem-1]}}</text>
  206. </view>
  207. </view>
  208. <view class="pad_8 answerInfos">
  209. <view class="answerTitle">答案解析</view>
  210. <view class="answerContent">
  211. <rich-text :nodes="ansItem.analysisContent"></rich-text>
  212. </view>
  213. </view>
  214. </view>
  215. </template>
  216. <template v-if="ansItem.type == 3">
  217. <view v-if="!bank.ques[ansIndex]">
  218. <view v-for="(option, childindex) in judge" :key="childindex" class="lisSty" @click="judgeSelectChild(ansIndex,childindex,bankIndex)">
  219. <view class="activeTI">{{ ast[childindex] }}</view>
  220. {{ option }}
  221. </view>
  222. </view>
  223. <view v-if="bank.ques[ansIndex]">
  224. <view v-for="(option, childindex) in judge" :key="childindex" class="lisSty">
  225. <text :class="{right:(childindex == bank.ques[ansIndex]) || (childindex == bank.ans[ansIndex]),wrong:(childindex == bank.ques[ansIndex]) && (bank.ques[ansIndex] != bank.ans[ansIndex])}" class="activeTI">{{ ast[childindex] }}</text>
  226. {{ option }}
  227. </view>
  228. </view>
  229. <view v-if="bank.ques[ansIndex]">
  230. <view class="pad_8 answer">
  231. <view>正确答案:{{ast[bank.ans[ansIndex]]}}</view>
  232. <view>我的答案:{{ast[bank.ques[ansIndex]]}}</view>
  233. </view>
  234. <view class="pad_8 answerInfos">
  235. <view class="answerTitle">答案解析</view>
  236. <view class="answerContent">
  237. <rich-text :nodes="ansItem.analysisContent"></rich-text>
  238. </view>
  239. </view>
  240. </view>
  241. </template>
  242. <!-- 简答题 -->
  243. <template v-if="ansItem.type == 5">
  244. <view class="ans">
  245. <view class="ans_input" v-if="!bank.ques[ansIndex]">
  246. <view class="top flex">
  247. <image class="icon" @click="chooseImgChild(bankIndex,ansIndex)" src="/static/08-10_032.jpg" mode=""></image>
  248. <view class="progress">0/4</view>
  249. <view class="submit" @click="submitAnsChild(bankIndex,ansIndex)">确认答案</view>
  250. </view>
  251. <view class="textarea">
  252. <textarea v-model="ansItem.ansText.text" placeholder="在此输入答案"></textarea>
  253. </view>
  254. <view class="imgs">
  255. <view class="img" v-for="(img,imgIndex) in ansItem.ansText.imageList" >
  256. <text @click="deleteImgChild(imgIndex,bankIndex,ansIndex)">x</text>
  257. <image :src="$method.splitImgHost(img, true)"></image>
  258. </view>
  259. </view>
  260. </view>
  261. <view class="ans_submit answerInfos" v-if="bank.ques[ansIndex]">
  262. <view class="answerTitle">答案我的</view>
  263. {{bank.ques[ansIndex].text}}
  264. <view class="imgs">
  265. <image class="img" v-for="ques in bank.ques[ansIndex].imageList" :src="ques"></image>
  266. </view>
  267. </view>
  268. </view>
  269. <view v-if="bank.ques[ansIndex]">
  270. <view class="pad_8 answerInfos">
  271. <view class="answerTitle">答案解析</view>
  272. <view class="answerContent">
  273. <rich-text :nodes="ansItem.analysisContent"></rich-text>
  274. </view>
  275. </view>
  276. </view>
  277. </template>
  278. </view>
  279. </template>
  280. </view>
  281. <view class="footer_btn">
  282. <view class="collect" :class="{show:goodsId?true:false}" @click="collect(collectList[bankIndex],bankIndex)">{{collectList[bankIndex] ?'已收藏' : '未收藏' }}</view>
  283. <view @click="openFooterTab">答题卡</view>
  284. <view @click="submit">交卷</view>
  285. </view>
  286. </view>
  287. </swiper-item>
  288. </swiper>
  289. <u-popup v-model="show" mode="bottom" border-radius="14" height="680rpx">
  290. <view class="popupView">
  291. <view class="popupTops">
  292. <view class="topIcon"></view>
  293. 点击编号即可跳转至对应题目
  294. </view>
  295. <view class="popupContent">
  296. <scroll-view scroll-y="true" style="height: 506rpx;">
  297. <view class="boxSty">
  298. <view v-for="(item, index) in questionList" :key="index" @click="changeIndex(index)" :class="{isRight:isRight(item,index),isWrong:isWrong(item,index)}" class="liListSty">{{ index + 1 }}</view>
  299. </view>
  300. </scroll-view>
  301. </view>
  302. </view>
  303. </u-popup>
  304. <view class="dialog" v-if="showDialog">
  305. <view class="text">左右滑动切换上下题</view>
  306. <view class="btn" @click="hideDialog">我知道了</view>
  307. </view>
  308. <view class="dialog_wrap" v-if="testOver">
  309. <view class="bg"></view>
  310. <view class="dialog">
  311. <view class="title">温馨提示</view>
  312. <view class="content">
  313. <view>您已完成所有题目,</view>
  314. <view>快去交卷吧!</view>
  315. </view>
  316. <view class="btns">
  317. <view class="btn" @click="noSubmit()">暂不交卷</view>
  318. <view class="btn active" @click="submitNow()">立即交卷</view>
  319. </view>
  320. </view>
  321. </view>
  322. <view class="dialog_wrap" v-if="isLastCount">
  323. <view class="bg"></view>
  324. <view class="dialog">
  325. <view class="title">温馨提示</view>
  326. <view class="content">
  327. <view>您当前正在测试,还剩{{lastCount}}道题未完成,离开视为交卷</view>
  328. </view>
  329. <view class="btns">
  330. <view class="btn" @click="noLeave()">暂不离开</view>
  331. <view class="btn active" @click="leaveNow()">继续离开</view>
  332. </view>
  333. </view>
  334. </view>
  335. </view>
  336. </template>
  337. <script>
  338. export default {
  339. data() {
  340. return {
  341. id:'',
  342. current:0,
  343. questionList:[],
  344. ast: ['A', 'B', 'C', 'D','E','F','G'],
  345. judge:['错误','正确'],
  346. ans:[],
  347. ques:[],
  348. show: false,
  349. showDialog:true,
  350. bankList: [],
  351. collectList:[],
  352. goodsId:'',
  353. recordId:'',
  354. isSubmit:false,
  355. lastTime:0,
  356. timer :null,
  357. wrongList:[],
  358. bankType:0, //试卷类型
  359. needBack:false, //是否是考试
  360. testOver:false,
  361. isLastCount:false, //是否有未答题目
  362. lastCount:0, //剩余没有回答的题目数
  363. };
  364. },
  365. onLoad(option){
  366. this.id = option.id;
  367. this.goodsId = option.goodsid;
  368. let isBack = option.isback;
  369. if(isBack) {
  370. console.log(getApp())
  371. let app = getApp();
  372. let globalData = app.globalData;
  373. for(var k in globalData.bankData) {
  374. this[k] = globalData.bankData[k];
  375. }
  376. } else {
  377. this.goodsQuestionList();
  378. // this.wrongRecordExamQuestionList();
  379. this.bankExam();
  380. }
  381. },
  382. onUnload() {
  383. if(this.isSubmit) {
  384. this.examRecordEdit();
  385. return;
  386. }
  387. //考试试卷 阻止ios手势返回,自动跳回答题页
  388. if(this.needBack) {
  389. let app = getApp();
  390. app.globalData.bankData = this.$data;
  391. uni.navigateTo({
  392. url: '/pages2/bank/questionBank?id='+this.id+'&goodsid='+this.goodsId+'&isback=true'
  393. })
  394. } else {
  395. //点击返回按钮确认允许退出,记录答题记录
  396. this.examRecordEdit();
  397. }
  398. },
  399. methods: {
  400. bankExam() {
  401. this.$api.bankExam(this.id).then(res => {
  402. this.bankType = res.data.data.doType;
  403. if(this.bankType == 1) {
  404. this.needBack = true;
  405. }
  406. })
  407. },
  408. /**
  409. * 获取错题集
  410. */
  411. wrongRecordExamQuestionList() {
  412. this.$api.wrongRecordExamQuestionList({
  413. examId:this.id,
  414. goodsId:this.goodsId
  415. }).then(res => {
  416. this.wrongList = res.data.rows
  417. })
  418. },
  419. /**
  420. * 点击后退按钮
  421. */
  422. clickLeft() {
  423. if(this.bankType == 2) {
  424. this.needBack = false;
  425. uni.navigateBack({
  426. delta:1
  427. })
  428. } else if(this.bankType == 1){
  429. let ansCount = this.questionOverNum();
  430. this.lastCount = this.questionList.length - ansCount;
  431. if(this.lastCount == 0) {
  432. this.testOver = true;
  433. } else {
  434. this.isLastCount = true;
  435. }
  436. }
  437. },
  438. /**
  439. * 获取已经回答的题目数
  440. */
  441. questionOverNum() {
  442. let count = 0;
  443. this.questionList.forEach(item => {
  444. if(item.type == 1 || item.type == 2 || item.type == 3) {
  445. if(item.ques) {
  446. count++;
  447. }
  448. } else if(item.type == 4) { //案例题
  449. let isOver = item.jsonStr.every(jsonItem => {
  450. if(jsonItem.type == 1 || jsonItem.type == 2 || jsonItem.type == 3) {
  451. if(jsonItem.ques) {
  452. return true;
  453. } else {
  454. return false;
  455. }
  456. } else if(jsonItem.type ==5) {
  457. if(jsonItem.ansText.text.length || jsonItem.ansText.imageList.length) {
  458. return true;
  459. } else {
  460. return false;
  461. }
  462. }
  463. })
  464. if(isOver) {
  465. count++;
  466. }
  467. } else if(item.type == 5) { //简答题
  468. if(item.ansText.text.length || item.ansText.imageList.length) {
  469. count++;
  470. }
  471. }
  472. })
  473. return count;
  474. },
  475. /**
  476. * 暂不交卷
  477. */
  478. noSubmit() {
  479. //设为允许退出页面
  480. this.needBack = false;
  481. uni.navigateBack({
  482. delta:1
  483. })
  484. },
  485. noLeave() {
  486. this.isLastCount = false;
  487. },
  488. leaveNow() {
  489. this.needBack = false;
  490. uni.navigateBack({
  491. delta:1
  492. })
  493. let score = 0; //计算总分
  494. let reportStatus = 0;
  495. let number = 0;
  496. this.questionList.forEach((item,index) => {
  497. if(item.type == 1) {
  498. if(item.ques == item.ans) {
  499. score += item.score;
  500. number++
  501. }
  502. } else if(item.type == 2) {
  503. let isRight = item.ques && item.ques.every((quesItem,quesIndex) => {
  504. return item.ques[quesIndex] == item.ans[quesIndex]
  505. })
  506. if(isRight) {
  507. score += item.score;
  508. number++
  509. }
  510. } else if(item.type == 3) {
  511. if(item.ques == item.ans) {
  512. score += item.score;
  513. number++
  514. }
  515. }
  516. })
  517. // if(score >= 60) {
  518. // reportStatus = 1
  519. // } else {
  520. // reportStatus = 0
  521. // }
  522. this.$api.examRecordEdit({
  523. examId:this.id,
  524. goodsId:this.goodsId,
  525. // reportStatus:reportStatus,
  526. recordId: this.recordId,
  527. rightQuestionNum:number,
  528. status:1,
  529. score:score,
  530. historyExamJson:JSON.stringify(this.questionList)
  531. }).then(res => {
  532. })
  533. },
  534. submitNow() {
  535. this.needBack = false;
  536. this.submit();
  537. },
  538. /**
  539. * 离开页面统计回答正确题数
  540. */
  541. examRecordEdit() {
  542. if(!this.isSubmit) {
  543. let number = 0;
  544. let score = 0;
  545. this.questionList.forEach((item,index) => {
  546. if(item.type == 1) {
  547. if(item.ques == item.ans) {
  548. score += item.score;
  549. number++
  550. }
  551. } else if(item.type == 2) {
  552. let isRight = item.ques && item.ques.every((quesItem,quesIndex) => {
  553. return item.ques[quesIndex] == item.ans[quesIndex]
  554. })
  555. if(isRight) {
  556. score += item.score;
  557. number++
  558. }
  559. } else if(item.type == 3) {
  560. if(item.ques == item.ans) {
  561. score += item.score;
  562. number++
  563. }
  564. }
  565. })
  566. this.$api.examRecordEdit({
  567. examId:this.id,
  568. goodsId:this.goodsId,
  569. recordId: this.recordId,
  570. rightQuestionNum:number,
  571. status:0,
  572. historyExamJson:JSON.stringify({ans:this.ans,ques:this.ques})
  573. }).then(res => {
  574. })
  575. }
  576. },
  577. /**
  578. * 记录总题数
  579. */
  580. examRecord() {
  581. this.$api.examRecord({
  582. examId:this.id,
  583. goodsId:this.goodsId,
  584. totalQuestionNum:this.questionList.length,
  585. }).then(res => {
  586. this.recordId = res.data.data;
  587. })
  588. },
  589. /**
  590. * @param {Object} second倒计时过滤器
  591. */
  592. countdown(second) {
  593. if(second) {
  594. let h = parseInt(second/60/60 %24); // 计算小时
  595. let m = parseInt(second/60%60); // 计算分数
  596. let s = parseInt(second%60); // 计算当前秒数
  597. if(h < 10) h = '0'+h;
  598. if(m < 10) m = '0'+m;
  599. if(s < 10) s = '0'+s;
  600. return h+':'+m+':'+s
  601. } else {
  602. return '';
  603. }
  604. },
  605. /**
  606. * 请求题目列表
  607. */
  608. goodsQuestionList() {
  609. this.$api.goodsQuestionList({
  610. examId:this.id
  611. }).then(res => {
  612. this.lastTime = res.data.data[0].answerTime && res.data.data[0].answerTime * 60;
  613. //考试时间到了自动交卷
  614. if(this.lastTime) {
  615. this.timer = setInterval(()=>{
  616. if(this.lastTime <= 0) {
  617. clearInterval(this.timer)
  618. uni.showModal({
  619. title: '提示',
  620. content: '考试时间到,自动交卷',
  621. confirmText:'确定',
  622. showCancel:false,
  623. success: (res) => {
  624. this.submit();
  625. }
  626. });
  627. return;
  628. }
  629. this.lastTime --;
  630. },1000)
  631. } else {
  632. }
  633. res.data.data.forEach((item,index) => {
  634. if(typeof item.jsonStr == 'string') {
  635. item.jsonStr = JSON.parse(item.jsonStr)
  636. if(item.type == 2) { //多选
  637. item.jsonStr.forEach(str => {
  638. str.optionsId = ''+str.optionsId;
  639. })
  640. let arr = item.answerQuestion.split(',');
  641. arr.forEach((a,i) => {
  642. arr[i] = ''+a;
  643. })
  644. item.ans = arr;
  645. return;
  646. } else if(item.type == 5) { //简答题
  647. item.ansText = {
  648. text: '',
  649. imageList: []
  650. }
  651. } else if(item.type == 4) { //案例题
  652. console.log(item.jsonStr)
  653. item.ques = []
  654. item.current = 0;
  655. let ansArr = [];
  656. item.jsonStr.forEach((json,index) => {
  657. if(json.type == 1) {
  658. ansArr[index] = json.answerQuestion;
  659. } else if(json.type == 2) {
  660. json.optionsList.forEach(str => {
  661. str.optionsId = ''+str.optionsId;
  662. })
  663. let arr = json.answerQuestion.split(',');
  664. arr.forEach((a,i) => {
  665. arr[i] = ''+a;
  666. })
  667. ansArr[index] = arr
  668. } else if(json.type == 3) {
  669. ansArr[index] = json.answerQuestion;
  670. } else if(json.type == 5) {
  671. ansArr[index] = {
  672. text: '',
  673. imageList: []
  674. }
  675. json.ansText = {
  676. text: '',
  677. imageList: []
  678. }
  679. }
  680. })
  681. item.ans = ansArr
  682. return;
  683. }
  684. item.ans = item.answerQuestion
  685. }
  686. })
  687. this.questionList = res.data.data;
  688. this.lastCount = this.questionList.length;
  689. this.examRecord()
  690. this.getCollectInfo(this.current)
  691. })
  692. },
  693. /**
  694. * @param {Object} e单选点击
  695. */
  696. radioSelect(optionsId,bindex) {
  697. if(this.questionList[bindex].ques) return;
  698. this.$set(this.questionList[bindex],'ques',optionsId)
  699. // 回答错误
  700. if(this.questionList[bindex].ques != this.questionList[bindex].ans) {
  701. this.$api.examWrongRecord({
  702. "examId": this.id,
  703. "goodsId": this.goodsId,
  704. "questionId": this.questionList[bindex].questionId,
  705. "recordId": this.recordId,
  706. }).then(res => {
  707. })
  708. } else {
  709. // let question = this.wrongList.find(item => item.questionId == this.questionList[bindex].questionId);
  710. // if(question) {
  711. // this.$api.wrongRecordDelete({
  712. // "examId": +this.id,
  713. // "goodsId": +this.goodsId,
  714. // "questionId": this.questionList[bindex].questionId,
  715. // }).then(res => {
  716. // })
  717. // }
  718. }
  719. },
  720. /**
  721. * @param {Object} e案例单选点击
  722. */
  723. radioSelectChild(optionsId,ansIndex,bindex) {
  724. if(this.questionList[bindex].ques[ansIndex]) return;
  725. this.$set(this.questionList[bindex].ques,ansIndex,optionsId)
  726. },
  727. /**
  728. * @param {Object} 多选点击
  729. */
  730. checkboxSelect(optionsId,bindex,index) {
  731. this.$set(this.questionList[bindex].jsonStr[index],'checked',!this.questionList[bindex].jsonStr[index].checked)
  732. },
  733. /**
  734. * @param {Object} 案例多选点击
  735. */
  736. checkboxSelectChild(bindex,ansIndex,childIndex) {
  737. this.$set(this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex],'checked',!this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex].checked)
  738. },
  739. /**
  740. * @param {Object} 多选确认
  741. */
  742. checkboxSubmit(bindex) {
  743. if(this.questionList[bindex].ques) return;
  744. let arr = [];
  745. this.questionList[bindex].jsonStr.forEach(item => {
  746. if(item.checked) {
  747. arr.push(item.optionsId)
  748. }
  749. })
  750. this.$set(this.questionList[bindex],'ques',arr)
  751. let isWrong = this.questionList[bindex].ques.some((quesItem,quesIndex) => {
  752. return this.questionList[bindex].ques[quesIndex] != this.questionList[bindex].ans[quesIndex]
  753. })
  754. // 回答错误
  755. if(isWrong) {
  756. this.$api.examWrongRecord({
  757. "examId": this.id,
  758. "goodsId": this.goodsId,
  759. "questionId": this.questionList[bindex].questionId,
  760. "recordId": this.recordId,
  761. }).then(res => {
  762. })
  763. } else {
  764. // let question = this.wrongList.find(item => item.questionId == this.questionList[bindex].questionId);
  765. // if(question) {
  766. // this.$api.wrongRecordDelete({
  767. // "examId": +this.id,
  768. // "goodsId": +this.goodsId,
  769. // "questionId": this.questionList[bindex].questionId,
  770. // }).then(res => {
  771. // })
  772. // }
  773. }
  774. },
  775. /**
  776. * @param {Object} 案例多选确认
  777. */
  778. checkboxSubmitChild(bindex,ansIndex) {
  779. if(this.questionList[bindex].ques[ansIndex]) return;
  780. let arr = [];
  781. this.questionList[bindex].jsonStr[ansIndex].optionsList.forEach(item => {
  782. if(item.checked) {
  783. arr.push(item.optionsId)
  784. }
  785. })
  786. this.$set(this.questionList[bindex].ques,ansIndex,arr)
  787. },
  788. /**
  789. * @param {Object} index
  790. * @param {Object} bindex
  791. * 判断题
  792. */
  793. judgeSelect(index,bindex) {
  794. if(this.questionList[bindex].ques) return;
  795. this.$set(this.questionList[bindex],'ques',index+'')
  796. // 回答错误
  797. if(this.questionList[bindex].ques != this.questionList[bindex].ans) {
  798. this.$api.examWrongRecord({
  799. "examId": this.id,
  800. "goodsId": this.goodsId,
  801. "questionId": this.questionList[bindex].questionId,
  802. "recordId": this.recordId,
  803. }).then(res => {
  804. })
  805. } else {
  806. // let question = this.wrongList.find(item => item.questionId == this.questionList[bindex].questionId);
  807. // if(question) {
  808. // this.$api.wrongRecordDelete({
  809. // "examId": +this.id,
  810. // "goodsId": +this.goodsId,
  811. // "questionId": this.questionList[bindex].questionId,
  812. // }).then(res => {
  813. // })
  814. // }
  815. }
  816. },
  817. /**
  818. * @param {Object} ansindex
  819. * @param {Object} childindex
  820. * @param {Object} bindex
  821. * 案例判断题
  822. */
  823. judgeSelectChild(ansindex,childindex,bindex) {
  824. if(this.questionList[bindex].ques[ansindex]) return;
  825. this.$set(this.questionList[bindex].ques,ansindex,childindex+'')
  826. },
  827. openFooterTab() {
  828. this.show = true;
  829. },
  830. hideDialog() {
  831. this.showDialog = false
  832. },
  833. changeIndex(index) {
  834. this.current = index
  835. },
  836. swiperChange(e) {
  837. this.current = e.detail.current;
  838. this.getCollectInfo(this.current)
  839. },
  840. /**
  841. * @param {Object} current
  842. * 获取收藏信息
  843. */
  844. getCollectInfo(current) {
  845. this.$api.getCollectInfo({
  846. examId:this.id,
  847. questionId:this.questionList[current].questionId,
  848. goodsId:this.goodsId,
  849. }).then(res => {
  850. if(res.data.code == 500) {
  851. this.$set(this.collectList,current,false)
  852. } else if(res.data.code == 200) {
  853. this.$set(this.collectList,current,res.data.data)
  854. }
  855. })
  856. },
  857. /**
  858. * 提交数据
  859. */
  860. submit() {
  861. let score = 0; //计算总分
  862. let reportStatus = 0;
  863. let number = 0;
  864. this.questionList.forEach((item,index) => {
  865. if(item.type == 1) {
  866. if(item.ques == item.ans) {
  867. score += item.score;
  868. number++
  869. }
  870. } else if(item.type == 2) {
  871. let isRight = item.ques && item.ques.every((quesItem,quesIndex) => {
  872. return item.ques[quesIndex] == item.ans[quesIndex]
  873. })
  874. if(isRight) {
  875. score += item.score;
  876. number++
  877. }
  878. } else if(item.type == 3) {
  879. if(item.ques == item.ans) {
  880. score += item.score;
  881. number++
  882. }
  883. }
  884. })
  885. // if(score >= 60) {
  886. // reportStatus = 1
  887. // } else {
  888. // reportStatus = 0
  889. // }
  890. this.$api.examRecordEdit({
  891. examId:this.id,
  892. goodsId:this.goodsId,
  893. // reportStatus:reportStatus,
  894. recordId: this.recordId,
  895. rightQuestionNum:number,
  896. status:1,
  897. score:score,
  898. historyExamJson:JSON.stringify(this.questionList)
  899. }).then(res => {
  900. this.isSubmit = true;
  901. if(res.data.code == 200) {
  902. uni.showToast({
  903. title: '交卷成功',
  904. duration: 2000,
  905. icon:'none'
  906. });
  907. setTimeout(() => {
  908. uni.redirectTo({
  909. url:'/pages2/bank/question_report?id='+this.recordId
  910. })
  911. },2000)
  912. }
  913. })
  914. },
  915. /**
  916. * @param {Object} state
  917. * @param {Object} index
  918. * 收藏
  919. */
  920. collect(state,index) {
  921. if(!state) {
  922. this.$api.collectQuestion({
  923. examId:this.id,
  924. questionId:this.questionList[index].questionId,
  925. goodsId:this.goodsId || '',
  926. }).then(res => {
  927. if(res.data.code==200){
  928. this.$set(this.collectList,index,true)
  929. uni.showToast({
  930. title: '收藏成功',
  931. duration: 2000,
  932. icon:'none'
  933. });
  934. }
  935. })
  936. } else {
  937. this.$api.deleteCollectQuestion(this.collectList[index].collectQuestionId).then(res => {
  938. if(res.data.code==200){
  939. this.$set(this.collectList,index,false)
  940. uni.showToast({
  941. title: '取消收藏成功',
  942. duration: 2000,
  943. icon:'none'
  944. });
  945. }
  946. })
  947. }
  948. return;
  949. },
  950. /**
  951. * @param {Object} imgIndex
  952. * @param {Object} bankIndex
  953. * 删除简答图片
  954. */
  955. deleteImg(imgIndex,bankIndex) {
  956. this.questionList[bankIndex].ansText.imageList.splice(imgIndex,1)
  957. },
  958. /**
  959. * @param {Object} imgIndex
  960. * @param {Object} bankIndex
  961. * @param {Object} ansIndex
  962. * 删除案例题简答图片
  963. */
  964. deleteImgChild(imgIndex,bankIndex,ansIndex) {
  965. this.questionList[bankIndex].jsonStr[ansIndex].ansText.imageList.splice(imgIndex,1)
  966. },
  967. /**
  968. * @param {Object} bankindex
  969. * 选择上传图片
  970. */
  971. chooseImg(bankindex) {
  972. uni.chooseImage({
  973. count: 1, //默认9
  974. sizeType: ['compressed', ], //可以指定是原图还是压缩图,默认二者都有
  975. sourceType: ['album','camera'], //从相册选择
  976. success: (res) => {
  977. let self = this;
  978. // console.log(JSON.stringify(res.tempFilePaths));
  979. let img = res.tempFilePaths[0];
  980. uni.getImageInfo({
  981. src: img,
  982. success: async res => {
  983. let canvasWidth = res.width; //图片原始长宽
  984. let canvasHeight = res.height;
  985. if (canvasWidth > 1000 || canvasHeight > 1000) {
  986. uni.compressImage({
  987. src: img,
  988. quality: 75,
  989. width: '50%',
  990. height: '50%',
  991. success: async rest => {
  992. const dir = await self.uploadFile(rest.tempFilePath, 0);
  993. this.questionList[bankindex].ansText.imageList.push(dir)
  994. }
  995. });
  996. } else {
  997. const dir = await self.uploadFile(img, 0);
  998. this.questionList[bankindex].ansText.imageList.push(dir)
  999. }
  1000. }
  1001. });
  1002. }
  1003. })
  1004. },
  1005. /**
  1006. * @param {Object} bankindex
  1007. * @param {Object} ansindex
  1008. * 案例题选择上传图片
  1009. */
  1010. chooseImgChild(bankindex,ansindex) {
  1011. uni.chooseImage({
  1012. count: 1, //默认9
  1013. sizeType: ['compressed', ], //可以指定是原图还是压缩图,默认二者都有
  1014. sourceType: ['album','camera'], //从相册选择
  1015. success: (res) => {
  1016. let self = this;
  1017. // console.log(JSON.stringify(res.tempFilePaths));
  1018. let img = res.tempFilePaths[0];
  1019. uni.getImageInfo({
  1020. src: img,
  1021. success: async res => {
  1022. let canvasWidth = res.width; //图片原始长宽
  1023. let canvasHeight = res.height;
  1024. if (canvasWidth > 1000 || canvasHeight > 1000) {
  1025. uni.compressImage({
  1026. src: img,
  1027. quality: 75,
  1028. width: '50%',
  1029. height: '50%',
  1030. success: async rest => {
  1031. const dir = await self.uploadFile(rest.tempFilePath, 0);
  1032. this.questionList[bankindex].jsonStr[ansindex].ansText.imageList.push(dir)
  1033. }
  1034. });
  1035. } else {
  1036. const dir = await self.uploadFile(img, 0);
  1037. this.questionList[bankindex].jsonStr[ansindex].ansText.imageList.push(dir)
  1038. }
  1039. }
  1040. });
  1041. }
  1042. })
  1043. },
  1044. uploadFile(options, int) {
  1045. var self = this;
  1046. return new Promise((resolve, reject) => {
  1047. var data = {
  1048. imageStatus: int
  1049. };
  1050. self.$api.aliyunpolicy(data).then(res => {
  1051. console.log(res.data,6)
  1052. if(res.data.code!=200){
  1053. self.$method.showToast('签名错误'+JSON.stringify(res.data))
  1054. return
  1055. }
  1056. var ossToken = res.data.data.resultContent;
  1057. if(ossToken.host==null||ossToken.host==undefined){
  1058. self.$method.showToast('上传路径报错'+JSON.stringify(res.data))
  1059. return
  1060. }
  1061. uni.uploadFile({
  1062. url: ossToken.host,
  1063. name: 'file',
  1064. filePath: options,
  1065. fileType: 'image',
  1066. header: {
  1067. AuthorizationToken: 'WX ' + uni.getStorageSync('token')
  1068. },
  1069. formData: {
  1070. key: ossToken.dir,
  1071. OSSAccessKeyId: ossToken.accessid,
  1072. policy: ossToken.policy,
  1073. Signature: ossToken.signature,
  1074. callback: ossToken.callback,
  1075. success_action_status: 200
  1076. },
  1077. success: result => {
  1078. if (result.statusCode === 200) {
  1079. resolve(ossToken.dir);
  1080. } else {
  1081. uni.showToast({
  1082. title: '上传失败',
  1083. icon: 'none'
  1084. });
  1085. return;
  1086. }
  1087. },
  1088. fail: error => {
  1089. uni.showToast({
  1090. title: '上传接口报错'+error,
  1091. icon: 'none'
  1092. });
  1093. return;
  1094. }
  1095. });
  1096. });
  1097. });
  1098. },
  1099. /**
  1100. * @param {Object} type
  1101. * @param {Object} bankindex
  1102. * 简答题答案确认
  1103. */
  1104. submitAns(bankindex) {
  1105. console.log(this.questionList[bankindex])
  1106. if(!this.questionList[bankindex].ansText.text && !this.questionList[bankindex].ansText.imageList.length) {
  1107. uni.showToast({
  1108. title: '请输入内容或上传图片',
  1109. duration: 2000,
  1110. icon:'none'
  1111. });
  1112. return
  1113. }
  1114. this.$set(this.questionList[bankindex],'ques',{
  1115. imageList:this.questionList[bankindex].ansText.imageList,
  1116. text:this.questionList[bankindex].ansText.text,
  1117. })
  1118. },
  1119. /**
  1120. * @param {Object} bankindex
  1121. * @param {Object} ansindex
  1122. * 案例题简答答案确认
  1123. */
  1124. submitAnsChild(bankindex,ansindex) {
  1125. if(!this.questionList[bankindex].jsonStr[ansindex].ansText.text && !this.questionList[bankindex].jsonStr[ansindex].ansText.imageList.length) {
  1126. uni.showToast({
  1127. title: '请输入内容或上传图片',
  1128. duration: 2000,
  1129. icon:'none'
  1130. });
  1131. return
  1132. }
  1133. this.$set(this.questionList[bankindex].ques,ansindex,{
  1134. imageList:this.questionList[bankindex].jsonStr[ansindex].ansText.imageList,
  1135. text:this.questionList[bankindex].jsonStr[ansindex].ansText.text,
  1136. })
  1137. },
  1138. isRight(item,index) {
  1139. //单选
  1140. if(this.questionList[index].ques) {
  1141. if(item.type == 1) {
  1142. return this.questionList[index].ques == this.questionList[index].ans;
  1143. //多选
  1144. } else if(item.type == 2) {
  1145. //每一项都相等
  1146. return this.questionList[index].ques.every((item,index) => {
  1147. return item == this.questionList[index].ans;
  1148. })
  1149. //判断
  1150. } else if(item.type == 3) {
  1151. return this.questionList[index].ques == this.questionList[index].ans;
  1152. } else {
  1153. return false;
  1154. }
  1155. } else {
  1156. return false;
  1157. }
  1158. },
  1159. right(bankIndex,ansIndex,option) {
  1160. if(this.questionList[bankIndex].ques[ansIndex] && this.questionList[bankIndex].ans[ansIndex]) {
  1161. if((this.questionList[bankIndex].ques[ansIndex].indexOf(option.optionsId) != -1 ) || (this.questionList[bankIndex].ans[ansIndex].indexOf(option.optionsId) != -1)) {
  1162. return true
  1163. } else {
  1164. return false;
  1165. }
  1166. } else {
  1167. return false;
  1168. }
  1169. },
  1170. wrong(bankIndex,ansIndex,option) {
  1171. if(this.questionList[bankIndex].ques[ansIndex] && this.questionList[bankIndex].ans[ansIndex]) {
  1172. if((this.questionList[bankIndex].ques[ansIndex].indexOf(option.optionsId) != -1 ) && (this.questionList[bankIndex].ans[ansIndex].indexOf(option.optionsId) == -1)) {
  1173. return true;
  1174. } else {
  1175. return false;
  1176. }
  1177. } else {
  1178. return false;
  1179. }
  1180. },
  1181. isWrong(item,index) {
  1182. if(this.questionList[index].ques) {
  1183. //单选
  1184. if(item.type == 1) {
  1185. return this.questionList[index].ques != this.questionList[index].ans;
  1186. //多选
  1187. } else if(item.type == 2) {
  1188. //每一项都相等
  1189. return this.questionList[index].ques.some((item,index) => {
  1190. return item != this.questionList[index].ans;
  1191. })
  1192. //判断
  1193. } else if(item.type == 3) {
  1194. return this.questionList[index].ques != this.questionList[index].ans;
  1195. } else {
  1196. return false;
  1197. }
  1198. } else {
  1199. return false;
  1200. }
  1201. },
  1202. tabSelect(index,bankindex) {
  1203. this.$set(this.questionList[bankindex],'current',index)
  1204. },
  1205. }
  1206. };
  1207. </script>
  1208. <style lang="scss" scoped>
  1209. .swiper {
  1210. width:100%;
  1211. height:calc(100vh - 44px);
  1212. }
  1213. .lisSty {
  1214. margin-bottom: 16rpx;
  1215. display: flex;
  1216. .flex_auto {
  1217. flex:1;
  1218. }
  1219. }
  1220. .activeTI {
  1221. vertical-align: middle;
  1222. display: inline-block;
  1223. border: 1rpx solid #eee;
  1224. border-radius: 50rpx;
  1225. height: 48rpx;
  1226. line-height: 46rpx;
  1227. text-align: center;
  1228. width: 48rpx;
  1229. margin-right: 15rpx;
  1230. color: #666;
  1231. font-size: 30rpx;
  1232. &.right {
  1233. color:#fff;
  1234. background:green;
  1235. }
  1236. &.wrong {
  1237. color:#fff;
  1238. background:red;
  1239. }
  1240. &.checked {
  1241. color:#fff;
  1242. background:blue;
  1243. }
  1244. }
  1245. .submit_checkbox {
  1246. margin:20rpx auto;
  1247. width: 526rpx;
  1248. height: 80rpx;
  1249. background: rgba(0, 122, 255, 1);
  1250. color:#fff;
  1251. text-align: center;
  1252. line-height: 80rpx;
  1253. font-size: 30rpx;
  1254. border-radius: 40rpx;
  1255. }
  1256. .titles {
  1257. overflow: hidden;
  1258. margin-bottom: 24rpx;
  1259. }
  1260. .titBox {
  1261. padding: 41rpx 25rpx 24rpx 25rpx;
  1262. }
  1263. .tabs {
  1264. margin:10rpx;
  1265. display: flex;
  1266. .tab {
  1267. margin:0 10rpx;
  1268. width: 96rpx;
  1269. height: 48rpx;
  1270. line-height: 48rpx;
  1271. text-align: center;
  1272. color:#007AFF;
  1273. font-size: 28rpx;
  1274. border-radius: 16rpx;
  1275. &.current {
  1276. color:#fff;
  1277. background: #007AFF;
  1278. }
  1279. }
  1280. }
  1281. .ans {
  1282. margin:8rpx 8rpx 8rpx;
  1283. .ans_input {
  1284. border-radius: 16rpx;
  1285. background:#fff;
  1286. .top {
  1287. border-bottom:1rpx solid #EEEEEE;
  1288. padding: 16rpx;
  1289. display: flex;
  1290. align-items: center;
  1291. .icon {
  1292. margin-right:20rpx;
  1293. width: 40rpx;
  1294. height: 38rpx;
  1295. }
  1296. .progress {
  1297. flex:1;
  1298. }
  1299. .submit {
  1300. width: 168rpx;
  1301. height: 48rpx;
  1302. line-height: 48rpx;
  1303. text-align: center;
  1304. color:#fff;
  1305. font-size: 30rpx;
  1306. background: #007AFF;
  1307. border-radius: 24rpx;
  1308. }
  1309. }
  1310. .textarea {
  1311. textarea {
  1312. width:100%;
  1313. height:287rpx;
  1314. padding:10rpx;
  1315. }
  1316. }
  1317. .imgs {
  1318. overflow: hidden;
  1319. display: flex;
  1320. width:100%;
  1321. .img {
  1322. width: 104rpx;
  1323. height: 104rpx;
  1324. border-radius: 8rpx;
  1325. position:relative;
  1326. margin:20rpx;
  1327. text {
  1328. position:absolute;
  1329. right:-15rpx;
  1330. top:-15rpx;
  1331. width:30rpx;
  1332. height:30rpx;
  1333. text-align: center;
  1334. line-height: 30rpx;
  1335. color:#fff;
  1336. background:red;
  1337. border-radius:50%;
  1338. }
  1339. image {
  1340. width:100%;
  1341. height:100%;
  1342. }
  1343. }
  1344. }
  1345. }
  1346. .ans_submit {
  1347. padding:16rpx;
  1348. border-radius: 16rpx;
  1349. background:#fff;
  1350. .imgs {
  1351. overflow: hidden;
  1352. display: flex;
  1353. width:100%;
  1354. .img {
  1355. width: 104rpx;
  1356. height: 104rpx;
  1357. border-radius: 8rpx;
  1358. position:relative;
  1359. margin:20rpx;
  1360. image {
  1361. width:100%;
  1362. height:100%;
  1363. }
  1364. }
  1365. }
  1366. }
  1367. }
  1368. .firstLetter {
  1369. display: flex;
  1370. justify-content: space-between;
  1371. align-items: center;
  1372. margin-bottom: 30rpx;
  1373. .leftLetters {
  1374. display: flex;
  1375. align-items: center;
  1376. width: 220rpx;
  1377. .btnType {
  1378. padding: 5rpx 10rpx;
  1379. border: 1rpx solid #007aff;
  1380. border-radius: 10rpx;
  1381. background-color: rgba(0, 122, 255, 0.1);
  1382. font-size: 28rpx;
  1383. color: #007aff;
  1384. margin-right: 15rpx;
  1385. }
  1386. }
  1387. }
  1388. .popupView {
  1389. height: 100%;
  1390. padding-bottom: 100rpx;
  1391. .popupTops {
  1392. height: 77rpx;
  1393. border-bottom: 1rpx solid #eee;
  1394. text-align: center;
  1395. line-height: 77rpx;
  1396. font-size: 24rpx;
  1397. color: #999;
  1398. position: relative;
  1399. .topIcon {
  1400. position: absolute;
  1401. top: 10rpx;
  1402. left: 50%;
  1403. transform: translateX(-50%);
  1404. width: 80rpx;
  1405. height: 8rpx;
  1406. background-color: #999;
  1407. border-radius: 4rpx;
  1408. }
  1409. }
  1410. .popupContent {
  1411. }
  1412. }
  1413. .pageContent {
  1414. position:relative;
  1415. background-color: #eaeef1;
  1416. min-height: 100vh;
  1417. padding-top: 8rpx;
  1418. padding-bottom: 100rpx;
  1419. }
  1420. .pad_8 {
  1421. background-color: #fff;
  1422. margin: 0rpx 8rpx 8rpx;
  1423. border-radius: 16rpx;
  1424. }
  1425. .answer {
  1426. height: 80rpx;
  1427. line-height: 80rpx;
  1428. padding: 0rpx 24rpx;
  1429. display: flex;
  1430. align-items: center;
  1431. justify-content: space-between;
  1432. color: #666;
  1433. font-size: 30rpx;
  1434. }
  1435. .footer_btn {
  1436. background-color: #fff;
  1437. z-index: 10078;
  1438. position: fixed;
  1439. bottom: 0rpx;
  1440. display: flex;
  1441. align-items: center;
  1442. justify-content: space-between;
  1443. width: 100%;
  1444. height: 98rpx;
  1445. padding: 0rpx 38rpx;
  1446. border-top: 1rpx solid #eee;
  1447. .collect {
  1448. visibility: hidden;
  1449. &.show {
  1450. visibility: visible;
  1451. }
  1452. }
  1453. }
  1454. .boxSty {
  1455. padding: 44rpx 41rpx 0rpx;
  1456. }
  1457. .liListSty {
  1458. border:1rpx solid #EEEEEE;
  1459. width: 88rpx;
  1460. height: 88rpx;
  1461. border-radius: 32rpx;
  1462. text-align: center;
  1463. line-height: 88rpx;
  1464. color: #333;
  1465. font-size: 32rpx;
  1466. float: left;
  1467. margin: 20rpx 23rpx;
  1468. &.isRight {
  1469. border:1rpx solid #EEEEEE;
  1470. color:#fff;
  1471. background: green;
  1472. }
  1473. &.isWrong {
  1474. border:1rpx solid #EEEEEE;
  1475. color:#fff;
  1476. background: red;
  1477. }
  1478. }
  1479. .answerInfos {
  1480. padding: 25rpx 25rpx 25rpx 23rpx;
  1481. }
  1482. .answerTitle {
  1483. margin-bottom: 28rpx;
  1484. color: #666;
  1485. font-size: 30rpx;
  1486. }
  1487. .answerContent {
  1488. font-size: 30rpx;
  1489. color: #666;
  1490. }
  1491. .textChild {
  1492. display: inline-block;
  1493. vertical-align: middle;
  1494. }
  1495. .dialog {
  1496. position: fixed;
  1497. left:0;
  1498. top:0;
  1499. width:100%;
  1500. height:100%;
  1501. background-color: rgba(0,0,0,0.8);
  1502. display: flex;
  1503. flex-direction: column;
  1504. align-items: center;
  1505. justify-content: center;
  1506. z-index: 20000;
  1507. .text {
  1508. font-size: 32rpx;
  1509. color: #FFFFFF;
  1510. text-align: center;
  1511. }
  1512. .btn {
  1513. width: 242rpx;
  1514. height: 82rpx;
  1515. border: 2rpx solid #FFFFFF;
  1516. border-radius: 16rpx;
  1517. text-align: center;
  1518. line-height: 82rpx;
  1519. margin:41rpx auto;
  1520. color:#fff;
  1521. font-size: 32rpx;
  1522. }
  1523. }
  1524. .dialog_wrap {
  1525. position:fixed;
  1526. left:0;
  1527. top:0;
  1528. width:100%;
  1529. height:100%;
  1530. z-index: 9999999999;
  1531. .bg {
  1532. background:rgba(0, 0, 0, 0.3);
  1533. position:absolute;
  1534. left:0;
  1535. top:0;
  1536. width:100%;
  1537. height:100%;
  1538. }
  1539. .dialog {
  1540. position:absolute;
  1541. left:50%;
  1542. top:50%;
  1543. transform: translate3D(-50%,-50%,0);
  1544. width: 640rpx;
  1545. height: 439rpx;
  1546. background: #FFFFFF;
  1547. border-radius: 24rpx;
  1548. .title {
  1549. font-size: 30rpx;
  1550. font-weight: bold;
  1551. color: #333333;
  1552. line-height: 48rpx;
  1553. text-align: center;
  1554. margin-top:40rpx;
  1555. }
  1556. .content {
  1557. margin:35rpx 35rpx 0;
  1558. font-size: 30rpx;
  1559. color: #666666;
  1560. line-height: 48rpx;
  1561. }
  1562. .btns {
  1563. margin-top:35rpx;
  1564. display: flex;
  1565. align-items: center;
  1566. justify-content: center;
  1567. .btn {
  1568. width: 200rpx;
  1569. height: 80rpx;
  1570. line-height: 80rpx;
  1571. text-align: center;
  1572. background: #F5F5F5;
  1573. border-radius: 40rpx;
  1574. font-size: 30rpx;
  1575. color:rgba(0, 122, 255, 1);
  1576. background: #F5F5F5;
  1577. margin:0 20rpx;
  1578. &.active {
  1579. color: #F5F5F5;
  1580. background: rgba(0, 122, 255, 1);
  1581. }
  1582. }
  1583. }
  1584. }
  1585. }
  1586. </style>