kz-question.vue 66 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309
  1. <template>
  2. <view class="questions">
  3. <!-- 头部信息 -->
  4. <view class="test-header" v-if="showCountDown">
  5. <tui-countdown :time="limit_time" borderColor="#FFF" color="#080808" :size="36" :colonSize="36"
  6. @end="endOfTime"></tui-countdown>
  7. </view>
  8. <!-- 题目列表 -->
  9. <view class="card-shadow">
  10. <view class="topic-title">
  11. <view class="topic-title_left">
  12. <!-- 题型 -->
  13. <view class="text-kind">
  14. {{ kindText() }}
  15. </view>
  16. <!-- 收藏 -->
  17. <view class="test-favor" v-if="canCollect">
  18. <tui-icon name="like-fill" color="#f74d54" :size="18" @click="collectDel()"
  19. v-if="list[swiperIndex-1] && list[swiperIndex-1].collected"></tui-icon>
  20. <tui-icon name="like" color="#aaa" :size="18" @click="collectAdd()" v-else></tui-icon>
  21. <view class="tui-fabulous"
  22. :class="{ 'tui-fabulous__active': list[swiperIndex-1] && list[swiperIndex-1].collected }">
  23. <tui-icon name="like-fill" color="#f74d54"></tui-icon>
  24. </view>
  25. </view>
  26. </view>
  27. <!-- 题标 -->
  28. <view class="topic-title_right">
  29. <text class="title-index">{{ swiperIndex }}</text>
  30. /{{ total }}
  31. </view>
  32. </view>
  33. <!-- 防切屏提示 -->
  34. <view class="topic-title" style="font-size: 24rpx;" v-if="isPreventSwitchScreen">
  35. 注意:当前考试开启了防切屏,切屏次数超过{{ switchScreenCount }}次考试将自动结束
  36. </view>
  37. <swiper :current="swiperIndex - 1" @change="swiperChange" class="questions-cont">
  38. <swiper-item v-for="(item, index) in list" :key="index" class="swiper-item">
  39. <view v-if="Math.abs(swiperIndex - 1 - index) <= 5">
  40. <block v-if="index == swiperIndex - 1">
  41. <!-- 材料题标题 -->
  42. <view class="material-title" v-if="item.material_title != undefined">
  43. <view class="material-title-tip">材料:</view>
  44. <view v-if="!item.show_full">
  45. <rich-text :nodes="questionTitle(swiperIndex, item, 'material_title')"></rich-text>
  46. <button @click="showFullMaterialTitle(swiperIndex, item, true)">展开</button>
  47. </view>
  48. <view v-else>
  49. <rich-text :nodes="questionTitle(swiperIndex, item, 'material_title')"></rich-text>
  50. <button @click="showFullMaterialTitle(swiperIndex, item, false)">收起</button>
  51. </view>
  52. </view>
  53. <!-- 题目视频 -->
  54. <view v-if="item.title_video_url != undefined && item.title_video" class="title-video">
  55. <video id="title-video" class="title-video" :src="item.title_video_url" :controls="true"></video>
  56. </view>
  57. <!-- 判断、单选、多选题 -->
  58. <view v-if="item.kind === 'JUDGE' || item.kind === 'SINGLE' || item.kind === 'MULTI'">
  59. <view class="test-main">
  60. <view class="test-title">
  61. <mp-html :content="item.title"></mp-html>
  62. </view>
  63. <view class="test-cont">
  64. <view class="test-cont-item"
  65. v-for="(optionItem, optionIndex) in item.options_json" :key="optionIndex"
  66. @tap.stop="chooseItem(index, optionIndex, item.kind)"
  67. :class="optionItem.classes ? optionItem.classes : ''">
  68. <view class="key text-cut">
  69. {{ optionItem.key }}
  70. </view>
  71. <view class="cont">
  72. <view class="cont-text">
  73. <block v-if="item.options_img" v-for="(optionImg, optionImgIndex) in item.options_img"
  74. :key="optionImgIndex">
  75. <image class="image" v-if="optionImg.key == optionItem.key"
  76. @tap.stop="previewImage(optionImg.value)" :src="optionImg.value"
  77. mode="widthFix"></image>
  78. </block>
  79. <view v-if="!isNaN(optionItem.value)">
  80. {{ optionItem.value }}
  81. </view>
  82. <view v-else>
  83. <mp-html :content="optionItem.value"></mp-html>
  84. </view>
  85. <!-- <view>{{ optionItem.value ? optionItem.value : '' }}</view> -->
  86. </view>
  87. <view class="cont-icon">
  88. <view v-if="optionItem.classes">
  89. <text v-if="optionItem.classes.indexOf('true') != -1" class="cuIcon-check"></text>
  90. <text
  91. v-else-if="optionItem.classes.indexOf('true') == -1 && optionItem.classes.indexOf('active') != -1"
  92. class="cuIcon-close"></text>
  93. </view>
  94. </view>
  95. </view>
  96. </view>
  97. </view>
  98. </view>
  99. <view class="test-describe" v-if="showAnswer || item.show_answer">
  100. <view class="describe-cont">
  101. <view class="describe-item">
  102. <view class="answer-row">
  103. <view class="text-right-answer">正确答案:</view>
  104. <view class="text-right-answer-val">{{ item.answer }}</view>
  105. </view>
  106. </view>
  107. <view class="describe-item" v-if="mode == 'VIEW' && item.user_answer">
  108. <view class="answer-row">
  109. <view class="text-right-answer">用户答案:</view>
  110. <view class="text-right-answer-val">{{ item.user_answer }}</view>
  111. </view>
  112. </view>
  113. <view class="describe-item" v-if="pageType == 'WRONG' && item.source">
  114. <view class="answer-row">
  115. <view class="text-right-answer">错题来源:</view>
  116. <view class="text-right-answer-val">{{ getSourceText(item.source) }}</view>
  117. </view>
  118. </view>
  119. </view>
  120. </view>
  121. <view class="test-describe" v-if="showAnswer || item.show_answer">
  122. <view class="describe-cont">
  123. <view>
  124. <view class="text-right-answer text-indent tn-margin-top-sm">答案解析:</view>
  125. <view class="explain-content">
  126. <mp-html :content="item.explain" class="explain-content-text" v-if="item.explain"></mp-html>
  127. <text class="font-size-30" v-else>无</text>
  128. </view>
  129. </view>
  130. </view>
  131. </view>
  132. </view>
  133. <!-- 填空题 -->
  134. <view v-else-if="item.kind === 'FILL'">
  135. <view class="test-main">
  136. <view class="test-title test-title-fill">
  137. <block v-for="(titleText, titleIndex) in item.title_data" :key="titleIndex">
  138. <view class="test-title-fill-item">{{ titleText }}</view>
  139. <view class="test-title-fill-item">
  140. <!-- #ifdef MP-WEIXIN -->
  141. <input type="text" placeholder="请输入答案" class="fill-input"
  142. v-if="item.title_data && item.title_data.length - 1 != titleIndex"
  143. :class="[item.answer && item.answer[titleIndex] && item.answer[titleIndex].class ? item.answer[titleIndex].class : '']"
  144. :value="setFillInputValue(titleIndex)"
  145. :disabled="mode === 'VIEW'"
  146. @change="(e) => changeFillInput(e, titleIndex, swiperIndex)"
  147. />
  148. <!-- #endif -->
  149. <!-- #ifdef H5 -->
  150. <input type="text" placeholder="请输入答案" class="fill-input"
  151. v-if="item.title_data && item.title_data.length - 1 != titleIndex"
  152. :class="[item.answer && item.answer[titleIndex] && item.answer[titleIndex].class ? item.answer[titleIndex].class : '']"
  153. :value="setFillInputValue(titleIndex)"
  154. :disabled="mode === 'VIEW'"
  155. @blur="(e) => changeFillInput(e, titleIndex, swiperIndex)"
  156. />
  157. <!-- #endif -->
  158. </view>
  159. </block>
  160. <view class="test-title-fill-item">{{ getQuestionTitleScore(index, item) }}</view>
  161. </view>
  162. <view class="test-cont">
  163. <!-- 确认答案按钮 -->
  164. <view class="btn-confirm" v-if="mode == 'TRAINING' && item.is_answered === false">
  165. <tui-button type="primary" shape="circle" @click="confirmFillAnswer" width="360rpx" height="60rpx"
  166. :size="26" margin="0 auto">确认答案
  167. </tui-button>
  168. </view>
  169. </view>
  170. </view>
  171. <view class="test-describe" v-if="showAnswer || item.show_answer">
  172. <view class="describe-cont">
  173. <view class="describe-item">
  174. <view class="answer-row">
  175. <view class="text-right-answer">正确答案:</view>
  176. </view>
  177. </view>
  178. <view class="describe-item pt-0">
  179. <view class="answer-row">
  180. <view class="text-right-answer-val">
  181. <view class="text-right-answer-val-item" v-for="(answer, answerIndex) in item.answer" :key="answerIndex">
  182. 填空位{{ answerIndex + 1 }}:{{ answer.answers.join(',') }}
  183. </view>
  184. </view>
  185. </view>
  186. </view>
  187. <view class="describe-item" v-if="mode == 'VIEW' && item.user_answer">
  188. <view class="answer-row">
  189. <view class="text-right-answer">用户答案:</view>
  190. </view>
  191. </view>
  192. <view class="describe-item pt-0">
  193. <view class="answer-row">
  194. <view class="text-right-answer-val">
  195. <view class="text-right-answer-val-item" v-for="(answer, answerIndex) in item.user_answer" :key="answerIndex">
  196. 填空位{{ answerIndex + 1 }}:{{ answer }}
  197. </view>
  198. </view>
  199. </view>
  200. </view>
  201. <view class="describe-item" v-if="pageType == 'WRONG' && item.source">
  202. <view class="answer-row">
  203. <view class="text-right-answer">错题来源:</view>
  204. <view class="text-right-answer-val">{{ getSourceText(item.source) }}</view>
  205. </view>
  206. </view>
  207. </view>
  208. </view>
  209. <view class="test-describe" v-if="showAnswer || item.show_answer">
  210. <view class="describe-cont">
  211. <view>
  212. <view class="text-right-answer text-indent tn-margin-top-sm">答案解析:</view>
  213. <view class="explain-content">
  214. <mp-html :content="item.explain" class="explain-content-text" v-if="item.explain"></mp-html>
  215. <text class="font-size-30" v-else>无</text>
  216. </view>
  217. </view>
  218. </view>
  219. </view>
  220. </view>
  221. <!-- 简答题 -->
  222. <view v-else-if="item.kind === 'SHORT'">
  223. <view class="test-main">
  224. <view class="test-title">
  225. <mp-html :content="item.title" style="font-size: 36rpx; font-weight: bold;"></mp-html>
  226. <!-- <rich-text :nodes="questionTitle(swiperIndex, item)"
  227. style="font-size: 36rpx; font-weight: bold;"></rich-text> -->
  228. </view>
  229. <view class="test-cont">
  230. <!-- 答案输入框 -->
  231. <textarea placeholder="在此输入答案" class="short-input"
  232. :maxlength="-1"
  233. :value="setShortInputValue(swiperIndex)"
  234. :auto-blur="true"
  235. @blur="(e) => changeShortInput(e, swiperIndex)"
  236. @input="(e) => changeShortInput(e, swiperIndex)"
  237. />
  238. <!-- 确认答案按钮 -->
  239. <view class="btn-confirm" v-if="mode == 'TRAINING'">
  240. <tui-button type="primary"
  241. shape="circle"
  242. @click="confirmShortAnswer"
  243. width="360rpx"
  244. height="60rpx"
  245. :size="26"
  246. margin="0 auto">确认答案
  247. </tui-button>
  248. </view>
  249. </view>
  250. </view>
  251. <!-- <view class="test-describe" v-if="showAnswer || item.show_answer">
  252. <view class="describe-cont">
  253. <view>
  254. <view>
  255. <view class="text-right-answer">正确答案:</view>
  256. <text style="color: #5677fc;margin-left: 30rpx;" v-if="item.answer && item.answer.answer">{{item.answer.answer}}</text>
  257. </view>
  258. <view v-for="(keyword, keywordIndex) in item.answer.config" :key="keywordIndex">
  259. <view :class="[keyword.class]">
  260. 关键词{{ keywordIndex + 1 }}:{{ keyword.answer }}({{ keyword.score }}分)
  261. </view>
  262. </view>
  263. </view>
  264. </view>
  265. </view> -->
  266. <view class="test-describe" v-if="showAnswer || item.show_answer">
  267. <view class="describe-cont">
  268. <view class="describe-item">
  269. <view class="answer-row">
  270. <view class="text-right-answer">正确答案:</view>
  271. </view>
  272. </view>
  273. <view class="describe-item pt-0">
  274. <view class="answer-row">
  275. <view class="text-right-answer-val">
  276. <view class="text-right-answer-val-item" v-for="(keyword, keywordIndex) in item.answer.config" :key="keywordIndex">
  277. <view :class="[keyword.class]">
  278. 关键词{{ keywordIndex + 1 }}:{{ keyword.answer }}({{ keyword.score }}分)
  279. </view>
  280. </view>
  281. </view>
  282. </view>
  283. </view>
  284. <view class="describe-item" v-if="mode == 'VIEW' && item.user_answer">
  285. <view class="answer-row">
  286. <view class="text-right-answer">用户答案:</view>
  287. </view>
  288. </view>
  289. <view class="describe-item pt-0">
  290. <view class="answer-row">
  291. <view class="text-right-answer-val">
  292. <view class="text-right-answer-val-item" v-for="(answer, answerIndex) in item.user_answer" :key="answerIndex">
  293. {{ answer }}
  294. </view>
  295. </view>
  296. </view>
  297. </view>
  298. <view class="describe-item" v-if="pageType == 'WRONG' && item.source">
  299. <view class="answer-row">
  300. <view class="text-right-answer">错题来源:</view>
  301. <view class="text-right-answer-val">{{ getSourceText(item.source) }}</view>
  302. </view>
  303. </view>
  304. </view>
  305. </view>
  306. <view class="test-describe" v-if="showAnswer || item.show_answer">
  307. <view class="describe-cont">
  308. <view>
  309. <view class="text-right-answer text-indent tn-margin-top-sm">答案解析:</view>
  310. <view class="explain-content">
  311. <mp-html :content="item.explain" class="explain-content-text" v-if="item.explain"></mp-html>
  312. <text class="font-size-30" v-else>无</text>
  313. </view>
  314. </view>
  315. </view>
  316. </view>
  317. </view>
  318. <!-- 解析视频 -->
  319. <view class="explain-video-view"
  320. v-if="(showAnswer || item.show_answer) && item.explain_video_url != undefined && item.explain_video">
  321. <video id="explain-video" class="explain-video" :src="item.explain_video_url" controls></video>
  322. </view>
  323. </block>
  324. <view style="height: 100rpx;"></view>
  325. </view>
  326. </swiper-item>
  327. </swiper>
  328. </view>
  329. <!-- 底部栏 -->
  330. <!-- :class="mode == 'EXAM' || mode == 'VIEW' ? (canDeleteWrong ? ['col-5'] : ['col-4']) : ['col-3']" -->
  331. <view class="fix-bottom grid text-center bg-white cu-list" :class="[getBottomBarClass()]">
  332. <view url="/pages/index/index" class="cu-item" @click="handleNumberPanel"><!-- v-if="mode != 'TRAINING'" -->
  333. <image src="/static/img/caidan.png"></image>
  334. <text>{{ swiperIndex }}/{{ total }}</text>
  335. </view>
  336. <view url="/pages/index/index" class="cu-item" @tap="prev">
  337. <image src="/static/img/left.png"></image>
  338. <text>上一题</text>
  339. </view>
  340. <view url="/pages/index/index" class="cu-item" @tap="next">
  341. <image src="/static/img/right.png"></image>
  342. <text>下一题</text>
  343. </view>
  344. <view url="/pages/index/index" class="cu-item" @tap="buttonClicked==true?submitShowModal():''"
  345. v-if="mode == 'EXAM'">
  346. <image src="/static/img/jiaojuan.png"></image>
  347. <text>交卷</text>
  348. </view>
  349. <view url="/pages/index/index" class="cu-item" @tap="buttonClicked==true?endTrainShowModal():''"
  350. v-if="mode == 'TRAINING'">
  351. <image src="/static/img/jiaojuan.png"></image>
  352. <text>结束练习</text>
  353. </view>
  354. <view url="/pages/index/index" class="cu-item" @tap="wrongDel()" v-if="mode == 'VIEW' && canDeleteWrong">
  355. <image src="/static/img/delete.png"></image>
  356. <text>删除</text>
  357. </view>
  358. <!-- <view url="/pages/index/index" class="cu-item" @tap="wrongClear()" v-if="mode == 'VIEW' && canDeleteWrong">
  359. <image src="/static/img/round_close.png"></image>
  360. <text>清空</text>
  361. </view> -->
  362. </view>
  363. <!-- 题标 -->
  364. <!-- <view class="fixed-bottom" :class="{ active: showNumberPanel }" @click.stop="handleNumberPanel">
  365. <view class="tibiao" @click.stop>
  366. <scroll-view scroll-y="true" class="tibiao-scroll">
  367. <view class="tibiao-item" v-for="(item, index) in total" :key="index" :class="swiperIndex - 1 == index ? 'selected' : ''"
  368. @click="changeQuestion(index)">
  369. {{ index + 1 }}
  370. </view>
  371. </scroll-view>
  372. </view>
  373. </view> -->
  374. <!-- 题标 -->
  375. <view class="cu-modal bottom-modal fixed-bottom" :class="showNumberPanel?'show':''" @click.stop="handleNumberPanel">
  376. <view class="cu-dialog tibiao" @click.stop>
  377. <scroll-view scroll-y="true" class="tibiao-scroll">
  378. <view class="tibiao-scroll-list">
  379. <!-- class="tibiao-item" -->
  380. <!-- :class="[getNumberPanelClass(index)]" -->
  381. <!-- :class="swiperIndex - 1 == index ? 'selected' : (list[index] && (list[index].check || list[index].user_answers) ? 'right' : '')" -->
  382. <view
  383. :class="['tibiao-item', getNumberPanelClass(index)]"
  384. v-for="(item, index) in total" :key="index" @click="changeQuestion(index)">
  385. {{ index + 1 }}
  386. </view>
  387. </view>
  388. </scroll-view>
  389. </view>
  390. </view>
  391. <!-- 删除错题对话框 -->
  392. <view class="cu-modal" :class="showDeleteDialog?'show':''">
  393. <view class="cu-dialog">
  394. <view class="cu-bar bg-white justify-end">
  395. <view class="content">提示</view>
  396. <view class="action" @tap="hideModal">
  397. <text class="cuIcon-close text-red"></text>
  398. </view>
  399. </view>
  400. <view class="padding-xl">
  401. {{ wrongDeleteType == 'single' ? '确定删除该错题吗?' : '确定清空所有错题吗?' }}
  402. </view>
  403. <view class="cu-bar bg-white justify-end">
  404. <view class="action">
  405. <button class="cu-btn line-primary text-primary" @tap="hideModal">取消</button>
  406. <button class="cu-btn bg-primary margin-left" @tap="confirmDelWrong">确定</button>
  407. </view>
  408. </view>
  409. </view>
  410. </view>
  411. <!-- 结束练习对话框 -->
  412. <tui-modal :show="showEndTrainDialog" @cancel="hideModal" :custom="true">
  413. <view class="tui-modal-custom">
  414. <view class="tui-prompt-title">练习结果</view>
  415. <view class="tui-modal-custom-text">
  416. <view class="">
  417. 正确题数:
  418. <text class="text-green">{{ trainResult.right }}</text>
  419. </view>
  420. <view class="">
  421. 错误题数:
  422. <text class="text-red">{{ trainResult.error }}</text>
  423. </view>
  424. <view class="">
  425. 未答题数:
  426. <text class="text-yellow">{{ trainResult.unchecked }}</text>
  427. </view>
  428. </view>
  429. <view class="tui-flex-box">
  430. <view class="tui-flex-botton-view">
  431. <tui-button margin="0 20rpx 0 0" height="72rpx" :size="28" shape="circle" @click="endTrain">确定退出
  432. </tui-button>
  433. </view>
  434. <view class="tui-flex-botton-view">
  435. <tui-button margin="0 20rpx 0 0" height="72rpx" :size="28" shape="circle" @click="hideModal" plain>取消
  436. </tui-button>
  437. </view>
  438. </view>
  439. </view>
  440. </tui-modal>
  441. </view>
  442. </template>
  443. <script>
  444. import questionApi from "@/common/api/question.js"
  445. export default {
  446. name: "kz-question",
  447. props: {
  448. /**
  449. * 模式
  450. * EXAM:考试模式
  451. * VIEW:背题模式
  452. * TRAINING:练习模式
  453. */
  454. mode: {
  455. type: String,
  456. default: 'EXAM'
  457. },
  458. /**
  459. * 页面来源
  460. * PAPER:试卷考试
  461. * WRONG:错题
  462. * COLLECT:收藏
  463. */
  464. pageType: {
  465. type: String,
  466. default: 'PAPER'
  467. },
  468. // 试卷标题
  469. title: {
  470. type: String,
  471. default: '标题'
  472. },
  473. // 试题集
  474. questions: {
  475. type: Array,
  476. default: () => []
  477. },
  478. // 试题集总数(不传默认获取试题集长度)
  479. questionCount: {
  480. type: Number,
  481. default: 0
  482. },
  483. // 试题集每页条数
  484. pageCount: {
  485. type: Number,
  486. default: 20
  487. },
  488. // 试题集当前页
  489. currentPage: {
  490. type: Number,
  491. default: 1
  492. },
  493. // 考试时间(倒计时)
  494. limit_time: {
  495. type: Number,
  496. default: 0
  497. },
  498. // 考试配置
  499. configs: {
  500. type: Object,
  501. default: () => {
  502. }
  503. },
  504. // 允许收藏试题
  505. canCollect: {
  506. type: Boolean,
  507. default: true
  508. },
  509. // 允许删除错题
  510. canDeleteWrong: {
  511. type: Boolean,
  512. default: false
  513. },
  514. // 看题/练题的模式:normal=普通模式,memory=记忆模式,random=随机查询
  515. viewMode: {
  516. type: String,
  517. default: 'normal'
  518. },
  519. /**
  520. * 试卷选题模式
  521. * RANDOM:随机模式
  522. * FIX:固定模式
  523. */
  524. paperMode: {
  525. type: String,
  526. default: 'RANDOM'
  527. },
  528. // 防切屏
  529. isPreventSwitchScreen: {
  530. type: Boolean,
  531. default: false
  532. },
  533. // 切屏限制次数
  534. switchScreenCount: {
  535. type: Number,
  536. default: 0
  537. }
  538. },
  539. data () {
  540. return {
  541. // swiper当前下标
  542. swiperIndex: 1,
  543. // 总题数
  544. total: 0,
  545. // 试题集合
  546. list: [],
  547. // 题目面板
  548. showNumberPanel: false,
  549. // 防止交卷按钮点击多次
  550. buttonClicked: true,
  551. // 显示倒计时
  552. showCountDown: false,
  553. // 显示试题答案
  554. showAnswer: false,
  555. // 显示试题分数
  556. showQuestionScore: false,
  557. // 显示正确选择
  558. showRightChoose: false,
  559. // 显示错误选择
  560. showErrorChoose: false,
  561. // 显示结束练习对话框
  562. showEndTrainDialog: false,
  563. // 显示删除错题对话框
  564. showDeleteDialog: false,
  565. // 错题删除类型
  566. wrongDeleteType: 'single',
  567. // 答题开始时间
  568. startTime: 0,
  569. // 即将删除的错题ID
  570. wrongDelId: 0,
  571. // 练习结果
  572. trainResult: {
  573. right: 0,
  574. error: 0,
  575. unchecked: 0,
  576. rightIds: [],
  577. errorIds: []
  578. },
  579. // 记忆模式相关数据
  580. memoryData: {},
  581. // 加载试题次数(以此来判断是否是第一次进入)
  582. loadQuestionCount: 0,
  583. // 延迟加载已加载页码
  584. loadQuestionPage: [1],
  585. };
  586. },
  587. watch: {
  588. // 加载试题时
  589. questions: function () {
  590. let questionCount = this.questionCount ? this.questionCount : this.questions.length
  591. this.total = questionCount < this.questions.length ? this.questions.length : questionCount
  592. this.list = [...this.questions]
  593. // 材料题处理
  594. this.showFullMaterialTitle(0)
  595. // 填空题处理
  596. this.splitFillTitle(0)
  597. // 初始化模式配置
  598. this.initMode()
  599. // 记忆模式 - 跳转上次题标
  600. this.jumpMemoryQuestion()
  601. }
  602. },
  603. computed: {
  604. // 试题类型
  605. kindText () {
  606. return function () {
  607. return this.list[this.swiperIndex - 1] ? this.list[this.swiperIndex - 1].kind_text : '未知'
  608. }
  609. },
  610. // 试题标题
  611. questionTitle () {
  612. return function (index, item, field = 'title') {
  613. let html = item[field]
  614. html = this.utils.formatRichText(html)
  615. html += this.getQuestionTitleScore(index, item)
  616. if (field == 'material_title') {
  617. // console.log('material_title show_full', item.show_full)
  618. if (this.list[index] && !this.list[index].show_full) {
  619. // if (!item.show_full) {
  620. // if (!show_full) {
  621. html = this.truncatedText(html)
  622. // console.log('material_title', html)
  623. }
  624. }
  625. return html
  626. }
  627. },
  628. // 试题解析
  629. questionExplain () {
  630. return function (index, item) {
  631. return this.utils.formatRichText(item.explain)
  632. }
  633. },
  634. // 获取试题分数
  635. getQuestionTitleScore () {
  636. return function (index, item) {
  637. if (this.showQuestionScore) {
  638. return '(' + item.score + '分)'
  639. // return '(' + this.getSingleScore(item.kind, item.difficulty, item) + '分)'
  640. }
  641. return ''
  642. }
  643. },
  644. // 截取文本
  645. truncatedText () {
  646. return function (text, maxLength = 100) {
  647. if (text.length > maxLength) {
  648. return text.slice(0, maxLength) + '...';
  649. }
  650. return text;
  651. }
  652. },
  653. // 设置填空题答案
  654. setFillInputValue () {
  655. return (titleIndex) => {
  656. let index = this.swiperIndex - 1
  657. if (this.mode == 'VIEW') {
  658. if (this.list[index].answer) {
  659. if (this.list[index].answer[titleIndex].answers != undefined) {
  660. return this.list[index].answer[titleIndex].answers[0]
  661. }
  662. }
  663. } else {
  664. if (this.list[index].user_answers) {
  665. return this.list[index].user_answers[titleIndex]
  666. }
  667. }
  668. return ''
  669. }
  670. },
  671. // 设置简答题答案
  672. setShortInputValue () {
  673. return () => {
  674. let index = this.swiperIndex - 1
  675. if (this.mode == 'VIEW') {
  676. if (this.list[index].answer) {
  677. if (this.list[index].answer.answer != undefined) {
  678. return this.list[index].answer.answer
  679. }
  680. }
  681. } else {
  682. if (this.list[index].user_answers) {
  683. return this.list[index].user_answers
  684. }
  685. }
  686. return ''
  687. }
  688. },
  689. // 设置底部栏样式
  690. getBottomBarClass () {
  691. return () => {
  692. // console.log('getBottomBarClass', this.mode)
  693. let classes = []
  694. if (this.mode == 'EXAM') {
  695. if (this.canDeleteWrong) {
  696. classes = ['col-5']
  697. } else {
  698. classes = ['col-4']
  699. }
  700. } else if (this.mode == 'TRAINING') {
  701. if (this.canDeleteWrong) {
  702. classes = ['col-5']
  703. } else {
  704. classes = ['col-4']
  705. }
  706. } else if (this.mode == 'VIEW') {
  707. if (this.canDeleteWrong) {
  708. classes = ['col-4']
  709. } else {
  710. classes = ['col-3']
  711. }
  712. } else {
  713. classes = ['col-3']
  714. }
  715. return classes
  716. }
  717. },
  718. // 设置答题卡样式
  719. getNumberPanelClass () {
  720. return (index) => {
  721. if (this.swiperIndex - 1 == index) {
  722. return ['selected']
  723. }
  724. let classes = []
  725. let question = this.list[index]
  726. // console.log('getNumberPanelClass question', question)
  727. if (question && question.kind) {
  728. switch (question.kind) {
  729. case 'JUDGE':
  730. case 'SINGLE':
  731. case 'MULTI':
  732. if (question.is_right) {
  733. if (question.is_right == 'right') {
  734. return ['tibiao-right']
  735. } else {
  736. return ['tibiao-error']
  737. }
  738. }
  739. if (question.check) {
  740. return ['tibiao-right']
  741. }
  742. break
  743. case 'FILL':
  744. case 'SHORT':
  745. if (question.user_answers) {
  746. if (question.is_right) {
  747. if (question.is_right == 'right') {
  748. return ['tibiao-right']
  749. } else {
  750. return ['tibiao-error']
  751. }
  752. }
  753. return ['tibiao-right']
  754. }
  755. break
  756. default:
  757. return classes
  758. }
  759. }
  760. return classes
  761. }
  762. },
  763. // 获取错题来源文本
  764. getSourceText () {
  765. return (source) => {
  766. if (source == 'PAPER') {
  767. return '试卷考试'
  768. } else if (source == 'ROOM') {
  769. return '考场考试'
  770. } else if (source == 'TRAINING') {
  771. return '练题模式'
  772. }
  773. }
  774. }
  775. },
  776. methods: {
  777. // 初始化模式配置
  778. initMode (reset = false) {
  779. switch (this.mode) {
  780. // 考试模式
  781. case 'EXAM':
  782. this.showCountDown = true
  783. this.showAnswer = false
  784. this.showQuestionScore = true
  785. this.showRightChoose = false
  786. this.showErrorChoose = false
  787. this.startTime = this.utils.timestamp()
  788. break
  789. // 练习模式
  790. case 'TRAINING':
  791. this.showCountDown = false
  792. this.showAnswer = false
  793. this.showQuestionScore = false
  794. this.showRightChoose = false
  795. this.showErrorChoose = true
  796. break
  797. // 背题模式
  798. case 'VIEW':
  799. this.showCountDown = false
  800. this.showAnswer = true
  801. this.showQuestionScore = false
  802. this.showRightChoose = true
  803. this.showErrorChoose = false
  804. // 显示试题正确的选项
  805. this.list.forEach((item, index) => {
  806. if (item.options_json) {
  807. // console.log('item.options_json', item.options_json)
  808. Array.from(item.options_json).forEach((optionItem, optionIndex) => {
  809. item.options_json[optionIndex].click_index = true
  810. item.options_json[optionIndex].classes = item.answer.indexOf(optionItem.key) > -1 ? 'active_true' : ''
  811. })
  812. this.list[index] = item
  813. }
  814. })
  815. break
  816. }
  817. },
  818. // 计算试题积分
  819. getSingleScore (kind, difficulty, question) {
  820. if (this.paperde == 'FIX') {
  821. return question.score
  822. }
  823. const configs = this.configs[kind.toLowerCase()];
  824. if (configs && configs['use_difficulty']) {
  825. return configs['difficulty'][difficulty.toLowerCase()]['score'];
  826. }
  827. return configs['score'];
  828. },
  829. // 延迟加载试题
  830. loadQuestion () {
  831. if (this.mode != 'TRAINING' && this.mode != 'VIEW') {
  832. return
  833. }
  834. if (this.viewMode != 'normal') {
  835. return
  836. }
  837. // 取下一页数据
  838. let page = Math.round(this.swiperIndex / this.pageCount) + 1
  839. if (!this.loadQuestionPage.includes(page)) {
  840. this.loadQuestionPage.push(page)
  841. this.$emit('loadQuestion', page)
  842. }
  843. },
  844. // 滑动切题
  845. swiperChange (e, type = '') {
  846. // console.log('swiperChange', this.list.length, this.swiperIndex, e.detail.current)
  847. // 当前题标
  848. this.swiperIndex = e.detail.current + 1
  849. // 材料题处理
  850. this.showFullMaterialTitle(e.detail.current)
  851. // 填空题处理
  852. this.splitFillTitle(e.detail.current)
  853. // 加载题目
  854. this.loadQuestion()
  855. // 记忆模式
  856. this.memoryQuestion()
  857. },
  858. // 上一题
  859. prev () {
  860. if (this.swiperIndex > 1) {
  861. this.swiperIndex--
  862. }
  863. },
  864. // 下一题
  865. next () {
  866. // console.log('next', this.list.length, this.swiperIndex)
  867. if (this.list.length - this.swiperIndex >= 1) {
  868. // 填空题处理
  869. this.splitFillTitle(this.swiperIndex)
  870. this.swiperIndex++
  871. } else {
  872. let title = '没有更多题了~'
  873. if (this.mode == 'EXAM') {
  874. title = '可以交卷了~'
  875. }
  876. uni.showToast({
  877. title: title,
  878. icon: 'none',
  879. duration: 1500
  880. })
  881. }
  882. },
  883. // 选择
  884. chooseItem (questionIndex, optionIndex, kind) {
  885. // 背题模式不让选
  886. if (this.mode == 'VIEW') {
  887. return
  888. }
  889. let questionItem = this.list[questionIndex]
  890. switch (kind) {
  891. // 多选题
  892. case 'MULTI':
  893. questionItem.options_json[optionIndex].click_index = !questionItem.options_json[optionIndex].click_index;
  894. //多选 确认按钮
  895. let arr = []
  896. questionItem.options_json.forEach((item, index) => {
  897. if (item.click_index == true) {
  898. arr.push(item.key)
  899. }
  900. })
  901. questionItem.check = arr.join(',')
  902. questionItem.selected = true
  903. break
  904. // 单选/判断
  905. default:
  906. questionItem.options_json.forEach((item, index) => {
  907. questionItem.options_json[index].click_index = false
  908. questionItem.options_json[index].classes = ''
  909. })
  910. questionItem.options_json[optionIndex].click_index = true
  911. questionItem.check = questionItem.options_json[optionIndex].key
  912. questionItem.selected = true
  913. break
  914. }
  915. questionItem.options_json[optionIndex].classes = this.optionChooseClass(questionIndex, optionIndex, questionItem, questionItem.options_json[optionIndex])
  916. this.list[questionIndex] = questionItem
  917. // #ifdef H5
  918. this.$forceUpdate()
  919. // #endif
  920. // #ifdef APP
  921. this.$forceUpdate()
  922. // #endif
  923. },
  924. // 选项选择样式
  925. optionChooseClass (questionIndex, optionIndex, questionItem, optionItem) {
  926. if (this.showRightChoose) {
  927. let classNames = ''
  928. if ((questionItem.selected && optionItem.code) || (questionItem.kind == 'MULTI' && optionItem.click_index)) {
  929. classNames = 'active_true'
  930. }
  931. if ((questionItem.kind != 'MULTI' && optionItem.click_index && !optionItem.code) || (questionItem.kind == 'MULTI' && optionItem.click_index && !optionItem.code && questionItem.selected)) {
  932. classNames += ' active'
  933. }
  934. return classNames
  935. } else {
  936. // 练习模式,选择后显示错误选项
  937. if (this.showErrorChoose) {
  938. let result = ''
  939. switch (questionItem.kind) {
  940. // 多选题
  941. case 'MULTI':
  942. let isRight = true
  943. let answer_arr = questionItem.answer.split(',')
  944. // console.log('questionItem.answer', questionItem.answer, questionItem.check, answer_arr)
  945. let check_arr = questionItem.check.indexOf(',') > 0 ? questionItem.check.split(',') : [questionItem.check]
  946. for (const check_answer of check_arr) {
  947. if (!answer_arr.includes(check_answer)) {
  948. isRight = false
  949. break
  950. }
  951. }
  952. // 选择数量跟答案数量一致
  953. if (questionItem.check && (!isRight || questionItem.check.length == questionItem.answer.length)) {
  954. // 选择后显示答案和解析
  955. questionItem.show_answer = true
  956. this.list[questionIndex] = questionItem
  957. }
  958. result = questionItem.answer.indexOf(optionItem.key) > -1 ? 'active_true' : 'active'
  959. break
  960. // 单选/判断
  961. default:
  962. // 选择后显示答案和解析
  963. questionItem.show_answer = true
  964. this.list[questionIndex] = questionItem
  965. // 选择正确与否
  966. result = optionItem.key == questionItem.answer ? 'active_true' : 'active'
  967. break
  968. }
  969. // 记录练习结果
  970. if (result === 'active_true') {
  971. this.list[questionIndex]['is_right'] = 'right'
  972. } else {
  973. this.list[questionIndex]['is_right'] = 'error'
  974. if (this.mode == 'TRAINING') {
  975. // 练题模式 - 记录错题
  976. questionApi.addQuestionWrong(this, {
  977. question_id: questionItem.id,
  978. source: 'TRAINING',
  979. user_answer: questionItem.check
  980. })
  981. }
  982. }
  983. return result
  984. } else {
  985. if (optionItem.click_index) {
  986. return 'active_true'
  987. }
  988. }
  989. }
  990. return ''
  991. },
  992. // 获取未答题数量
  993. getUncheckedCount () {
  994. if (this.mode === 'EXAM') {
  995. let unchecked = []
  996. for (let i in this.list) {
  997. let question = this.list[i]
  998. let item = {
  999. id: question.id,
  1000. answer: ''
  1001. }
  1002. switch (question.kind) {
  1003. case 'JUDGE':
  1004. case 'SINGLE':
  1005. case 'MULTI':
  1006. if (question.check) {
  1007. item.answer = question.check
  1008. } else {
  1009. unchecked.push({
  1010. id: question.id
  1011. })
  1012. }
  1013. break
  1014. case 'FILL':
  1015. if (question.user_answers) {
  1016. item.answer = question.user_answers
  1017. } else {
  1018. unchecked.push({
  1019. id: question.id
  1020. })
  1021. }
  1022. break
  1023. case 'SHORT':
  1024. if (question.user_answers) {
  1025. item.answer = question.user_answers
  1026. } else {
  1027. unchecked.push({
  1028. id: question.id
  1029. })
  1030. }
  1031. break
  1032. }
  1033. }
  1034. return unchecked.length
  1035. } else {
  1036. let right = 0
  1037. let error = 0
  1038. let unchecked = 0
  1039. for (let i in this.list) {
  1040. if (this.list[i].is_right) {
  1041. if (this.list[i].is_right == 'right') {
  1042. right++
  1043. } else {
  1044. error++
  1045. }
  1046. } else {
  1047. unchecked++
  1048. }
  1049. }
  1050. // this.trainResult.right = (Array.from(new Set(this.trainResult.rightIds))).length
  1051. // this.trainResult.error = (Array.from(new Set(this.trainResult.errorIds))).length
  1052. this.trainResult.right = right
  1053. this.trainResult.error = error
  1054. let count = this.total - this.trainResult.right - this.trainResult.error
  1055. return count > 0 ? count : 0;
  1056. }
  1057. },
  1058. // 左下角交卷按钮点击弹窗
  1059. submitShowModal () {
  1060. this.buttonClicked = false
  1061. let unchecked_count = this.getUncheckedCount()
  1062. let modal_title = '确认要交卷吗?'
  1063. if (unchecked_count > 0) {
  1064. modal_title = `还有${unchecked_count}道题未答,` + modal_title
  1065. }
  1066. uni.showModal({
  1067. title: '提示',
  1068. content: modal_title,
  1069. success: res => {
  1070. if (res.confirm) {
  1071. this.submit()
  1072. } else {
  1073. this.buttonClicked = true
  1074. }
  1075. }
  1076. })
  1077. },
  1078. // 倒计时结束
  1079. endOfTime () {
  1080. // 非考试模式不处理
  1081. if (this.mode != 'EXAM') {
  1082. return
  1083. }
  1084. // 为0时不处理
  1085. if (this.limit_time == 0) {
  1086. return
  1087. }
  1088. uni.showToast({
  1089. title: '考试时间到,即将自动交卷',
  1090. duration: 2500
  1091. })
  1092. this.buttonClicked = true
  1093. setTimeout(() => {
  1094. this.submit()
  1095. }, 2500)
  1096. },
  1097. // 交卷
  1098. submit () {
  1099. let data = {}
  1100. let questions = {}
  1101. let list = this.list
  1102. for (let i in list) {
  1103. let item = {}
  1104. switch (list[i].kind) {
  1105. case 'JUDGE':
  1106. case 'SINGLE':
  1107. case 'MULTI':
  1108. item.id = list[i].id
  1109. item.answer = list[i].check ? list[i].check : ''
  1110. break
  1111. case 'FILL':
  1112. item.id = list[i].id
  1113. item.answer = list[i].user_answers ? list[i].user_answers : []
  1114. break
  1115. case 'SHORT':
  1116. item.id = list[i].id
  1117. item.answer = list[i].user_answers ? list[i].user_answers : ''
  1118. break
  1119. default:
  1120. break
  1121. }
  1122. // 材料题主题ID
  1123. item.material_id = list[i].material_id ? list[i].material_id : 0
  1124. questions[i] = item
  1125. }
  1126. data.start_time = this.startTime
  1127. data.questions = questions
  1128. this.$emit('submitQuestion', data)
  1129. },
  1130. // 控制题目面板显示隐藏
  1131. handleNumberPanel () {
  1132. // if (this.mode == 'TRAINING') {
  1133. // return
  1134. // }
  1135. this.showNumberPanel = !this.showNumberPanel;
  1136. },
  1137. // 题目面板跳题
  1138. async changeQuestion (e, type = '') {
  1139. // 题已加载,直接跳
  1140. if (e + 1 <= this.list.length) {
  1141. // this.swiperIndex = e + 1
  1142. this.showNumberPanel = !this.showNumberPanel
  1143. this.swiperChange({ detail: { current: e } })
  1144. } else {
  1145. // 题未加载,一页页加载
  1146. let currLastPage = this.loadQuestionPage.at(-1)
  1147. let willGetPage = Math.round(e / this.pageCount) + 1
  1148. for (var page = currLastPage; page <= willGetPage; page++) {
  1149. if (this.loadQuestionPage.includes(page)) {
  1150. continue;
  1151. }
  1152. await new Promise((resolve, reject) => {
  1153. this.$emit('loadQuestion', page, () => {
  1154. this.loadQuestionPage.push(page)
  1155. if (page >= willGetPage) {
  1156. setTimeout(() => {
  1157. this.changeQuestion(e, 'digui')
  1158. }, 1000)
  1159. }
  1160. resolve()
  1161. })
  1162. })
  1163. }
  1164. }
  1165. },
  1166. // 删除错题
  1167. wrongDel (showDialog = true) {
  1168. // 弹窗提示
  1169. if (showDialog) {
  1170. this.showDeleteDialog = true
  1171. this.wrongDeleteType = 'single'
  1172. return
  1173. }
  1174. this.hideModal()
  1175. // 执行删除
  1176. this.http('question/wrongDelete', {
  1177. question_id: this.list[this.swiperIndex - 1].id
  1178. }, 'get').then(res => {
  1179. uni.showToast({
  1180. icon: 'none',
  1181. title: res.msg
  1182. })
  1183. if (res.code == 1) {
  1184. setTimeout(() => {
  1185. this.$emit('refresh')
  1186. }, 1200)
  1187. }
  1188. });
  1189. },
  1190. // 清空错题
  1191. wrongClear (showDialog = true) {
  1192. // 弹窗提示
  1193. if (showDialog) {
  1194. this.showDeleteDialog = true
  1195. this.wrongDeleteType = 'all'
  1196. return
  1197. }
  1198. this.hideModal()
  1199. // 执行清空
  1200. this.http('question/wrongClear', {}).then(res => {
  1201. uni.showToast({
  1202. icon: 'none',
  1203. title: res.msg
  1204. })
  1205. if (res.code == 1) {
  1206. setTimeout(() => {
  1207. this.$emit('refresh')
  1208. }, 1200)
  1209. }
  1210. });
  1211. },
  1212. // 确认删除错题
  1213. confirmDelWrong () {
  1214. if (this.wrongDeleteType == 'single') {
  1215. this.wrongDel(false)
  1216. } else if (this.wrongDeleteType == 'all') {
  1217. this.wrongClear(false)
  1218. }
  1219. },
  1220. // 隐藏弹窗
  1221. hideModal (e) {
  1222. this.showDeleteDialog = false
  1223. this.showEndTrainDialog = false
  1224. this.buttonClicked = true
  1225. },
  1226. // 添加收藏
  1227. collectAdd () {
  1228. let id = this.list[this.swiperIndex - 1].id
  1229. let index = this.swiperIndex - 1
  1230. this.http('question/collectAdd', {
  1231. question_id: id
  1232. }, 'get').then(res => {
  1233. uni.showToast({
  1234. icon: 'none',
  1235. title: res.msg
  1236. })
  1237. if (res.code == 1) {
  1238. this.list[index]['collected'] = true
  1239. this.$forceUpdate()
  1240. }
  1241. });
  1242. },
  1243. // 取消收藏
  1244. collectDel () {
  1245. let id = this.list[this.swiperIndex - 1].id
  1246. let index = this.swiperIndex - 1
  1247. this.http('question/collectCancel', {
  1248. question_id: id
  1249. }, 'get').then(res => {
  1250. uni.showToast({
  1251. icon: 'none',
  1252. title: res.msg
  1253. })
  1254. if (res.code == 1) {
  1255. this.list[index]['collected'] = false
  1256. this.$forceUpdate()
  1257. }
  1258. });
  1259. },
  1260. // 结束练习弹窗
  1261. endTrainShowModal () {
  1262. this.buttonClicked = false
  1263. this.trainResult.unchecked = this.getUncheckedCount()
  1264. this.showEndTrainDialog = true
  1265. },
  1266. // 结束练习
  1267. endTrain () {
  1268. this.utils.goback()
  1269. },
  1270. // 记忆模式 - 缓存key
  1271. getMemoryCacheKey (cate_id) {
  1272. return this.mode.toLowerCase() + '-' + cate_id
  1273. },
  1274. // 记忆当前题目信息
  1275. memoryQuestion () {
  1276. if (this.viewMode != 'memory') {
  1277. return
  1278. }
  1279. let question = this.list[0]
  1280. let data = {
  1281. memory_cate_id: question.cate_id,
  1282. memory_question_id: question.id,
  1283. memory_index: this.swiperIndex
  1284. }
  1285. this.memoryData = data
  1286. // 缓存当前题目信息
  1287. let cache_key = this.getMemoryCacheKey(question.cate_id) //this.mode.toLowerCase() + '-' + question.cate_id
  1288. this.utils.setData(cache_key, data)
  1289. },
  1290. // 记忆模式 - 跳转上次题标
  1291. jumpMemoryQuestion () {
  1292. // 记忆模式且是第一次加载试题
  1293. if (this.viewMode == 'memory' && this.loadQuestionCount == 0) {
  1294. let cache_key = this.getMemoryCacheKey(this.questions[0].cate_id)
  1295. this.memoryData = this.utils.getData(cache_key)
  1296. if (this.memoryData) {
  1297. // 跳转到上次题标位置
  1298. this.swiperIndex = this.memoryData.memory_index
  1299. }
  1300. }
  1301. },
  1302. // 图片预览
  1303. previewImage (image) {
  1304. uni.previewImage({
  1305. current: 0,
  1306. urls: [image]
  1307. })
  1308. },
  1309. // 填空题 - 处理题目数据
  1310. splitFillTitle (index) {
  1311. if (this.list[index] && this.list[index].kind == 'FILL') {
  1312. if (!this.list[index].title_data) {
  1313. this.list[index]['title_data'] = this.list[index].title.split('______')
  1314. }
  1315. // 未回答标识
  1316. if (!this.list[index].is_answered) {
  1317. this.list[index]['is_answered'] = false
  1318. }
  1319. }
  1320. },
  1321. // 填空题 - 文本框修改
  1322. changeFillInput (e, titleIndex, swiperIndex) {
  1323. if (this.mode == 'VIEW') {
  1324. return
  1325. }
  1326. if (!this.list[swiperIndex - 1]['user_answers']) {
  1327. this.list[swiperIndex - 1]['user_answers'] = []
  1328. }
  1329. this.list[swiperIndex - 1].user_answers[titleIndex] = e.target.value
  1330. },
  1331. // 填空题 - 练习模式 - 确认答案
  1332. confirmFillAnswer () {
  1333. let index = this.swiperIndex - 1
  1334. if (!this.list[index].user_answers || this.list[index].user_answers.length != this.list[index].answer.length) {
  1335. this.utils.toast('请在文本框填写完整的答案')
  1336. return
  1337. }
  1338. let right_count = 0
  1339. for (var i = 0; i < this.list[index].user_answers.length; i++) {
  1340. let user_answer = this.list[index].user_answers[i]
  1341. if (user_answer === '') {
  1342. this.utils.toast('第' + (i + 1) + '个文本框未填写答案')
  1343. return
  1344. }
  1345. let is_right = false
  1346. for (var j = 0; j < this.list[index].answer[i].answers.length; j++) {
  1347. let right_answer = this.list[index].answer[i].answers[j]
  1348. if (user_answer === right_answer) {
  1349. is_right = true
  1350. break
  1351. }
  1352. }
  1353. // 填空题对错 - 文本框样式
  1354. this.list[index].answer[i]['class'] = is_right ? 'fill-input-right' : 'fill-input-error'
  1355. if (is_right) {
  1356. right_count++
  1357. }
  1358. }
  1359. // 练习模式,选择后显示错误选项
  1360. if (this.showErrorChoose) {
  1361. // 记录练题情况
  1362. if (right_count == this.list[index].user_answers.length) {
  1363. // this.trainResult.right++
  1364. this.list[index]['is_right'] = 'right'
  1365. } else {
  1366. // this.trainResult.error++
  1367. this.list[index]['is_right'] = 'error'
  1368. }
  1369. }
  1370. if (this.mode == 'TRAINING') {
  1371. console.log('right_count', right_count, this.list[index].answer.length, this.list[index].user_answers)
  1372. // 练题模式 - 记录错题
  1373. if (right_count != this.list[index].answer.length) {
  1374. questionApi.addQuestionWrong(this, {
  1375. question_id: this.list[index].id,
  1376. source: 'TRAINING',
  1377. user_answer: this.list[index].user_answers
  1378. })
  1379. }
  1380. }
  1381. // 显示答案
  1382. this.list[index]['show_answer'] = true
  1383. // 标记为已回答
  1384. this.list[index]['is_answered'] = true
  1385. this.$forceUpdate()
  1386. },
  1387. // 简答题 - 文本框修改
  1388. changeShortInput (e, swiperIndex) {
  1389. if (this.mode == 'VIEW') {
  1390. return
  1391. }
  1392. if (!this.list[swiperIndex - 1]['user_answers']) {
  1393. this.list[swiperIndex - 1]['user_answers'] = ''
  1394. }
  1395. this.list[swiperIndex - 1].user_answers = e.target.value
  1396. },
  1397. // 简答题 - 练习模式 - 确认答案
  1398. confirmShortAnswer () {
  1399. let index = this.swiperIndex - 1
  1400. if (!this.list[index].user_answers) {
  1401. this.utils.toast('请在文本框填写完整的答案')
  1402. return
  1403. }
  1404. let right_count = 0
  1405. // let right_indexes = []
  1406. for (var i = 0; i < this.list[index].answer.config.length; i++) {
  1407. this.list[index].answer.config[i]['class'] = ''
  1408. if (this.list[index].user_answers.indexOf(this.list[index].answer.config[i].answer) > -1) {
  1409. right_count++
  1410. this.list[index].answer.config[i]['class'] = 'short-input-right'
  1411. // right_indexes.push(i)
  1412. }
  1413. }
  1414. if (this.mode == 'TRAINING') {
  1415. // 练题模式 - 记录错题
  1416. if (right_count != this.list[index].answer.length) {
  1417. questionApi.addQuestionWrong(this, {
  1418. question_id: this.list[index].id,
  1419. source: 'TRAINING',
  1420. user_answer: this.list[index].user_answers
  1421. })
  1422. }
  1423. }
  1424. // 练习模式,选择后显示错误选项
  1425. if (this.showErrorChoose) {
  1426. // 记录练题情况
  1427. if (right_count > 0) {
  1428. // this.trainResult.right++
  1429. this.list[index]['is_right'] = 'right'
  1430. } else {
  1431. // this.trainResult.error++
  1432. this.list[index]['is_right'] = 'error'
  1433. }
  1434. }
  1435. // 显示答案
  1436. this.list[index]['show_answer'] = true
  1437. // 标记为已回答
  1438. this.list[index]['is_answered'] = true
  1439. this.$forceUpdate()
  1440. },
  1441. // 材料题 - 处理材料题目数据
  1442. showFullMaterialTitle (index, item, status = false) {
  1443. if (item && item.material_title != undefined) {// item.kind == 'MATERIAL'
  1444. // 未回答标识
  1445. if (!item.show_full) {
  1446. item['show_full'] = false
  1447. if (this.list[index]) {
  1448. this.list[index]['show_full'] = false
  1449. }
  1450. }
  1451. item.show_full = status
  1452. if (this.list[index]) {
  1453. this.list[index].show_full = status
  1454. }
  1455. // console.log('showFullMaterialTitle', item.show_full)
  1456. this.$forceUpdate()
  1457. }
  1458. },
  1459. }
  1460. }
  1461. </script>
  1462. <style lang="less">
  1463. page {
  1464. height: 100%;
  1465. }
  1466. .questions {
  1467. height: 100%;
  1468. position: relative;
  1469. .test-header {
  1470. width: 100%;
  1471. padding: 0 30rpx;
  1472. display: flex;
  1473. align-items: center;
  1474. justify-content: center;
  1475. height: 80rpx;
  1476. background: #fff;
  1477. position: relative;
  1478. font-size: 34rpx;
  1479. }
  1480. .card-shadow {
  1481. margin-top: 20rpx;
  1482. .topic-title {
  1483. font-size: 34rpx;
  1484. padding: 30rpx 20rpx;
  1485. background: #fff;
  1486. border-bottom: 1px solid #f0f0f0;
  1487. display: flex;
  1488. align-items: center;
  1489. justify-content: space-between;
  1490. .topic-title_left {
  1491. display: flex;
  1492. align-items: center;
  1493. .text-kind {
  1494. font-size: 24rpx;
  1495. color: #fff;
  1496. background: linear-gradient(135deg, #7892fd, #5677fc);
  1497. padding: 8rpx 10rpx;
  1498. border-radius: 15rpx 15rpx 15rpx 0;
  1499. margin-right: 20rpx;
  1500. }
  1501. }
  1502. .title-index {
  1503. color: #5677fc;
  1504. }
  1505. }
  1506. .questions-cont {
  1507. height: 100vh;
  1508. display: flex;
  1509. flex-wrap: nowrap;
  1510. transition: all 0.5s;
  1511. .swiper-item {
  1512. width: 100vw;
  1513. min-width: 100vw;
  1514. max-width: 100vw;
  1515. height: 100%;
  1516. overflow: auto;
  1517. .test-main {
  1518. padding: 0 20rpx;
  1519. // margin: 40rpx 30rpx;
  1520. // margin-bottom: 40rpx;
  1521. // border-radius: 8px;
  1522. background: #fff;
  1523. .test-title {
  1524. color: #333;
  1525. padding: 20rpx 0;
  1526. .text-kind {
  1527. font-size: 24rpx;
  1528. color: #fff;
  1529. background: linear-gradient(135deg, #7892fd, #5677fc);
  1530. padding: 8rpx 10rpx;
  1531. border-radius: 15rpx 15rpx 15rpx 0;
  1532. }
  1533. .test-favor {
  1534. position: relative;
  1535. color: #aaa;
  1536. float: right;
  1537. }
  1538. .test-favor-fill {
  1539. background: #fff;
  1540. color: #fbbd08;
  1541. float: right;
  1542. }
  1543. }
  1544. .test-title-fill {
  1545. width: 100%;
  1546. word-wrap: break-word;
  1547. word-break: break-all;
  1548. display: flex;
  1549. flex-wrap: wrap;
  1550. }
  1551. .test-title-fill-item {
  1552. margin: 5px;
  1553. }
  1554. .test-cont {
  1555. display: flex;
  1556. flex-direction: column;
  1557. padding-bottom: 20rpx;
  1558. color: #333333;
  1559. .test-cont-item {
  1560. padding: 20rpx;
  1561. display: flex;
  1562. background-color: #f6f6f6;
  1563. margin-bottom: 20rpx;
  1564. border-radius: 10rpx;
  1565. align-items: center;
  1566. justify-content: center;
  1567. position: relative;
  1568. &::after {
  1569. background: #333;
  1570. content: "";
  1571. width: 100%;
  1572. height: 100%;
  1573. position: absolute;
  1574. opacity: 0;
  1575. transition: all 0.35s;
  1576. }
  1577. &:active::after {
  1578. opacity: .3;
  1579. width: 0%;
  1580. transition: 0s;
  1581. }
  1582. .cont {
  1583. flex: 1;
  1584. height: 100%;
  1585. padding-left: 20rpx;
  1586. display: flex;
  1587. align-items: center;
  1588. justify-content: space-between;
  1589. .cont-text {
  1590. display: flex;
  1591. align-items: center;
  1592. flex-wrap: wrap;
  1593. flex: 1;
  1594. height: 100%;
  1595. font-p: 32rpx;
  1596. .image {
  1597. width: 50%;
  1598. height: auto;
  1599. margin-right: 20rpx;
  1600. }
  1601. }
  1602. .cont-icon {
  1603. width: 40rpx;
  1604. margin-left: 20rpx;
  1605. color: #5677fc;
  1606. font-size: 36rpx;
  1607. }
  1608. }
  1609. .key {
  1610. width: 50rpx;
  1611. height: 50rpx;
  1612. background-color: #d0d0d0;
  1613. border-radius: 50%;
  1614. color: #FFFFFF;
  1615. display: flex;
  1616. align-items: center;
  1617. justify-content: center;
  1618. }
  1619. &.active_true {
  1620. background-color: rgba(86, 119, 252, 0.2);
  1621. .key {
  1622. background-color: #5677fc;
  1623. }
  1624. .cont {
  1625. .cont-icon {
  1626. font-weight: bold;
  1627. color: #5677fc;
  1628. }
  1629. }
  1630. }
  1631. &.active {
  1632. background-color: rgba(255, 68, 0, 0.2);
  1633. .key {
  1634. background-color: #ff4400;
  1635. }
  1636. .cont {
  1637. .cont-icon {
  1638. font-weight: bold;
  1639. color: #ff4400;
  1640. }
  1641. }
  1642. }
  1643. }
  1644. }
  1645. }
  1646. .test-describe {
  1647. // padding: 0 20rpx;
  1648. padding-bottom: 10px;
  1649. background-color: #fff;
  1650. .describe-title {
  1651. height: 48px;
  1652. line-height: 48px;
  1653. display: flex;
  1654. text {
  1655. color: #666;
  1656. font-size: 12px;
  1657. }
  1658. image {
  1659. width: 14px;
  1660. height: 14px;
  1661. margin-top: 17px;
  1662. margin-left: 3px;
  1663. }
  1664. }
  1665. .describe-cont {
  1666. // background: #f5f5f5;
  1667. // padding: 12rpx;
  1668. display: flex;
  1669. flex-direction: column;
  1670. font-size: 34rpx;
  1671. margin-top: 8rpx;
  1672. line-height: 40rpx;
  1673. // & > view {
  1674. // color: #666;
  1675. // font-size: 30rpx;
  1676. // background-color: #fff;
  1677. // text-indent: 15px;
  1678. // margin-bottom: 2rpx;
  1679. // // margin-top: 2rpx;
  1680. // // border-radius: 10rpx;
  1681. // // &:nth-child(3) {
  1682. // // font-size: 12px;
  1683. // // line-height: 20px;
  1684. // // }
  1685. // }
  1686. }
  1687. }
  1688. }
  1689. }
  1690. }
  1691. .fixed-bottom {
  1692. .tibiao {
  1693. background: #fff;
  1694. width: 100%;
  1695. height: 50vh;
  1696. padding: 35rpx;
  1697. padding-bottom: calc(constant(safe-area-inset-bottom) + 35rpx);
  1698. padding-bottom: calc(constant(safe-area-inset-bottom) + 35rpx);
  1699. border-radius: 20rpx 20rpx 0 0;
  1700. .tibiao-scroll {
  1701. height: 100%;
  1702. .tibiao-scroll-list {
  1703. display: flex;
  1704. align-items: center;
  1705. flex-wrap: wrap;
  1706. .tibiao-item {
  1707. height: 100rpx;
  1708. width: 100rpx;
  1709. border-radius: 50%;
  1710. margin-bottom: 30rpx;
  1711. border: 1rpx solid #d0d0d0;
  1712. display: flex;
  1713. align-items: center;
  1714. justify-content: center;
  1715. margin-right: 45rpx;
  1716. &:nth-child(5n) {
  1717. margin-right: 0;
  1718. }
  1719. &.tibiao-right {
  1720. background: #4caf50;
  1721. color: #fff;
  1722. }
  1723. &.tibiao-error {
  1724. background: #ff4400;
  1725. color: #fff;
  1726. }
  1727. &.selected {
  1728. background: #5677fc;
  1729. color: #fff;
  1730. }
  1731. }
  1732. }
  1733. }
  1734. }
  1735. }
  1736. }
  1737. .cu-list {
  1738. width: 100%;
  1739. height: 100rpx;
  1740. position: fixed;
  1741. left: 0;
  1742. bottom: 0;
  1743. text-align: center;
  1744. border-radius: 8px;
  1745. }
  1746. .cu-list.grid > .cu-item {
  1747. padding-top: 5px;
  1748. }
  1749. .cu-list image {
  1750. width: 25px;
  1751. height: 25px;
  1752. display: inline-block;
  1753. margin: 0 auto;
  1754. }
  1755. // 弹窗
  1756. .result {
  1757. width: 100%;
  1758. height: 100vh;
  1759. background: #fff;
  1760. padding-top: 10px;
  1761. }
  1762. .progress_box {
  1763. position: relative;
  1764. width: 100%;
  1765. display: flex;
  1766. align-items: center;
  1767. justify-content: center;
  1768. text-align: center;
  1769. }
  1770. .progress_bg {
  1771. position: absolute;
  1772. width: 220px;
  1773. height: 220px;
  1774. }
  1775. .progress_bar {
  1776. width: 220px;
  1777. height: 220px;
  1778. }
  1779. .progress_txt {
  1780. position: absolute;
  1781. font-size: 28upx;
  1782. color: #999999;
  1783. }
  1784. .progress_info {
  1785. font-size: 36upx;
  1786. padding-left: 16upx;
  1787. letter-spacing: 2upx;
  1788. font-size: 52upx;
  1789. color: #333333;
  1790. }
  1791. .progress_dot {
  1792. width: 16upx;
  1793. height: 16upx;
  1794. border-radius: 50%;
  1795. background-color: #fb9126;
  1796. }
  1797. .table {
  1798. width: 90%;
  1799. margin: 0 auto;
  1800. overflow: hidden;
  1801. }
  1802. .describe-item {
  1803. // height: 70rpx;
  1804. padding-top: 20rpx;
  1805. text-indent: 30rpx;
  1806. }
  1807. .flex_1 {
  1808. text-align: left;
  1809. }
  1810. .flex_2 {
  1811. text-align: right;
  1812. }
  1813. .red {
  1814. color: #f00;
  1815. }
  1816. .error {
  1817. display: inline-block;
  1818. height: 30px;
  1819. line-height: 30px;
  1820. border-radius: 5px;
  1821. padding: 0 10px;
  1822. margin-left: 15px;
  1823. }
  1824. /*收藏 */
  1825. .tui-fabulous__box {
  1826. position: relative;
  1827. }
  1828. .tui-fabulous {
  1829. position: absolute;
  1830. left: 60px;
  1831. top: 0;
  1832. visibility: hidden;
  1833. }
  1834. .tui-fabulous__active {
  1835. animation: fabulousAni 2s linear;
  1836. }
  1837. @keyframes fabulousAni {
  1838. 0% {
  1839. transform: translateY(0) scale(0.8);
  1840. visibility: visible;
  1841. opacity: 1;
  1842. }
  1843. 15% {
  1844. transform: translateY(-40px) scale(1.25);
  1845. opacity: 1;
  1846. }
  1847. 100% {
  1848. transform: translateY(-240px) scale(0.5);
  1849. visibility: hidden;
  1850. opacity: 0;
  1851. }
  1852. }
  1853. /* 红心收藏效果 */
  1854. .cu-list.grid > .cu-item text {
  1855. margin-top: 0;
  1856. }
  1857. .cu-list.grid > .cu-item:after {
  1858. border: 0px;
  1859. }
  1860. .fix-bottom {
  1861. bottom: calc(constant(safe-area-inset-bottom) + 30rpx);
  1862. bottom: calc(env(safe-area-inset-bottom) + 30rpx);
  1863. width: 95%;
  1864. position: fixed;
  1865. margin: 0 auto;
  1866. left: 0;
  1867. right: 0;
  1868. }
  1869. .tui-prompt-title {
  1870. padding-bottom: 20rpx;
  1871. font-size: 34rpx;
  1872. font-weight: bold;
  1873. text-align: center;
  1874. }
  1875. .tui-flex-box {
  1876. width: 100%;
  1877. display: flex;
  1878. align-items: center;
  1879. flex-wrap: wrap;
  1880. margin-top: 40rpx;
  1881. }
  1882. .tui-flex-botton-view {
  1883. width: 45%;
  1884. margin: 0 auto;
  1885. }
  1886. @keyframes anime {
  1887. 0% {
  1888. background-size: 0% 0%;
  1889. }
  1890. 100% {
  1891. background-position: 100% 100%;
  1892. }
  1893. }
  1894. /** 填空题输入框 */
  1895. .fill-input {
  1896. border: 0px;
  1897. border-bottom: 2px solid #5677fc;
  1898. width: 200rpx;
  1899. margin: 0 10rpx;
  1900. }
  1901. .fill-input-right {
  1902. border-bottom: 2px solid #4caf50;
  1903. }
  1904. .fill-input-error {
  1905. border-bottom: 2px solid #ff4400;
  1906. }
  1907. .btn-confirm {
  1908. margin-top: 60rpx;
  1909. margin-bottom: 20rpx;
  1910. }
  1911. /** 简答题输入框 */
  1912. .short-input {
  1913. border: 0px;
  1914. border-bottom: 2px solid #5677fc;
  1915. width: 100%;
  1916. min-height: 500rpx;
  1917. margin: 10rpx;
  1918. }
  1919. .short-input-right {
  1920. color: #4caf50;
  1921. }
  1922. .short-input-error {
  1923. color: #ff4400;
  1924. }
  1925. .material-title {
  1926. background-color: #fff;
  1927. padding: 10px;
  1928. }
  1929. .material-title-tip {
  1930. font-size: 36rpx;
  1931. font-weight: bold;
  1932. }
  1933. .title-video {
  1934. width: 100%;
  1935. min-height: 200px;
  1936. pointer-events: auto !important;
  1937. }
  1938. .explain-video-view {
  1939. width: 100%;
  1940. min-height: 240px;
  1941. background-color: #fff;
  1942. padding: 20px 0px;
  1943. }
  1944. .explain-video {
  1945. width: 100%;
  1946. min-height: 200px;
  1947. pointer-events: auto !important;
  1948. }
  1949. .fab-bg-color {
  1950. background-color: #e6e6e6;
  1951. }
  1952. textarea::-webkit-input-placeholder {
  1953. font-size: 24rpx;
  1954. }
  1955. textarea:-moz-placeholder {
  1956. font-size: 24rpx;
  1957. }
  1958. textarea::-moz-placeholder {
  1959. font-size: 24rpx;
  1960. }
  1961. textarea::-ms-input-placeholder {
  1962. font-size: 24rpx;
  1963. }
  1964. .text-right-answer {
  1965. font-size: 25rpx;
  1966. color: #fff;
  1967. background: linear-gradient(135deg, #7892fd, #5677fc);
  1968. padding: 8rpx 0rpx;
  1969. border-radius: 15rpx 15rpx 15rpx 0;
  1970. margin-left: 20rpx;
  1971. width: 168rpx;
  1972. height: 50rpx;
  1973. line-height: 38rpx;
  1974. display: inline-block;
  1975. }
  1976. .text-right-answer-val {
  1977. font-size: 28rpx;
  1978. color: #5677fc;
  1979. padding: 8rpx 0rpx;
  1980. border-radius: 15rpx 15rpx 15rpx 0;
  1981. margin-left: 0;
  1982. // width: 150rpx;
  1983. // height: 50rpx;
  1984. line-height: 40rpx;
  1985. display: inline-block;
  1986. }
  1987. .answer-row {
  1988. display: flex;
  1989. align-items: center;
  1990. margin-bottom: 10rpx;
  1991. }
  1992. .text-indent {
  1993. text-indent: 30rpx;
  1994. }
  1995. .text-user-answer {
  1996. font-size: 24rpx;
  1997. color: #fff;
  1998. background: linear-gradient(135deg, #7892fd, #5677fc);
  1999. padding: 8rpx 0rpx;
  2000. border-radius: 15rpx 15rpx 15rpx 0;
  2001. margin-left: 20rpx;
  2002. width: 168rpx;
  2003. // height: 50rpx;
  2004. line-height: 38rpx;
  2005. display: flex;
  2006. align-items: center;
  2007. white-space: nowrap;
  2008. overflow: hidden;
  2009. text-overflow: ellipsis;
  2010. text {
  2011. color: #fff;
  2012. font-size: 24rpx;
  2013. }
  2014. }
  2015. .text-right-answer-val-item {
  2016. font-size: 28rpx;
  2017. color: #5677fc;
  2018. padding: 8rpx 0rpx;
  2019. border-radius: 15rpx 15rpx 15rpx 0;
  2020. margin-left: 0;
  2021. }
  2022. .explain-content {
  2023. background-color: #fff9e6;
  2024. margin: 10rpx 20rpx;
  2025. border-radius: 10rpx;
  2026. padding: 10rpx;
  2027. }
  2028. .explain-content-title {
  2029. font-size: 32rpx;
  2030. font-weight: bold;
  2031. margin-bottom: 20rpx;
  2032. text-indent: 30rpx;
  2033. text {
  2034. font-size: 30rpx;
  2035. }
  2036. }
  2037. .explain-content-text {
  2038. font-size: 30rpx !important;
  2039. color: #333333;
  2040. text-indent: 30rpx;
  2041. padding: 6rpx;
  2042. line-height: 42rpx;
  2043. width: 90%;
  2044. display: block;
  2045. }
  2046. .pt-0 {
  2047. padding-top: 0 !important;
  2048. }
  2049. .font-size-30 {
  2050. font-size: 30rpx;
  2051. }
  2052. </style>