onlineExamPlay.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848
  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(opt)"
  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. this.saveCurrentAnswer();
  195. },
  196. onUnload() {
  197. this.clearTimer();
  198. 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(opt) {
  280. if (!this.currentQuestion.snapshotQuestionId) return;
  281. let tags = Array.isArray(this.currentQuestion.answerTags) ? [...this.currentQuestion.answerTags] : [];
  282. if (this.currentQuestion.questionType === 2) {
  283. const idx = tags.indexOf(opt.optionLabel);
  284. if (idx === -1) {
  285. tags.push(opt.optionLabel);
  286. } else {
  287. tags.splice(idx, 1);
  288. }
  289. } else {
  290. tags = [opt.optionLabel];
  291. }
  292. this.$set(this.currentQuestion, 'answerTags', tags);
  293. },
  294. isSelected(label) {
  295. const tags = this.currentQuestion.answerTags;
  296. return Array.isArray(tags) && tags.indexOf(label) !== -1;
  297. },
  298. saveCurrentAnswer() {
  299. const q = this.currentQuestion;
  300. if (!q || !q.snapshotQuestionId) return Promise.resolve();
  301. const tags = Array.isArray(q.answerTags) ? q.answerTags.filter(Boolean) : [];
  302. if (tags.length === 0) return Promise.resolve();
  303. return examUserExamAnswerSave({
  304. attemptId: this.attemptId,
  305. snapshotQuestionId: q.snapshotQuestionId,
  306. userAnswer: tags.join(','),
  307. }).then(res => {
  308. if (res.data && res.data.code === 200) {
  309. const groups = this.questionTypeGroups;
  310. if (groups[this.groupIndex] && groups[this.groupIndex].questions[this.questionIndex]) {
  311. this.$set(groups[this.groupIndex].questions[this.questionIndex], 'answered', 1);
  312. }
  313. }
  314. }).catch(e => {
  315. console.error('保存答案失败', e);
  316. });
  317. },
  318. async changeQuestion(targetGi, targetQi) {
  319. if (this.isSaving) return;
  320. if (targetGi === this.groupIndex && targetQi === this.questionIndex) return;
  321. const group = this.questionTypeGroups[targetGi];
  322. if (!group || !group.questions || !group.questions[targetQi]) return;
  323. this.isSaving = true;
  324. await this.saveCurrentAnswer();
  325. this.isSaving = false;
  326. this.groupIndex = targetGi;
  327. this.questionIndex = targetQi;
  328. await this.loadQuestion(group.questions[targetQi].snapshotQuestionId);
  329. },
  330. selectQuestion(gi, qi) {
  331. this.changeQuestion(gi, qi);
  332. this.showQuestionNav = false;
  333. },
  334. prevQuestion() {
  335. if (this.isFirstQuestion || this.isSaving) return;
  336. if (this.questionIndex > 0) {
  337. this.changeQuestion(this.groupIndex, this.questionIndex - 1);
  338. } else {
  339. const prevGi = this.groupIndex - 1;
  340. const prevGroup = this.questionTypeGroups[prevGi];
  341. if (prevGroup) {
  342. this.changeQuestion(prevGi, prevGroup.questions.length - 1);
  343. }
  344. }
  345. },
  346. nextQuestion() {
  347. if (this.isLastQuestion || this.isSaving) return;
  348. const currentGroup = this.questionTypeGroups[this.groupIndex];
  349. if (this.questionIndex < currentGroup.questions.length - 1) {
  350. this.changeQuestion(this.groupIndex, this.questionIndex + 1);
  351. } else {
  352. this.changeQuestion(this.groupIndex + 1, 0);
  353. }
  354. },
  355. toggleQuestionNav() {
  356. this.showQuestionNav = !this.showQuestionNav;
  357. },
  358. getNumClass(gi, qi, q) {
  359. if (gi === this.groupIndex && qi === this.questionIndex) return 'current';
  360. if (q.answered === 1) return 'answered';
  361. return '';
  362. },
  363. getDifficultyText(d) {
  364. return { 1: '简单', 2: '一般', 3: '较难', 4: '很难' }[d] || '';
  365. },
  366. async requestSubmit(isAuto) {
  367. if (this.isSubmitting || this.hasSubmitted) return;
  368. this.isSubmitting = true;
  369. await this.saveCurrentAnswer();
  370. const unanswered = this.unansweredCount;
  371. if (isAuto) {
  372. await this.doSubmit();
  373. this.isSubmitting = false;
  374. return;
  375. }
  376. const content = unanswered > 0 ? `还有${unanswered}题未答,确认要交卷吗?` : '确认要交卷吗?';
  377. uni.showModal({
  378. title: '提示',
  379. content: content,
  380. success: async (res) => {
  381. if (res.confirm) {
  382. await this.doSubmit();
  383. }
  384. this.isSubmitting = false;
  385. },
  386. fail: () => { this.isSubmitting = false; }
  387. });
  388. },
  389. async autoSubmit() {
  390. if (this.isSubmitting || this.hasSubmitted) return;
  391. this.isSubmitting = true;
  392. await this.saveCurrentAnswer();
  393. uni.showToast({ title: '考试时间结束,正在提交…', icon: 'none' });
  394. await this.doSubmit();
  395. this.isSubmitting = false;
  396. },
  397. async doSubmit() {
  398. try {
  399. const { data } = await examUserExamSubmit({ attemptId: this.attemptId });
  400. if (data.code === 200 && data.data) {
  401. this.hasSubmitted = true;
  402. this.clearTimer();
  403. this.buildResult(data.data);
  404. this.showResult = true;
  405. } else {
  406. uni.showToast({ title: data.message || '交卷失败', icon: 'none' });
  407. }
  408. } catch (e) {
  409. console.error('交卷失败', e);
  410. uni.showToast({ title: '交卷失败', icon: 'none' });
  411. }
  412. },
  413. buildResult(resp) {
  414. const score = resp.totalScore || 0;
  415. const pass = score >= (this.examInfo.passScore || 0);
  416. if (pass) {
  417. this.resultData = {
  418. title: '考试通过',
  419. score: score,
  420. desc: resp.needPrompt === 1 ? '恭喜!本次成绩为最佳记录' : '考试已通过',
  421. canRetake: false,
  422. };
  423. } else if (resp.canContinueExam === 1) {
  424. this.resultData = {
  425. title: '考试未通过',
  426. score: score,
  427. desc: `未达及格线 ${this.examInfo.passScore} 分,可重新考试`,
  428. canRetake: true,
  429. };
  430. } else {
  431. this.resultData = {
  432. title: '考试未通过',
  433. score: score,
  434. desc: '未达及格线,暂无剩余考试机会',
  435. canRetake: false,
  436. };
  437. }
  438. },
  439. async retakeExam() {
  440. try {
  441. const { data } = await examUserExamStart({ examId: this.examId, examScene: 1 });
  442. if (data.code === 200 && data.data && data.data.attemptId) {
  443. this.attemptId = data.data.attemptId;
  444. this.showResult = false;
  445. this.hasSubmitted = false;
  446. this.isSubmitting = false;
  447. this.hasWarnedTime = false;
  448. this.$set(this, 'questionTypeGroups', []);
  449. this.$set(this, 'currentQuestion', {});
  450. this.groupIndex = 0;
  451. this.questionIndex = 0;
  452. this.remainingSeconds = 0;
  453. this.pageLoading = true;
  454. this.loadSidebar();
  455. } else {
  456. uni.showToast({ title: data.message || '重新考试失败', icon: 'none' });
  457. }
  458. } catch (e) {
  459. console.error('重新考试失败', e);
  460. uni.showToast({ title: '重新考试失败', icon: 'none' });
  461. }
  462. },
  463. closeResult() {
  464. this.showResult = false;
  465. uni.navigateBack();
  466. },
  467. }
  468. }
  469. </script>
  470. <style lang="stylus" scoped>
  471. .exam-screen
  472. height 100%
  473. display flex
  474. flex-direction column
  475. background #f5f7fa
  476. position relative
  477. .topbar
  478. display flex
  479. align-items center
  480. justify-content space-between
  481. height 88rpx
  482. padding 0 28rpx
  483. background #fff
  484. border-bottom 1rpx solid #e8edf3
  485. flex-shrink 0
  486. .topbar-left
  487. font-size 28rpx
  488. color #1677ff
  489. min-width 80rpx
  490. .topbar-title
  491. font-size 28rpx
  492. font-weight 600
  493. color #222
  494. flex 1
  495. text-align center
  496. .topbar-right
  497. font-size 28rpx
  498. color #1677ff
  499. min-width 80rpx
  500. text-align right
  501. .time-bar
  502. display flex
  503. align-items center
  504. justify-content space-between
  505. padding 20rpx 28rpx
  506. background linear-gradient(90deg, #1677ff 0%, #0958d9 100%)
  507. flex-shrink 0
  508. .time-bar-left
  509. display flex
  510. align-items baseline
  511. .time-label
  512. font-size 24rpx
  513. color rgba(255,255,255,0.85)
  514. margin-right 16rpx
  515. .time-value
  516. font-size 44rpx
  517. font-weight 700
  518. color #fff
  519. .time-tip
  520. font-size 22rpx
  521. color rgba(255,255,255,0.75)
  522. .stat-row
  523. display flex
  524. align-items center
  525. background #fff
  526. padding 20rpx 0
  527. flex-shrink 0
  528. border-bottom 1rpx solid #e8edf3
  529. .stat-item
  530. flex 1
  531. display flex
  532. flex-direction column
  533. align-items center
  534. .stat-divider
  535. width 1rpx
  536. height 40rpx
  537. background #eee
  538. .stat-num
  539. font-size 36rpx
  540. font-weight 700
  541. color #333
  542. line-height 1
  543. .stat-answered
  544. color #1677ff
  545. .stat-label
  546. font-size 22rpx
  547. color #999
  548. margin-top 6rpx
  549. .q-nav-panel
  550. position absolute
  551. top 0
  552. left 0
  553. right 0
  554. bottom 0
  555. background rgba(0,0,0,0.45)
  556. z-index 100
  557. display flex
  558. flex-direction column
  559. justify-content flex-end
  560. .q-nav-scroll-wrapper
  561. background #fff
  562. border-radius 32rpx 32rpx 0 0
  563. max-height 70vh
  564. display flex
  565. flex-direction column
  566. .q-nav-header
  567. display flex
  568. align-items center
  569. justify-content space-between
  570. padding 28rpx 28rpx 16rpx
  571. flex-shrink 0
  572. .q-nav-title
  573. font-size 30rpx
  574. font-weight 600
  575. color #222
  576. .q-nav-close
  577. font-size 32rpx
  578. color #999
  579. padding 10rpx
  580. .q-nav-scroll
  581. flex 1
  582. overflow hidden
  583. padding-bottom 40rpx
  584. .q-group
  585. padding 0 28rpx 16rpx
  586. .q-group-title
  587. font-size 24rpx
  588. color #666
  589. line-height 60rpx
  590. .q-num-row
  591. display flex
  592. flex-wrap wrap
  593. .q-num
  594. width 72rpx
  595. height 72rpx
  596. line-height 72rpx
  597. text-align center
  598. font-size 24rpx
  599. border-radius 12rpx
  600. margin 8rpx
  601. background #f4f6fa
  602. color #333
  603. border 1rpx solid transparent
  604. .q-num.answered
  605. background #e6f4ff
  606. color #1677ff
  607. border-color #91caff
  608. .q-num.current
  609. background #1677ff
  610. color #fff
  611. .q-scroll-content
  612. flex 1
  613. overflow hidden
  614. .q-card
  615. margin 24rpx
  616. padding 28rpx
  617. background #fff
  618. border-radius 20rpx
  619. border 1rpx solid #dde3ed
  620. .q-header
  621. display flex
  622. align-items center
  623. justify-content space-between
  624. margin-bottom 20rpx
  625. .q-header-left
  626. display flex
  627. align-items center
  628. .q-type-badge
  629. font-size 20rpx
  630. padding 4rpx 14rpx
  631. background #e6f4ff
  632. color #1677ff
  633. border 1rpx solid #91caff
  634. border-radius 8rpx
  635. margin-right 12rpx
  636. .q-num-text
  637. font-size 26rpx
  638. color #333
  639. .q-score-text
  640. font-size 22rpx
  641. color #999
  642. .q-difficulty
  643. font-size 22rpx
  644. color #fa8c16
  645. background #fff7e6
  646. padding 4rpx 12rpx
  647. border-radius 8rpx
  648. .q-content
  649. font-size 28rpx
  650. line-height 1.8
  651. color #222
  652. margin-bottom 24rpx
  653. .q-options
  654. display flex
  655. flex-direction column
  656. .q-option
  657. display flex
  658. align-items center
  659. padding 22rpx 20rpx
  660. margin-bottom 16rpx
  661. border 2rpx solid #dde3ed
  662. border-radius 16rpx
  663. background #fff
  664. .q-option.selected
  665. border-color #1677ff
  666. background #e6f4ff
  667. .q-option-label
  668. width 48rpx
  669. height 48rpx
  670. line-height 48rpx
  671. text-align center
  672. border-radius 50%
  673. background #f4f6fa
  674. color #333
  675. font-size 24rpx
  676. font-weight 600
  677. margin-right 20rpx
  678. flex-shrink 0
  679. .q-option.selected .q-option-label
  680. background #1677ff
  681. color #fff
  682. .q-option-content
  683. flex 1
  684. font-size 26rpx
  685. color #333
  686. line-height 1.6
  687. .scroll-bottom-space
  688. height 200rpx
  689. .q-nav
  690. display flex
  691. background #fff
  692. border-top 1rpx solid #e8edf3
  693. flex-shrink 0
  694. .q-nav-btn
  695. flex 1
  696. height 88rpx
  697. line-height 88rpx
  698. text-align center
  699. font-size 28rpx
  700. color #1677ff
  701. .q-nav-btn.q-nav-btn-next
  702. border-left 1rpx solid #e8edf3
  703. .q-nav-btn.disabled
  704. color #ccc
  705. .exam-bottom
  706. padding 20rpx 24rpx
  707. padding-bottom calc(20rpx + env(safe-area-inset-bottom))
  708. background #fff
  709. border-top 1rpx solid #e8edf3
  710. flex-shrink 0
  711. .btn-primary
  712. background #1677ff
  713. color #fff
  714. border-radius 16rpx
  715. font-size 30rpx
  716. font-weight 600
  717. height 88rpx
  718. line-height 88rpx
  719. text-align center
  720. .result-shade
  721. position fixed
  722. top 0
  723. left 0
  724. right 0
  725. bottom 0
  726. background rgba(0,0,0,0.55)
  727. z-index 200
  728. display flex
  729. align-items center
  730. justify-content center
  731. .result-card
  732. width 580rpx
  733. background #fff
  734. border-radius 24rpx
  735. padding 48rpx 40rpx 36rpx
  736. display flex
  737. flex-direction column
  738. align-items center
  739. .result-title
  740. font-size 32rpx
  741. font-weight 700
  742. color #222
  743. margin-bottom 20rpx
  744. .result-score
  745. font-size 72rpx
  746. font-weight 700
  747. color #1677ff
  748. line-height 1
  749. margin-bottom 16rpx
  750. .result-desc
  751. font-size 26rpx
  752. color #666
  753. text-align center
  754. margin-bottom 36rpx
  755. line-height 1.6
  756. .result-btns
  757. display flex
  758. width 100%
  759. .result-btn
  760. flex 1
  761. height 80rpx
  762. line-height 80rpx
  763. text-align center
  764. border-radius 14rpx
  765. font-size 28rpx
  766. .result-btn-outline
  767. border 1rpx solid #1677ff
  768. color #1677ff
  769. margin-right 20rpx
  770. .result-btn-primary
  771. background #1677ff
  772. color #fff
  773. .empty-tip
  774. text-align center
  775. padding 80rpx 0
  776. color #aaa
  777. font-size 26rpx
  778. </style>