onlineExamPlay.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849
  1. <!-- 在线考试答题页 -->
  2. <template>
  3. <view class="exam-screen">
  4. <!-- 顶部栏 -->
  5. <view class="topbar">
  6. <view class="topbar-left" @click="requestSubmit(false)">‹ 交卷</view>
  7. <view class="topbar-title">{{ examInfo.examName || '考试中' }}</view>
  8. <view class="topbar-right" @click="toggleQuestionNav">题号</view>
  9. </view>
  10. <!-- 剩余时间条 -->
  11. <view class="time-bar">
  12. <view class="time-bar-left">
  13. <text class="time-label">剩余时间</text>
  14. <text class="time-value">{{ formattedTime }}</text>
  15. </view>
  16. <text class="time-tip">请合理安排答题时间</text>
  17. </view>
  18. <!-- 答题统计 -->
  19. <view class="stat-row">
  20. <view class="stat-item">
  21. <text class="stat-num stat-answered">{{ answeredCount }}</text>
  22. <text class="stat-label">已答</text>
  23. </view>
  24. <view class="stat-divider"></view>
  25. <view class="stat-item">
  26. <text class="stat-num">{{ unansweredCount }}</text>
  27. <text class="stat-label">未答</text>
  28. </view>
  29. <view class="stat-divider"></view>
  30. <view class="stat-item">
  31. <text class="stat-num">{{ totalCount }}</text>
  32. <text class="stat-label">总题</text>
  33. </view>
  34. </view>
  35. <!-- 题号导航面板 -->
  36. <view v-if="showQuestionNav" class="q-nav-panel">
  37. <view class="q-nav-scroll-wrapper">
  38. <view class="q-nav-header">
  39. <text class="q-nav-title">题目列表</text>
  40. <text class="q-nav-close" @click="toggleQuestionNav">✕</text>
  41. </view>
  42. <scroll-view scroll-y class="q-nav-scroll">
  43. <view v-for="(group, gi) in questionTypeGroups" :key="gi" class="q-group">
  44. <view class="q-group-title">{{ group.questionTypeName }}({{ group.questionCount }}题 {{ group.totalScore }}分)</view>
  45. <view class="q-num-row">
  46. <view
  47. v-for="(q, qi) in group.questions"
  48. :key="qi"
  49. class="q-num"
  50. :class="gi === groupIndex && qi === questionIndex ? 'current' : (q.answered === 1 ? 'answered' : '')"
  51. @click="selectQuestion(gi, qi)"
  52. >{{ q.questionNo }}</view>
  53. </view>
  54. </view>
  55. </scroll-view>
  56. </view>
  57. </view>
  58. <!-- 题目内容 -->
  59. <scroll-view scroll-y class="q-scroll-content">
  60. <view v-if="currentQuestion.snapshotQuestionId" class="q-card">
  61. <view class="q-header">
  62. <view class="q-header-left">
  63. <text class="q-type-badge">{{ currentQuestion.questionTypeName }}</text>
  64. <text class="q-num-text">第 {{ currentQuestion.questionNo }} 题</text>
  65. <text class="q-score-text">({{ currentQuestion.questionScore }}分)</text>
  66. </view>
  67. <text v-if="currentQuestion.difficulty" class="q-difficulty">{{ getDifficultyText(currentQuestion.difficulty) }}</text>
  68. </view>
  69. <view class="q-content">
  70. <rich-text :nodes="currentQuestion.questionContent || ''"></rich-text>
  71. </view>
  72. <view class="q-options">
  73. <view
  74. v-for="(opt, oi) in (currentQuestion.options || [])"
  75. :key="oi"
  76. class="q-option"
  77. :class="{ selected: isSelected(opt.optionLabel) }"
  78. @click="selectAnswer(oi)"
  79. >
  80. <view class="q-option-label">{{ opt.optionLabel }}</view>
  81. <view class="q-option-content">
  82. <rich-text :nodes="opt.optionContent || opt.optionLabel"></rich-text>
  83. </view>
  84. </view>
  85. </view>
  86. </view>
  87. <view v-else-if="pageLoading" class="empty-tip">加载中...</view>
  88. <view v-else class="empty-tip">暂无题目</view>
  89. <view class="scroll-bottom-space"></view>
  90. </scroll-view>
  91. <!-- 上一题/下一题 -->
  92. <view class="q-nav">
  93. <view class="q-nav-btn" :class="{ disabled: isFirstQuestion }" @click="prevQuestion">上一题</view>
  94. <view class="q-nav-btn q-nav-btn-next" :class="{ disabled: isLastQuestion }" @click="nextQuestion">下一题</view>
  95. </view>
  96. <!-- 底部提交 -->
  97. <view class="exam-bottom">
  98. <view class="btn-primary" @click="requestSubmit(false)">提交试卷</view>
  99. </view>
  100. <!-- 交卷结果遮罩 -->
  101. <view v-if="showResult" class="result-shade">
  102. <view class="result-card">
  103. <view class="result-title">{{ resultData.title }}</view>
  104. <view class="result-score">{{ resultData.score }} 分</view>
  105. <view class="result-desc">{{ resultData.desc }}</view>
  106. <view class="result-btns">
  107. <view v-if="resultData.canRetake" class="result-btn result-btn-outline" @click="retakeExam">重新考试</view>
  108. <view class="result-btn result-btn-primary" @click="closeResult">{{ resultData.canRetake ? '返回' : '确认' }}</view>
  109. </view>
  110. </view>
  111. </view>
  112. </view>
  113. </template>
  114. <script>
  115. import {
  116. examElExamAttemptReviewSidebar,
  117. examElExamAttemptReviewQuestion,
  118. examUserExamGetExamSurplusTime,
  119. examUserExamAnswerSave,
  120. examUserExamSubmit,
  121. examUserExamStart,
  122. } from '@/pages_safetyEducationExamination/api/index.js'
  123. export default {
  124. data() {
  125. return {
  126. examId: '',
  127. attemptId: '',
  128. examKind: '',
  129. examInfo: {},
  130. questionTypeGroups: [],
  131. currentQuestion: {},
  132. groupIndex: 0,
  133. questionIndex: 0,
  134. remainingSeconds: 0,
  135. timer: null,
  136. hasWarnedTime: false,
  137. showQuestionNav: false,
  138. pageLoading: false,
  139. isSaving: false,
  140. isSubmitting: false,
  141. hasSubmitted: false,
  142. showResult: false,
  143. resultData: {},
  144. }
  145. },
  146. computed: {
  147. isFirstQuestion() {
  148. return this.groupIndex === 0 && this.questionIndex === 0;
  149. },
  150. isLastQuestion() {
  151. const lastGi = this.questionTypeGroups.length - 1;
  152. if (lastGi < 0) return true;
  153. const lastGroup = this.questionTypeGroups[lastGi];
  154. return this.groupIndex === lastGi && this.questionIndex === (lastGroup.questions.length - 1);
  155. },
  156. totalCount() {
  157. return this.questionTypeGroups.reduce((s, g) => s + (g.questions ? g.questions.length : 0), 0);
  158. },
  159. answeredCount() {
  160. return this.questionTypeGroups.reduce((s, g) => {
  161. return s + (g.questions || []).filter(q => q.answered === 1).length;
  162. }, 0);
  163. },
  164. unansweredCount() {
  165. return this.totalCount - this.answeredCount;
  166. },
  167. formattedTime() {
  168. const s = Math.max(0, Math.floor(this.remainingSeconds));
  169. const m = Math.floor(s / 60);
  170. const sec = s % 60;
  171. return m + '分' + (sec < 10 ? '0' : '') + sec + '秒';
  172. },
  173. },
  174. onLoad(options) {
  175. this.examId = options.examId || '';
  176. this.attemptId = options.attemptId || '';
  177. this.examKind = options.examKind || '';
  178. if (!this.attemptId) {
  179. uni.showToast({ title: '考试信息无效', icon: 'none' });
  180. setTimeout(() => uni.navigateBack(), 1500);
  181. return;
  182. }
  183. this.pageLoading = true;
  184. this.loadSidebar();
  185. },
  186. onShow() {
  187. if (this.hasSubmitted || !this.attemptId) return;
  188. if (this.questionTypeGroups.length > 0) {
  189. this.syncRemainingTime();
  190. }
  191. },
  192. onHide() {
  193. this.clearTimer();
  194. if (!this.hasSubmitted) this.saveCurrentAnswer();
  195. },
  196. onUnload() {
  197. this.clearTimer();
  198. if (!this.hasSubmitted) this.saveCurrentAnswer();
  199. },
  200. methods: {
  201. async loadSidebar() {
  202. try {
  203. const { data } = await examElExamAttemptReviewSidebar({
  204. attemptId: this.attemptId,
  205. examKind: this.examKind,
  206. });
  207. if (data.code === 200 && data.data) {
  208. this.examInfo = {
  209. examTypeName: data.data.examTypeName || '',
  210. examName: data.data.examName || '',
  211. questionCount: data.data.questionCount || 0,
  212. totalScore: data.data.totalScore || 0,
  213. passScore: data.data.passScore || 0,
  214. };
  215. this.$set(this, 'questionTypeGroups', data.data.questionTypeGroups || []);
  216. this.groupIndex = 0;
  217. this.questionIndex = 0;
  218. const firstGroup = this.questionTypeGroups[0];
  219. if (firstGroup && firstGroup.questions && firstGroup.questions.length > 0) {
  220. await this.loadQuestion(firstGroup.questions[0].snapshotQuestionId);
  221. this.syncRemainingTime();
  222. }
  223. } else {
  224. uni.showToast({ title: data.message || '加载失败', icon: 'none' });
  225. }
  226. } catch (e) {
  227. console.error('加载题号导航失败', e);
  228. } finally {
  229. this.pageLoading = false;
  230. }
  231. },
  232. async loadQuestion(snapshotQuestionId) {
  233. try {
  234. const { data } = await examElExamAttemptReviewQuestion({
  235. attemptId: this.attemptId,
  236. snapshotQuestionId: snapshotQuestionId,
  237. examScene: 1,
  238. });
  239. if (data.code === 200 && data.data) {
  240. this.$set(this, 'currentQuestion', data.data);
  241. }
  242. } catch (e) {
  243. console.error('加载题目失败', e);
  244. }
  245. },
  246. async syncRemainingTime() {
  247. try {
  248. const { data } = await examUserExamGetExamSurplusTime({ attemptId: this.attemptId });
  249. if (data.code === 200) {
  250. this.remainingSeconds = Number(data.data) || 0;
  251. this.clearTimer();
  252. this.startTimer();
  253. }
  254. } catch (e) {
  255. console.error('获取剩余时间失败', e);
  256. }
  257. },
  258. startTimer() {
  259. if (this.timer) return;
  260. this.timer = setInterval(() => {
  261. if (this.remainingSeconds <= 0) {
  262. this.clearTimer();
  263. this.autoSubmit();
  264. return;
  265. }
  266. this.remainingSeconds--;
  267. if (this.remainingSeconds === 60 && !this.hasWarnedTime) {
  268. this.hasWarnedTime = true;
  269. uni.showToast({ title: '请注意剩余时间', icon: 'none', duration: 2000 });
  270. }
  271. }, 1000);
  272. },
  273. clearTimer() {
  274. if (this.timer) {
  275. clearInterval(this.timer);
  276. this.timer = null;
  277. }
  278. },
  279. selectAnswer(optIndex) {
  280. const opt = (this.currentQuestion.options || [])[optIndex];
  281. if (!opt || !this.currentQuestion.snapshotQuestionId) return;
  282. let tags = Array.isArray(this.currentQuestion.answerTags) ? [...this.currentQuestion.answerTags] : [];
  283. if (this.currentQuestion.questionType === 2) {
  284. const idx = tags.indexOf(opt.optionLabel);
  285. if (idx === -1) {
  286. tags.push(opt.optionLabel);
  287. } else {
  288. tags.splice(idx, 1);
  289. }
  290. } else {
  291. tags = [opt.optionLabel];
  292. }
  293. this.$set(this.currentQuestion, 'answerTags', tags);
  294. },
  295. isSelected(label) {
  296. const tags = this.currentQuestion.answerTags;
  297. return Array.isArray(tags) && tags.indexOf(label) !== -1;
  298. },
  299. saveCurrentAnswer() {
  300. const q = this.currentQuestion;
  301. if (!q || !q.snapshotQuestionId) return Promise.resolve();
  302. const tags = Array.isArray(q.answerTags) ? q.answerTags.filter(Boolean) : [];
  303. if (tags.length === 0) return Promise.resolve();
  304. return examUserExamAnswerSave({
  305. attemptId: this.attemptId,
  306. snapshotQuestionId: q.snapshotQuestionId,
  307. userAnswer: tags.join(','),
  308. }).then(res => {
  309. if (res.data && res.data.code === 200) {
  310. const groups = this.questionTypeGroups;
  311. if (groups[this.groupIndex] && groups[this.groupIndex].questions[this.questionIndex]) {
  312. this.$set(groups[this.groupIndex].questions[this.questionIndex], 'answered', 1);
  313. }
  314. }
  315. }).catch(e => {
  316. console.error('保存答案失败', e);
  317. });
  318. },
  319. async changeQuestion(targetGi, targetQi) {
  320. if (this.isSaving) return;
  321. if (targetGi === this.groupIndex && targetQi === this.questionIndex) return;
  322. const group = this.questionTypeGroups[targetGi];
  323. if (!group || !group.questions || !group.questions[targetQi]) return;
  324. this.isSaving = true;
  325. await this.saveCurrentAnswer();
  326. this.isSaving = false;
  327. this.groupIndex = targetGi;
  328. this.questionIndex = targetQi;
  329. await this.loadQuestion(group.questions[targetQi].snapshotQuestionId);
  330. },
  331. selectQuestion(gi, qi) {
  332. this.changeQuestion(gi, qi);
  333. this.showQuestionNav = false;
  334. },
  335. prevQuestion() {
  336. if (this.isFirstQuestion || this.isSaving) return;
  337. if (this.questionIndex > 0) {
  338. this.changeQuestion(this.groupIndex, this.questionIndex - 1);
  339. } else {
  340. const prevGi = this.groupIndex - 1;
  341. const prevGroup = this.questionTypeGroups[prevGi];
  342. if (prevGroup) {
  343. this.changeQuestion(prevGi, prevGroup.questions.length - 1);
  344. }
  345. }
  346. },
  347. nextQuestion() {
  348. if (this.isLastQuestion || this.isSaving) return;
  349. const currentGroup = this.questionTypeGroups[this.groupIndex];
  350. if (this.questionIndex < currentGroup.questions.length - 1) {
  351. this.changeQuestion(this.groupIndex, this.questionIndex + 1);
  352. } else {
  353. this.changeQuestion(this.groupIndex + 1, 0);
  354. }
  355. },
  356. toggleQuestionNav() {
  357. this.showQuestionNav = !this.showQuestionNav;
  358. },
  359. getNumClass(gi, qi, q) {
  360. if (gi === this.groupIndex && qi === this.questionIndex) return 'current';
  361. if (q.answered === 1) return 'answered';
  362. return '';
  363. },
  364. getDifficultyText(d) {
  365. return { 1: '简单', 2: '一般', 3: '较难', 4: '很难' }[d] || '';
  366. },
  367. async requestSubmit(isAuto) {
  368. if (this.isSubmitting || this.hasSubmitted) return;
  369. this.isSubmitting = true;
  370. await this.saveCurrentAnswer();
  371. const unanswered = this.unansweredCount;
  372. if (isAuto) {
  373. await this.doSubmit();
  374. this.isSubmitting = false;
  375. return;
  376. }
  377. const content = unanswered > 0 ? `还有${unanswered}题未答,确认要交卷吗?` : '确认要交卷吗?';
  378. uni.showModal({
  379. title: '提示',
  380. content: content,
  381. success: async (res) => {
  382. if (res.confirm) {
  383. await this.doSubmit();
  384. }
  385. this.isSubmitting = false;
  386. },
  387. fail: () => { this.isSubmitting = false; }
  388. });
  389. },
  390. async autoSubmit() {
  391. if (this.isSubmitting || this.hasSubmitted) return;
  392. this.isSubmitting = true;
  393. await this.saveCurrentAnswer();
  394. uni.showToast({ title: '考试时间结束,正在提交…', icon: 'none' });
  395. await this.doSubmit();
  396. this.isSubmitting = false;
  397. },
  398. async doSubmit() {
  399. try {
  400. const { data } = await examUserExamSubmit({ attemptId: this.attemptId });
  401. if (data.code === 200 && data.data) {
  402. this.hasSubmitted = true;
  403. this.clearTimer();
  404. this.buildResult(data.data);
  405. this.showResult = true;
  406. } else {
  407. uni.showToast({ title: data.message || '交卷失败', icon: 'none' });
  408. }
  409. } catch (e) {
  410. console.error('交卷失败', e);
  411. uni.showToast({ title: '交卷失败', icon: 'none' });
  412. }
  413. },
  414. buildResult(resp) {
  415. const score = resp.totalScore || 0;
  416. const pass = score >= (this.examInfo.passScore || 0);
  417. if (pass) {
  418. this.resultData = {
  419. title: '考试通过',
  420. score: score,
  421. desc: resp.needPrompt === 1 ? '恭喜!本次成绩为最佳记录' : '考试已通过',
  422. canRetake: false,
  423. };
  424. } else if (resp.canContinueExam === 1) {
  425. this.resultData = {
  426. title: '考试未通过',
  427. score: score,
  428. desc: `未达及格线 ${this.examInfo.passScore} 分,可重新考试`,
  429. canRetake: true,
  430. };
  431. } else {
  432. this.resultData = {
  433. title: '考试未通过',
  434. score: score,
  435. desc: '未达及格线,暂无剩余考试机会',
  436. canRetake: false,
  437. };
  438. }
  439. },
  440. async retakeExam() {
  441. try {
  442. const { data } = await examUserExamStart({ examId: this.examId, examScene: 1 });
  443. if (data.code === 200 && data.data && data.data.attemptId) {
  444. this.attemptId = data.data.attemptId;
  445. this.showResult = false;
  446. this.hasSubmitted = false;
  447. this.isSubmitting = false;
  448. this.hasWarnedTime = false;
  449. this.$set(this, 'questionTypeGroups', []);
  450. this.$set(this, 'currentQuestion', {});
  451. this.groupIndex = 0;
  452. this.questionIndex = 0;
  453. this.remainingSeconds = 0;
  454. this.pageLoading = true;
  455. this.loadSidebar();
  456. } else {
  457. uni.showToast({ title: data.message || '重新考试失败', icon: 'none' });
  458. }
  459. } catch (e) {
  460. console.error('重新考试失败', e);
  461. uni.showToast({ title: '重新考试失败', icon: 'none' });
  462. }
  463. },
  464. closeResult() {
  465. this.showResult = false;
  466. uni.navigateBack();
  467. },
  468. }
  469. }
  470. </script>
  471. <style lang="stylus" scoped>
  472. .exam-screen
  473. height 100%
  474. display flex
  475. flex-direction column
  476. background #f5f7fa
  477. position relative
  478. .topbar
  479. display flex
  480. align-items center
  481. justify-content space-between
  482. height 88rpx
  483. padding 0 28rpx
  484. background #fff
  485. border-bottom 1rpx solid #e8edf3
  486. flex-shrink 0
  487. .topbar-left
  488. font-size 28rpx
  489. color #1677ff
  490. min-width 80rpx
  491. .topbar-title
  492. font-size 28rpx
  493. font-weight 600
  494. color #222
  495. flex 1
  496. text-align center
  497. .topbar-right
  498. font-size 28rpx
  499. color #1677ff
  500. min-width 80rpx
  501. text-align right
  502. .time-bar
  503. display flex
  504. align-items center
  505. justify-content space-between
  506. padding 20rpx 28rpx
  507. background linear-gradient(90deg, #1677ff 0%, #0958d9 100%)
  508. flex-shrink 0
  509. .time-bar-left
  510. display flex
  511. align-items baseline
  512. .time-label
  513. font-size 24rpx
  514. color rgba(255,255,255,0.85)
  515. margin-right 16rpx
  516. .time-value
  517. font-size 44rpx
  518. font-weight 700
  519. color #fff
  520. .time-tip
  521. font-size 22rpx
  522. color rgba(255,255,255,0.75)
  523. .stat-row
  524. display flex
  525. align-items center
  526. background #fff
  527. padding 20rpx 0
  528. flex-shrink 0
  529. border-bottom 1rpx solid #e8edf3
  530. .stat-item
  531. flex 1
  532. display flex
  533. flex-direction column
  534. align-items center
  535. .stat-divider
  536. width 1rpx
  537. height 40rpx
  538. background #eee
  539. .stat-num
  540. font-size 36rpx
  541. font-weight 700
  542. color #333
  543. line-height 1
  544. .stat-answered
  545. color #1677ff
  546. .stat-label
  547. font-size 22rpx
  548. color #999
  549. margin-top 6rpx
  550. .q-nav-panel
  551. position absolute
  552. top 0
  553. left 0
  554. right 0
  555. bottom 0
  556. background rgba(0,0,0,0.45)
  557. z-index 100
  558. display flex
  559. flex-direction column
  560. justify-content flex-end
  561. .q-nav-scroll-wrapper
  562. background #fff
  563. border-radius 32rpx 32rpx 0 0
  564. max-height 70vh
  565. display flex
  566. flex-direction column
  567. .q-nav-header
  568. display flex
  569. align-items center
  570. justify-content space-between
  571. padding 28rpx 28rpx 16rpx
  572. flex-shrink 0
  573. .q-nav-title
  574. font-size 30rpx
  575. font-weight 600
  576. color #222
  577. .q-nav-close
  578. font-size 32rpx
  579. color #999
  580. padding 10rpx
  581. .q-nav-scroll
  582. flex 1
  583. overflow hidden
  584. padding-bottom 40rpx
  585. .q-group
  586. padding 0 28rpx 16rpx
  587. .q-group-title
  588. font-size 24rpx
  589. color #666
  590. line-height 60rpx
  591. .q-num-row
  592. display flex
  593. flex-wrap wrap
  594. .q-num
  595. width 72rpx
  596. height 72rpx
  597. line-height 72rpx
  598. text-align center
  599. font-size 24rpx
  600. border-radius 12rpx
  601. margin 8rpx
  602. background #f4f6fa
  603. color #333
  604. border 1rpx solid transparent
  605. .q-num.answered
  606. background #e6f4ff
  607. color #1677ff
  608. border-color #91caff
  609. .q-num.current
  610. background #1677ff
  611. color #fff
  612. .q-scroll-content
  613. flex 1
  614. overflow hidden
  615. .q-card
  616. margin 24rpx
  617. padding 28rpx
  618. background #fff
  619. border-radius 20rpx
  620. border 1rpx solid #dde3ed
  621. .q-header
  622. display flex
  623. align-items center
  624. justify-content space-between
  625. margin-bottom 20rpx
  626. .q-header-left
  627. display flex
  628. align-items center
  629. .q-type-badge
  630. font-size 20rpx
  631. padding 4rpx 14rpx
  632. background #e6f4ff
  633. color #1677ff
  634. border 1rpx solid #91caff
  635. border-radius 8rpx
  636. margin-right 12rpx
  637. .q-num-text
  638. font-size 26rpx
  639. color #333
  640. .q-score-text
  641. font-size 22rpx
  642. color #999
  643. .q-difficulty
  644. font-size 22rpx
  645. color #fa8c16
  646. background #fff7e6
  647. padding 4rpx 12rpx
  648. border-radius 8rpx
  649. .q-content
  650. font-size 28rpx
  651. line-height 1.8
  652. color #222
  653. margin-bottom 24rpx
  654. .q-options
  655. display flex
  656. flex-direction column
  657. .q-option
  658. display flex
  659. align-items center
  660. padding 22rpx 20rpx
  661. margin-bottom 16rpx
  662. border 2rpx solid #dde3ed
  663. border-radius 16rpx
  664. background #fff
  665. .q-option.selected
  666. border-color #1677ff
  667. background #e6f4ff
  668. .q-option-label
  669. width 48rpx
  670. height 48rpx
  671. line-height 48rpx
  672. text-align center
  673. border-radius 50%
  674. background #f4f6fa
  675. color #333
  676. font-size 24rpx
  677. font-weight 600
  678. margin-right 20rpx
  679. flex-shrink 0
  680. .q-option.selected .q-option-label
  681. background #1677ff
  682. color #fff
  683. .q-option-content
  684. flex 1
  685. font-size 26rpx
  686. color #333
  687. line-height 1.6
  688. .scroll-bottom-space
  689. height 200rpx
  690. .q-nav
  691. display flex
  692. background #fff
  693. border-top 1rpx solid #e8edf3
  694. flex-shrink 0
  695. .q-nav-btn
  696. flex 1
  697. height 88rpx
  698. line-height 88rpx
  699. text-align center
  700. font-size 28rpx
  701. color #1677ff
  702. .q-nav-btn.q-nav-btn-next
  703. border-left 1rpx solid #e8edf3
  704. .q-nav-btn.disabled
  705. color #ccc
  706. .exam-bottom
  707. padding 20rpx 24rpx
  708. padding-bottom calc(20rpx + env(safe-area-inset-bottom))
  709. background #fff
  710. border-top 1rpx solid #e8edf3
  711. flex-shrink 0
  712. .btn-primary
  713. background #1677ff
  714. color #fff
  715. border-radius 16rpx
  716. font-size 30rpx
  717. font-weight 600
  718. height 88rpx
  719. line-height 88rpx
  720. text-align center
  721. .result-shade
  722. position fixed
  723. top 0
  724. left 0
  725. right 0
  726. bottom 0
  727. background rgba(0,0,0,0.55)
  728. z-index 200
  729. display flex
  730. align-items center
  731. justify-content center
  732. .result-card
  733. width 580rpx
  734. background #fff
  735. border-radius 24rpx
  736. padding 48rpx 40rpx 36rpx
  737. display flex
  738. flex-direction column
  739. align-items center
  740. .result-title
  741. font-size 32rpx
  742. font-weight 700
  743. color #222
  744. margin-bottom 20rpx
  745. .result-score
  746. font-size 72rpx
  747. font-weight 700
  748. color #1677ff
  749. line-height 1
  750. margin-bottom 16rpx
  751. .result-desc
  752. font-size 26rpx
  753. color #666
  754. text-align center
  755. margin-bottom 36rpx
  756. line-height 1.6
  757. .result-btns
  758. display flex
  759. width 100%
  760. .result-btn
  761. flex 1
  762. height 80rpx
  763. line-height 80rpx
  764. text-align center
  765. border-radius 14rpx
  766. font-size 28rpx
  767. .result-btn-outline
  768. border 1rpx solid #1677ff
  769. color #1677ff
  770. margin-right 20rpx
  771. .result-btn-primary
  772. background #1677ff
  773. color #fff
  774. .empty-tip
  775. text-align center
  776. padding 80rpx 0
  777. color #aaa
  778. font-size 26rpx
  779. </style>