ExamCard.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702
  1. <template>
  2. <el-container v-if="show">
  3. <el-header style="margin-top: 60px">
  4. <el-row>
  5. <el-col :span="18" :offset="3" style="border-bottom: 1px solid #f5f5f5">
  6. <span class="startExam">开始考试</span>
  7. <span class="examTitle">距离考试结束还有:</span>
  8. <span style="color: red;font-size: 18px;">{{ duration | timeFormat }}</span>
  9. <el-button
  10. type="warning"
  11. round
  12. style="background-color: #ffd550;float: right;color: black;font-weight: 800"
  13. @click="uploadExamToAdmin"
  14. >提交试卷
  15. </el-button>
  16. </el-col>
  17. </el-row>
  18. </el-header>
  19. <el-main>
  20. <el-row>
  21. <el-col :span="18" :offset="3">
  22. <el-col :span="16">
  23. <el-card style="min-height: 500px">
  24. <!-- 题目信息 -->
  25. <div>
  26. <span v-if="questionList[curIndex].questionType === 1">【单选题】</span>
  27. <span v-else-if="questionList[curIndex].questionType === 2">【多选题】</span>
  28. <span v-else-if="questionList[curIndex].questionType === 3">【判断题】</span>
  29. <span v-else-if="questionList[curIndex].questionType === 4">【简答题】</span>
  30. <span v-else-if="questionList[curIndex].questionType === 5">【判断题】</span>
  31. <span v-else-if="questionList[curIndex].questionType === 6">【问答题】</span>
  32. <span v-else>【理解题】</span>
  33. <br>
  34. <br>
  35. <i class="num">{{ curIndex + 1 }}</i>
  36. <span>{{ questionList[curIndex].questionContent }}:</span>
  37. </div>
  38. <!--题目中的配图-->
  39. <img
  40. v-for="url in questionList[curIndex].images"
  41. :src="url"
  42. title="点击查看大图"
  43. alt="题目图片"
  44. style="width: 100px;height: 100px;cursor: pointer"
  45. @click="showBigImg(url)"
  46. >
  47. <!-- 单选和判断的候选答案列表 -->
  48. <div
  49. v-show="questionList[curIndex].questionType === 1 || questionList[curIndex].questionType === 3"
  50. style="margin-top: 25px"
  51. >
  52. <div class="el-radio-group">
  53. <label
  54. v-for="(item,index) in questionList[curIndex].answer"
  55. :class="index === userAnswer[curIndex] ? 'active' : ''"
  56. @click="checkSingleAnswer(index)"
  57. >
  58. <span>{{ optionName[index] + '、' + item.answer }}</span>
  59. <img
  60. v-for="i2 in item.images"
  61. v-if="item.images !== null"
  62. style="position: absolute;left:100%;top:50%;transform: translateY(-50%);width: 40px;height: 40px;float: right;cursor: pointer;"
  63. title="点击查看大图"
  64. :src="i2"
  65. alt=""
  66. @mouseover="showBigImg(i2)"
  67. >
  68. </label>
  69. </div>
  70. </div>
  71. <!-- 多选和不定项选择题的候选答案列表 -->
  72. <div v-show="questionList[curIndex].questionType === 2" style="margin-top: 25px">
  73. <div class="el-radio-group">
  74. <label
  75. v-for="(item,index) in questionList[curIndex].answer"
  76. :class="(userAnswer[curIndex]+'').indexOf(index+'') !== -1? 'active' : ''"
  77. @click="selectedMultipleAnswer(index)"
  78. >
  79. <span>{{ optionName[index] + '、' + item.answer }}</span>
  80. <img
  81. v-for="i2 in item.images"
  82. v-if="item.images !== null"
  83. style="position: absolute;left:100%;top:50%;transform: translateY(-50%);
  84. width: 40px;height: 40px;float: right;cursor: pointer;"
  85. title="点击查看大图"
  86. :src="i2"
  87. alt=""
  88. @mouseover="showBigImg(i2)"
  89. >
  90. </label>
  91. </div>
  92. </div>
  93. <!-- 简答题的回答区 -->
  94. <div v-show="questionList[curIndex].questionType === 4" style="margin-top: 25px">
  95. <el-input
  96. v-model="userAnswer[curIndex]"
  97. type="textarea"
  98. :rows="8"
  99. placeholder="请输入答案"
  100. />
  101. </div>
  102. <!-- 上一题和下一题按钮 -->
  103. <div style="margin-top: 25px">
  104. <el-button type="primary" icon="el-icon-back" :disabled="curIndex<1" @click="curIndex--">上一题</el-button>
  105. <el-button
  106. type="primary"
  107. icon="el-icon-right"
  108. :disabled="curIndex>=questionList.length-1"
  109. @click="curIndex++"
  110. >下一题
  111. </el-button>
  112. </div>
  113. </el-card>
  114. </el-col>
  115. <!-- 答题卡 -->
  116. <el-col :span="7" :offset="1">
  117. <el-card>
  118. <div>
  119. <p style="font-size: 18px;">答题卡</p>
  120. <div style="margin-top: 25px">
  121. <span
  122. style="background-color: rgb(238,238,238);padding: 5px 10px 5px 10px;margin-left: 15px"
  123. >未作答</span>
  124. <span
  125. style="background-color: rgb(87,148,247);color: white;padding: 5px 10px 5px 10px;margin-left: 15px"
  126. >已作答</span>
  127. </div>
  128. </div>
  129. <!-- 单选的答题卡 -->
  130. <div style="margin-top: 25px">
  131. <p style="font-size: 18px;">单选题</p>
  132. <el-button
  133. v-for="item in questionList.length"
  134. v-show="questionList[item-1].questionType === 1"
  135. :key="item"
  136. style="margin-top: 10px;margin-left: 15px"
  137. size="mini"
  138. :class="questionList[item-1].questionType === 1 && userAnswer[item-1] !== undefined ?
  139. 'done' : userAnswer[item-1] === undefined ? curIndex === (item-1) ? 'orange' : 'noAnswer' : 'noAnswer'"
  140. @click="curIndex = item-1"
  141. >{{ item }}
  142. </el-button>
  143. </div>
  144. <!-- 多选的答题卡 -->
  145. <div style="margin-top: 25px">
  146. <p style="font-size: 18px;">多选题</p>
  147. <el-button
  148. v-for="item in questionList.length"
  149. v-show="questionList[item-1].questionType === 2"
  150. :key="item"
  151. style="margin-top: 10px;margin-left: 15px"
  152. size="mini"
  153. :class="questionList[item-1].questionType === 2 && userAnswer[item-1] !== undefined ?
  154. 'done' : userAnswer[item-1] === undefined ? curIndex === (item-1) ? 'orange' : 'noAnswer' : 'noAnswer'"
  155. @click="curIndex = item-1"
  156. >{{ item }}
  157. </el-button>
  158. </div>
  159. <!-- 判断的答题卡 -->
  160. <div style="margin-top: 25px">
  161. <p style="font-size: 18px;">判断题</p>
  162. <el-button
  163. v-for="item in questionList.length"
  164. v-show="questionList[item-1].questionType === 3"
  165. :key="item"
  166. style="margin-top: 10px;margin-left: 15px"
  167. size="mini"
  168. :class="questionList[item-1].questionType === 3 && userAnswer[item-1] !== undefined ?
  169. 'done' : userAnswer[item-1] === undefined ? curIndex === (item-1) ? 'orange' : 'noAnswer' : 'noAnswer'"
  170. @click="curIndex = item-1"
  171. >{{ item }}
  172. </el-button>
  173. </div>
  174. <!-- 简答题的答题卡 -->
  175. <div style="margin-top: 25px">
  176. <p style="font-size: 18px;">简答题</p>
  177. <el-button
  178. v-for="item in questionList.length"
  179. v-show="questionList[item-1].questionType === 4"
  180. :key="item"
  181. style="margin-top: 10px;margin-left: 15px"
  182. size="mini"
  183. :class="questionList[item-1].questionType === 4 && userAnswer[item-1] !== undefined ?
  184. 'done' : userAnswer[item-1] === undefined ? curIndex === (item-1) ? 'orange' : 'noAnswer' : 'noAnswer'"
  185. @click="curIndex = item-1"
  186. >{{ item }}
  187. </el-button>
  188. </div>
  189. </el-card>
  190. </el-col>
  191. </el-col>
  192. </el-row>
  193. <video
  194. id="video"
  195. muted="muted"
  196. style="float:right;position: fixed;top: 80%;left: 85%"
  197. width="200px"
  198. height="200px"
  199. autoplay="autoplay"
  200. />
  201. <canvas id="canvas" hidden width="200px" height="200px" />
  202. </el-main>
  203. <!--图片回显-->
  204. <el-dialog :visible.sync="bigImgDialog" @close="bigImgDialog = false">
  205. <img style="width: 100%" :src="bigImgUrl">
  206. </el-dialog>
  207. </el-container>
  208. </template>
  209. <script>
  210. import { submitExamPaper, getExamInfoById, getQuestionByIds } from '@/api/exam'
  211. export default {
  212. name: 'ExamCard',
  213. filters: {
  214. ellipsis(value) {
  215. if (!value) return ''
  216. const max = 50
  217. if (value.length > max) {
  218. return value.slice(0, max) + '...'
  219. }
  220. return value
  221. },
  222. timeFormat(time) {
  223. // 分钟
  224. var minute = time / 60
  225. var minutes = parseInt(minute)
  226. if (minutes < 10) {
  227. minutes = '0' + minutes
  228. }
  229. // 秒
  230. var second = time % 60
  231. var seconds = Math.round(second)
  232. if (seconds < 10) {
  233. seconds = '0' + seconds
  234. }
  235. return `${minutes}:${seconds}`
  236. }
  237. },
  238. data() {
  239. return {
  240. // 当前考试的信息
  241. examInfo: {},
  242. // 当前的考试题目
  243. questionList: [
  244. {
  245. questionType: ''
  246. }
  247. ],
  248. // 当前题目的索引值
  249. curIndex: 0,
  250. // 控制大图的对话框
  251. bigImgDialog: false,
  252. // 当前要展示的大图的url
  253. bigImgUrl: '',
  254. // 用户选择的答案
  255. userAnswer: [],
  256. // 页面数据加载
  257. loading: {},
  258. // 页面绘制是否开始
  259. show: false,
  260. // 答案的选项名abcd数据
  261. optionName: ['A', 'B', 'C', 'D', 'E', 'F', 'G'],
  262. // 考试总时长
  263. duration: 0,
  264. // 摄像头对象
  265. mediaStreamTrack: null,
  266. // 诚信照片的url
  267. takePhotoUrl: [],
  268. // 摄像头是否开启
  269. cameraOn: false
  270. }
  271. },
  272. watch: {
  273. // 监控考试的剩余时间
  274. async duration(newVal) {
  275. const examDuration = {
  276. duration: newVal,
  277. timestamp: Date.now()
  278. }
  279. localStorage.setItem('examDuration' + this.examInfo.examId, JSON.stringify(examDuration))
  280. // 摄像头数据
  281. const constraints = {
  282. video: {
  283. width: 200,
  284. height: 200
  285. },
  286. audio: false
  287. }
  288. // 通过调用摄像头判断用户是否中途关闭摄像头
  289. /* const promise = navigator.mediaDevices.getUserMedia(constraints)
  290. promise.catch((back) => {
  291. this.cameraOn = false
  292. })*/
  293. if (!this.cameraOn) { // 如果摄像头未开启,就再次调用开启
  294. this.getCamera()
  295. }
  296. // 考试时间结束, 自动提交试卷
  297. if (newVal < 1) {
  298. /* if (this.cameraOn) {
  299. // 结束的时候拍照上传一张
  300. await this.takePhoto()
  301. this.closeCamera()
  302. }*/
  303. this.submitUserPayload(true)
  304. }
  305. }
  306. },
  307. created() {
  308. // this.getExamInfo()
  309. // 页面数据加载的等待状态栏
  310. this.loading = this.$loading({
  311. body: true,
  312. lock: true,
  313. text: '数据拼命加载中,(*╹▽╹*)',
  314. spinner: 'el-icon-loading'
  315. })
  316. // 开启摄像头
  317. window.onload = () => {
  318. setTimeout(() => {
  319. this.getCamera()
  320. }, 1000)
  321. // 生成3次时间点截图
  322. const times = []
  323. for (let i = 0; i < 2; i++) {
  324. times.push(Math.ceil(Math.random() * this.duration * 1000))
  325. }
  326. times.push(10000)
  327. // 一次考试最多3次随机的诚信截图
  328. times.forEach(item => {
  329. window.setTimeout(() => {
  330. this.takePhoto()
  331. }, item)
  332. })
  333. }
  334. },
  335. mounted() {
  336. // 关闭浏览器窗口的时候移除 localstorage的时长
  337. var userAgent = navigator.userAgent // 取得浏览器的userAgent字符串
  338. var isOpera = userAgent.indexOf('Opera') > -1 // 判断是否Opera浏览器
  339. var isIE = userAgent.indexOf('compatible') > -1 && userAgent.indexOf('MSIE') > -1 && !isOpera // 判断是否IE浏览器
  340. var isIE11 = userAgent.indexOf('rv:11.0') > -1 // 判断是否是IE11浏览器
  341. var isEdge = userAgent.indexOf('Edge') > -1 && !isIE // 判断是否IE的Edge浏览器
  342. if (!isIE && !isEdge && !isIE11) { // 兼容chrome和firefox
  343. var _beforeUnload_time = 0; var _gap_time = 0
  344. var is_fireFox = navigator.userAgent.indexOf('Firefox') > -1// 是否是火狐浏览器
  345. window.onunload = function() {
  346. _gap_time = new Date().getTime() - _beforeUnload_time
  347. if (_gap_time <= 5) {
  348. localStorage.removeItem('examDuration' + this.examInfo.examId)
  349. } else { // 谷歌浏览器刷新
  350. }
  351. }
  352. window.onbeforeunload = function() {
  353. _beforeUnload_time = new Date().getTime()
  354. if (is_fireFox) { // 火狐关闭执行
  355. } else { // 火狐浏览器刷新
  356. }
  357. }
  358. }
  359. },
  360. methods: {
  361. // 查询当前考试的信息
  362. getExamInfo() {
  363. const examId = this.$route.params
  364. getExamInfoById(examId).then((resp) => {
  365. if (resp.code === 0) {
  366. this.examInfo = resp.data
  367. // 设置定时(秒)
  368. try {
  369. const examDuration = JSON.parse(localStorage.getItem('examDuration' + this.examInfo.examId) || '{}')
  370. if (examDuration.duration === 0 || Date.now() >= (examDuration.timestamp ||
  371. Date.now()) + (examDuration.duration * 1000 || Date.now())) {
  372. localStorage.removeItem('examDuration' + this.examInfo.examId)
  373. }
  374. this.duration = Math.min(JSON.parse(
  375. localStorage.getItem('examDuration' + this.examInfo.examId) || '{}').duration ||
  376. this.examInfo.examDuration * 60, this.examInfo.examDuration * 60)
  377. } catch (e) {
  378. localStorage.removeItem('examDuration' + this.examInfo.examId)
  379. }
  380. // 考试剩余时间定时器
  381. this.timer = window.setInterval(() => {
  382. if (this.duration > 0) this.duration--
  383. }, 1000)
  384. const questionIds = this.examInfo.questionIds.split(',')
  385. this.getQuestionInfo(questionIds)
  386. }
  387. })
  388. },
  389. // 查询考试的题目信息
  390. async getQuestionInfo(ids) {
  391. await getQuestionByIds({ 'ids': ids.join(',') }).then(resp => {
  392. if (resp.code === 0) {
  393. this.questionList = resp.data || []
  394. // 重置问题的顺序 单选 多选 判断 简答
  395. this.questionList = this.questionList.sort(function(a, b) {
  396. return a.questionType - b.questionType
  397. })
  398. }
  399. })
  400. this.loading.close()
  401. this.show = true
  402. },
  403. // 点击展示高清大图
  404. showBigImg(url) {
  405. console.log('show big')
  406. console.log(url)
  407. this.bigImgUrl = url
  408. this.bigImgDialog = true
  409. },
  410. // 检验单选题的用户选择的答案
  411. checkSingleAnswer(index) {
  412. this.$set(this.userAnswer, this.curIndex, index)
  413. },
  414. // 多选题用户的答案选中
  415. selectedMultipleAnswer(index) {
  416. if (this.userAnswer[this.curIndex] === undefined) { // 当前是多选的第一个答案
  417. this.$set(this.userAnswer, this.curIndex, index)
  418. } else if (String(this.userAnswer[this.curIndex]).split(',').includes(index + '')) { // 取消选中
  419. const newArr = []
  420. String(this.userAnswer[this.curIndex]).split(',').forEach(item => {
  421. if (item !== '' + index) newArr.push(item)
  422. })
  423. if (newArr.length === 0) {
  424. this.$set(this.userAnswer, this.curIndex, undefined)
  425. } else {
  426. this.$set(this.userAnswer, this.curIndex, newArr.join(','))
  427. // 答案格式化顺序DBAC -> ABCD
  428. this.userAnswer[this.curIndex] = String(this.userAnswer[this.curIndex]).split(',').sort(function(a, b) {
  429. return a - b
  430. }).join(',')
  431. }
  432. } else if (!((this.userAnswer[this.curIndex] + '').split(',').includes(index + ''))) { // 第n个答案
  433. this.$set(this.userAnswer, this.curIndex, this.userAnswer[this.curIndex] += ',' + index)
  434. // 答案格式化顺序DBAC -> ABCD
  435. this.userAnswer[this.curIndex] = String(this.userAnswer[this.curIndex]).split(',').sort(function(a, b) {
  436. return a - b
  437. }).join(',')
  438. }
  439. },
  440. // 调用摄像头
  441. getCamera() {
  442. const constraints = {
  443. video: {
  444. width: 200,
  445. height: 200
  446. },
  447. audio: false
  448. }
  449. // 获得video摄像头
  450. const video = document.getElementById('video')
  451. /* const promise = navigator.mediaDevices.getUserMedia(constraints)
  452. promise.then((mediaStream) => {
  453. this.mediaStreamTrack = typeof mediaStream.stop === 'function' ? mediaStream : mediaStream.getTracks()[1]
  454. video.srcObject = mediaStream
  455. video.play()
  456. this.cameraOn = true
  457. }).catch((back) => {
  458. this.$message({
  459. duration: 1500,
  460. message: '请开启摄像头权限o(╥﹏╥)o!',
  461. type: 'error'
  462. })
  463. })*/
  464. },
  465. // 拍照
  466. async takePhoto() {
  467. if (this.cameraOn) { // 摄像头是否开启 开启了才执行上传信用图片
  468. // 获得Canvas对象
  469. const video = document.getElementById('video')
  470. const canvas = document.getElementById('canvas')
  471. const ctx = canvas.getContext('2d')
  472. ctx.drawImage(video, 0, 0, 200, 200)
  473. // toDataURL --- 可传入'image/png'---默认, 'image/jpeg'
  474. const img = document.getElementById('canvas').toDataURL()
  475. // 构造post的form表单
  476. const formData = new FormData()
  477. // convertBase64UrlToBlob函数是将base64编码转换为Blob
  478. formData.append('file', this.base64ToFile(img, 'examTakePhoto.png'))
  479. // 上传阿里云OSS
  480. /* await ossUtils.uploadImage(formData).then((resp) => {
  481. if (resp.code === 0) this.takePhotoUrl.push(resp.data)
  482. })*/
  483. }
  484. },
  485. // 关闭摄像头
  486. closeCamera() {
  487. const stream = document.getElementById('video').srcObject
  488. const tracks = stream.getTracks()
  489. tracks.forEach(function(track) {
  490. track.stop()
  491. })
  492. document.getElementById('video').srcObject = null
  493. },
  494. // 将摄像头截图的base64串转化为file提交后台
  495. base64ToFile(urlData, fileName) {
  496. const arr = urlData.split(',')
  497. const mime = arr[0].match(/:(.*?);/)[1]
  498. const bytes = atob(arr[1]) // 解码base64
  499. let n = bytes.length
  500. const ia = new Uint8Array(n)
  501. while (n--) {
  502. ia[n] = bytes.charCodeAt(n)
  503. }
  504. return new File([ia], fileName, { type: mime })
  505. },
  506. // 上传用户考试信息进入后台
  507. async uploadExamToAdmin() {
  508. if (this.cameraOn) await this.takePhoto()// 结束的时候拍照上传一张
  509. // 正则
  510. var reg = new RegExp('-', 'g')
  511. // 去掉用户输入的非法分割符号(-),保证后端接受数据处理不报错
  512. this.userAnswer.forEach((item, index) => {
  513. if (this.questionList[index].questionType === 4) { // 简答题答案处理
  514. this.userAnswer[index] = item.replace(reg, ' ')
  515. }
  516. })
  517. // 标记题目是否全部做完
  518. let flag = true
  519. for (let i = 0; i < this.userAnswer.length; i++) { // 检测用户是否题目全部做完
  520. if (this.userAnswer[i] === undefined) {
  521. flag = false
  522. }
  523. }
  524. // 如果用户所有答案的数组长度小于题目长度,这个时候也要将标志位置为false
  525. if (this.userAnswer.length < this.questionList.length) {
  526. flag = false
  527. }
  528. // 题目未做完
  529. if (!flag) {
  530. this.$confirm('当前试题暂未做完, 是否继续提交o(╥﹏╥)o ?', 'Tips', {
  531. confirmButtonText: '确定',
  532. cancelButtonText: '取消',
  533. type: 'warning'
  534. }).then(() => {
  535. this.submitUserPayload(false)
  536. }).catch(() => {
  537. this.$notify({
  538. title: 'Tips',
  539. message: '继续加油! *^▽^*',
  540. type: 'success',
  541. duration: 2000
  542. })
  543. })
  544. } else { // 当前题目做完了
  545. if (this.cameraOn) {
  546. // 结束的时候拍照上传一张
  547. await this.takePhoto()
  548. this.closeCamera()
  549. }
  550. this.submitUserPayload(false)
  551. }
  552. },
  553. submitUserPayload(autoSubmit) {
  554. var msg = '考试结束了捏 *^▽^*'
  555. if (autoSubmit) {
  556. msg = '考试时间结束,已为您自动提交 *^▽^*'
  557. }
  558. const userPayload = {}
  559. userPayload.questionIds = []
  560. userPayload.userAnswers = this.userAnswer.join('-')
  561. this.questionList.forEach((item, index) => {
  562. userPayload.questionIds.push(item.questionId)
  563. // 当前数据不完整,用户回答不完整(我们自动补充空答案,防止业务出错)
  564. if (index > this.userAnswer.length) {
  565. userPayload.userAnswers += ' -'
  566. }
  567. })
  568. // 如果所有题目全部未答
  569. if (userPayload.userAnswers === '') {
  570. this.questionList.forEach(item => {
  571. userPayload.userAnswers += ' -'
  572. })
  573. userPayload.userAnswers.split(0, userPayload.userAnswers.length - 1)
  574. }
  575. userPayload.examId = parseInt(this.$route.params.examId)
  576. userPayload.questionIds = userPayload.questionIds.join(',')
  577. userPayload.creditImgUrl = this.takePhotoUrl.join(',')
  578. submitExamPaper(userPayload).then((resp) => {
  579. if (resp.code === 0) {
  580. this.$notify({
  581. title: 'Tips',
  582. message: msg,
  583. type: 'success',
  584. duration: 2000
  585. })
  586. this.$router.push('/exam/result/' + resp.data)
  587. }
  588. })
  589. }
  590. }
  591. }
  592. </script>
  593. <style lang="scss" scoped>
  594. * {
  595. font-weight: 800;
  596. }
  597. .el-container {
  598. width: 100%;
  599. height: 100%;
  600. }
  601. .startExam {
  602. color: #160f58;
  603. border-bottom: 4px solid #ffd550;
  604. font-size: 18px;
  605. font-weight: 700;
  606. padding-bottom: 10px
  607. }
  608. .examTitle {
  609. font-size: 18px;
  610. color: #cbcacf;
  611. margin-left: 20px;
  612. font-weight: 700;
  613. }
  614. .el-radio-group label {
  615. display: block;
  616. width: 400px;
  617. padding: 48px 20px 10px 20px;
  618. border-radius: 4px;
  619. border: 1px solid #dcdfe6;
  620. margin-bottom: 10px;
  621. cursor: pointer;
  622. position: relative;
  623. span {
  624. position: absolute;
  625. top: 50%;
  626. transform: translateY(-50%);
  627. font-size: 16px;
  628. }
  629. }
  630. .el-radio-group label:hover {
  631. background-color: rgb(245, 247, 250);
  632. }
  633. /*当前选中的答案*/
  634. .active {
  635. border: 1px solid #1f90ff !important;
  636. opacity: .5;
  637. }
  638. /*做过的题目的高亮颜色*/
  639. .done {
  640. background-color: rgb(87, 148, 247);
  641. }
  642. /*未做题目的高亮颜色*/
  643. .noAnswer {
  644. background-color: rgb(238, 238, 238);
  645. }
  646. /*当前在做的题目高亮的颜色*/
  647. .orange {
  648. background-color: rgb(255, 213, 80);
  649. }
  650. .num {
  651. display: inline-block;
  652. background: url('../../assets/img/examTitle.png') no-repeat 95%;
  653. background-size: contain;
  654. height: 37px;
  655. width: 37px;
  656. line-height: 30px;
  657. color: #fff;
  658. font-size: 20px;
  659. text-align: center;
  660. margin-right: 15px;
  661. }
  662. </style>