CheckComputer.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841
  1. <template>
  2. <div style="max-width: 800px; margin: 30px auto; ">
  3. <Steps :current="current" size="small">
  4. <Step title="时钟"></Step>
  5. <Step title="网速"></Step>
  6. <Step title="摄像头"></Step>
  7. <Step title="声音"></Step>
  8. <Step title="微信小程序"></Step>
  9. <Step title="检测结果"></Step>
  10. </Steps>
  11. <div v-if="current === 0" class="section">
  12. <div class="list">
  13. <table>
  14. <tbody class="list-row">
  15. <tr class="list-header qm-primary-strong-text">
  16. <td class="first-td">检查项</td>
  17. <td>值</td>
  18. <td>状态</td>
  19. </tr>
  20. <tr>
  21. <td>电脑当前下载速度</td>
  22. <td>{{ network.downlink }}Mb</td>
  23. <td>
  24. <div v-if="network.downlinkStatus">
  25. <Icon class="pass-check" type="md-checkmark" />
  26. </div>
  27. <div v-else>
  28. <Icon
  29. class="fail-cross"
  30. title="下载速度不佳"
  31. type="md-close"
  32. />
  33. </div>
  34. </td>
  35. </tr>
  36. <tr>
  37. <td>电脑当前网络延迟</td>
  38. <td>{{ network.rrt }}毫秒</td>
  39. <td>
  40. <div v-if="network.rrtStatus">
  41. <Icon class="pass-check" type="md-checkmark" />
  42. </div>
  43. <div v-else>
  44. <Icon
  45. class="fail-cross"
  46. title="网络延迟较大"
  47. type="md-close"
  48. />
  49. </div>
  50. </td>
  51. </tr>
  52. </tbody>
  53. </table>
  54. </div>
  55. </div>
  56. <div v-if="current === 1" class="section">
  57. <div class="list">
  58. <table>
  59. <tbody class="list-row">
  60. <tr class="list-header qm-primary-strong-text">
  61. <td class="first-td">检查项</td>
  62. <td>值</td>
  63. <td>状态</td>
  64. </tr>
  65. <!-- <tr>
  66. <td>电脑当前时间</td>
  67. <td>{{ timeCurrent }} (北京时间)</td>
  68. <td></td>
  69. </tr> -->
  70. <!-- <tr>
  71. <td>电脑是否时间准确</td>
  72. <td>{{ timeDifference }}</td>
  73. </tr> -->
  74. <tr>
  75. <td>电脑时区</td>
  76. <td>{{ time.currentTimeZone }}</td>
  77. <td>
  78. <div v-if="time.timeZoneStatus">
  79. <Icon class="pass-check" type="md-checkmark" />
  80. </div>
  81. <div v-else>
  82. <Icon
  83. class="fail-cross"
  84. title="请将电脑设置为北京时区"
  85. type="md-close"
  86. />
  87. </div>
  88. </td>
  89. </tr>
  90. <tr>
  91. <td>电脑时钟频率</td>
  92. <td>
  93. <div v-if="time.clockRateStateResolved">
  94. {{ time.clockRateDiff > 3 ? "时钟过慢" : "正常" }}
  95. </div>
  96. <div v-else>
  97. <PulseLoader />
  98. </div>
  99. </td>
  100. <td>
  101. <div v-if="time.clockRateStateResolved">
  102. <Icon
  103. class="pass-check"
  104. v-if="time.clockRateStatus"
  105. type="md-checkmark"
  106. />
  107. <Icon
  108. class="fail-cross"
  109. v-else
  110. title="请更换电脑"
  111. type="md-close"
  112. />
  113. </div>
  114. <div v-else>
  115. <PulseLoader />
  116. </div>
  117. </td>
  118. </tr>
  119. </tbody>
  120. </table>
  121. </div>
  122. </div>
  123. <div v-show="current === 2" class="section">
  124. <div>
  125. <div style="display: flex; justify-content: center;">
  126. <video
  127. id="video"
  128. ref="video"
  129. width="400"
  130. height="300"
  131. autoplay
  132. ></video>
  133. <!-- <div style="margin-left: 50px; margin-top: 100px;">
  134. <Button type="warning" @click="camera = '没有摄像头'">
  135. 摄像头没有启用
  136. </Button>
  137. <div style="width: 30px; height: 30px;"></div>
  138. <Button type="primary" @click="camera = 'OK'">
  139. 摄像头正常工作
  140. </Button>
  141. </div> -->
  142. </div>
  143. </div>
  144. <div class="list">
  145. <table>
  146. <tbody class="list-row">
  147. <tr class="list-header qm-primary-strong-text">
  148. <td class="first-td">检查项</td>
  149. <td>值</td>
  150. <td>状态</td>
  151. </tr>
  152. <tr>
  153. <td>摄像头正常启用</td>
  154. <td>{{ camera ? "正常" : "请检查摄像头" }}</td>
  155. <td>
  156. <div v-if="camera">
  157. <Icon class="pass-check" type="md-checkmark" />
  158. </div>
  159. <div v-else>
  160. <Icon
  161. class="fail-cross"
  162. title="请检查摄像头"
  163. type="md-close"
  164. />
  165. </div>
  166. </td>
  167. </tr>
  168. </tbody>
  169. </table>
  170. </div>
  171. </div>
  172. <div v-show="current === 3" class="section" style="text-align: center">
  173. <div>
  174. <div style="display: flex; margin-bottom: 30px;">
  175. <audio
  176. src="https://ecs-static.qmth.com.cn/check-audio.mp3"
  177. controls
  178. nodownload
  179. @loadeddata="
  180. sound.downloadResolved = true;
  181. sound.downloadStatus = true;
  182. "
  183. @error="
  184. sound.downloadResolved = true;
  185. sound.downloadStatus = false;
  186. "
  187. />
  188. <div style="margin-left: 30px; display: flex; ">
  189. <Button
  190. type="warning"
  191. @click="
  192. sound.playedStatusResolved = true;
  193. sound.playedStatus = false;
  194. "
  195. title="或者听不到声音"
  196. >
  197. 不能播放声音
  198. </Button>
  199. <div style="width: 30px; height: 30px;"></div>
  200. <Button
  201. type="primary"
  202. @click="
  203. sound.playedStatusResolved = true;
  204. sound.playedStatus = true;
  205. "
  206. >
  207. 能够播放声音
  208. </Button>
  209. </div>
  210. </div>
  211. </div>
  212. <div class="list">
  213. <table>
  214. <tbody class="list-row">
  215. <tr class="list-header qm-primary-strong-text">
  216. <td class="first-td">检查项</td>
  217. <td>值</td>
  218. <td>状态</td>
  219. </tr>
  220. <tr>
  221. <td>文件下载</td>
  222. <td>
  223. <div v-if="sound.downloadResolved">
  224. {{ sound.downloadStatus ? "正常" : "出错" }}
  225. </div>
  226. <div v-else>
  227. <PulseLoader />
  228. </div>
  229. </td>
  230. <td>
  231. <div v-if="sound.downloadResolved">
  232. <div v-if="sound.downloadStatus">
  233. <Icon class="pass-check" type="md-checkmark" />
  234. </div>
  235. <div v-else>
  236. <Icon class="fail-cross" title="下载出错" type="md-close" />
  237. </div>
  238. </div>
  239. <div v-else>
  240. <PulseLoader />
  241. </div>
  242. </td>
  243. </tr>
  244. <tr>
  245. <td>声音播放</td>
  246. <td>
  247. <div v-if="sound.playedStatusResolved">
  248. {{ sound.playedStatus ? "正常" : "出错" }}
  249. </div>
  250. <div v-else>
  251. <PulseLoader />
  252. </div>
  253. </td>
  254. <td>
  255. <div v-if="sound.playedStatusResolved">
  256. <div v-if="sound.playedStatus">
  257. <Icon class="pass-check" type="md-checkmark" />
  258. </div>
  259. <div v-else>
  260. <Icon
  261. class="fail-cross"
  262. title="不能播放声音"
  263. type="md-close"
  264. />
  265. </div>
  266. </div>
  267. <div v-else>
  268. <PulseLoader />
  269. </div>
  270. </td>
  271. </tr>
  272. </tbody>
  273. </table>
  274. </div>
  275. </div>
  276. <div v-show="current === 4" class="section">
  277. <div>
  278. <div style="display: flex;">
  279. <div>
  280. <div v-if="wechat.qrValue" style="display: flex">
  281. <qrcode
  282. :value="wechat.qrValue"
  283. :options="{ width: 200 }"
  284. style="margin-left: -10px;"
  285. ></qrcode>
  286. <div style="margin-top: 10px;">
  287. <div style="font-size: 30px;">
  288. 请使用<span style="font-weight: 900; color: #1E90FF;"
  289. >微信</span
  290. >扫描二维码后,在微信小程序上录音,并上传文件。
  291. </div>
  292. <div
  293. v-if="wechat.qrScanned"
  294. style="margin-top: 30px; font-size: 30px;"
  295. >
  296. {{ this.wechat.studentAnswer ? "已上传" : "已扫描" }}
  297. <Icon type="md-checkmark" />
  298. </div>
  299. </div>
  300. </div>
  301. <div v-else>正在获取二维码...</div>
  302. </div>
  303. </div>
  304. <div
  305. class="audio-answer audio-answer-line-height"
  306. style="margin-top: 20px; text-align: left;"
  307. >
  308. <span class="audio-answer-line-height">上传文件:</span>
  309. <audio
  310. class="audio-answer-line-height"
  311. v-if="this.wechat.studentAnswer"
  312. controls
  313. controlsList="nodownload"
  314. :src="this.wechat.studentAnswer"
  315. />
  316. <span v-else class="audio-answer-line-height">未上传文件</span>
  317. </div>
  318. <div style=" margin-top: 30px; display: flex; margin-bottom: 30px;">
  319. <Button
  320. type="warning"
  321. @click="
  322. wechat.qrScannedResolved = true;
  323. wechat.qrScanned = false;
  324. "
  325. title="扫码不成功"
  326. >
  327. 不能正确扫描二维码
  328. </Button>
  329. <div style="width: 30px; height: 30px;"></div>
  330. <Button
  331. type="warning"
  332. @click="
  333. wechat.uploadResolved = true;
  334. wechat.uploadStatus = false;
  335. "
  336. title="上传不成功"
  337. >
  338. 上传不成功
  339. </Button>
  340. </div>
  341. </div>
  342. <div class="list">
  343. <table>
  344. <tbody class="list-row">
  345. <tr class="list-header qm-primary-strong-text">
  346. <td class="first-td">检查项</td>
  347. <td>值</td>
  348. <td>状态</td>
  349. </tr>
  350. <tr>
  351. <td>扫描二维码</td>
  352. <td>
  353. <div v-if="wechat.qrScannedResolved">
  354. {{ wechat.qrScanned ? "正常" : "出错" }}
  355. </div>
  356. <div v-else>
  357. <PulseLoader />
  358. </div>
  359. </td>
  360. <td>
  361. <div v-if="wechat.qrScannedResolved">
  362. <div v-if="wechat.qrScanned">
  363. <Icon class="pass-check" type="md-checkmark" />
  364. </div>
  365. <div v-else>
  366. <Icon class="fail-cross" title="扫描出错" type="md-close" />
  367. </div>
  368. </div>
  369. <div v-else>
  370. <PulseLoader />
  371. </div>
  372. </td>
  373. </tr>
  374. <tr>
  375. <td>上传录音</td>
  376. <td>
  377. <div v-if="wechat.uploadResolved">
  378. {{ wechat.uploadStatus ? "正常" : "出错" }}
  379. </div>
  380. <div v-else>
  381. <PulseLoader />
  382. </div>
  383. </td>
  384. <td>
  385. <div v-if="wechat.uploadResolved">
  386. <div v-if="wechat.uploadStatus">
  387. <Icon class="pass-check" type="md-checkmark" />
  388. </div>
  389. <div v-else>
  390. <Icon class="fail-cross" type="md-close" />
  391. </div>
  392. </div>
  393. <div v-else>
  394. <PulseLoader />
  395. </div>
  396. </td>
  397. </tr>
  398. </tbody>
  399. </table>
  400. </div>
  401. </div>
  402. <div v-show="current === 5" class="section">
  403. <div class="list">
  404. <table>
  405. <tbody class="list-row">
  406. <tr class="list-header qm-primary-strong-text">
  407. <td class="first-td">检查项</td>
  408. <td>结果</td>
  409. </tr>
  410. <tr>
  411. <td>网速</td>
  412. <td>
  413. <div v-if="step1Status">
  414. <Icon class="pass-check" type="md-checkmark" />
  415. </div>
  416. <div v-else>
  417. <Icon class="fail-cross" type="md-close" />
  418. </div>
  419. </td>
  420. </tr>
  421. <tr>
  422. <td>时钟</td>
  423. <td>
  424. <div v-if="step2StatusResolved">
  425. <div v-if="step2Status">
  426. <Icon class="pass-check" type="md-checkmark" />
  427. </div>
  428. <div v-else>
  429. <Icon class="fail-cross" type="md-close" />
  430. </div>
  431. </div>
  432. <div v-else>
  433. <PulseLoader />
  434. </div>
  435. </td>
  436. </tr>
  437. <tr>
  438. <td>摄像头</td>
  439. <td>
  440. <div v-if="step3Status">
  441. <Icon class="pass-check" type="md-checkmark" />
  442. </div>
  443. <div v-else>
  444. <Icon class="fail-cross" type="md-close" />
  445. </div>
  446. </td>
  447. </tr>
  448. <tr>
  449. <td>声音</td>
  450. <td>
  451. <div v-if="step4StatusResolved">
  452. <div v-if="step4Status">
  453. <Icon class="pass-check" type="md-checkmark" />
  454. </div>
  455. <div v-else>
  456. <Icon class="fail-cross" type="md-close" />
  457. </div>
  458. </div>
  459. <div v-else class="fail-cross">
  460. 请在“声音”步骤进行人工确认!
  461. </div>
  462. </td>
  463. </tr>
  464. <tr>
  465. <td>微信小程序</td>
  466. <td>
  467. <div v-if="step5StatusResolved">
  468. <div v-if="step5Status">
  469. <Icon class="pass-check" type="md-checkmark" />
  470. </div>
  471. <div v-else>
  472. <Icon class="fail-cross" type="md-close" />
  473. </div>
  474. </div>
  475. <div v-else class="fail-cross">
  476. 请在“微信小程序”步骤进行人工确认!
  477. </div>
  478. </td>
  479. </tr>
  480. </tbody>
  481. </table>
  482. </div>
  483. </div>
  484. <div style="margin-top: 30px; text-align: center;">
  485. <Button type="primary" @click="previous" :disabled="current === 0">
  486. 上一步
  487. </Button>
  488. <div style="width: 30px; height: 1px; display: inline-block;"></div>
  489. <Button type="primary" @click="next" :disabled="current === 5">
  490. 下一步
  491. </Button>
  492. <div style="width: 30px; height: 1px; display: inline-block;"></div>
  493. <Button
  494. type="primary"
  495. @click="() => this.$emit('on-close')"
  496. v-if="current === 5"
  497. >
  498. 进入考试
  499. </Button>
  500. </div>
  501. </div>
  502. </template>
  503. <script>
  504. import moment from "moment";
  505. // import "moment-duration-format";
  506. import VueQrcode from "@chenfengyuan/vue-qrcode";
  507. import PulseLoader from "vue-spinner/src/PulseLoader.vue";
  508. import {
  509. openWS,
  510. closeWsWithoutReconnect,
  511. getQRCode,
  512. } from "@/features/OnlineExam/Examing/ws";
  513. import { createNamespacedHelpers } from "vuex";
  514. const { mapState } = createNamespacedHelpers("examingHomeModule");
  515. const CLOCK_RATE_TIMEOUT = 10;
  516. // console.log(
  517. // moment.duration(-new Date().getTimezoneOffset(), "minutes").format("hh:mm")
  518. // );
  519. export default {
  520. name: "check-computer",
  521. data() {
  522. return {
  523. current: 0,
  524. // status: ["process", "wait", "wait", "wait", "wait"],
  525. network: {
  526. downlink: navigator.connection.downlink,
  527. downlinkStatus: navigator.connection.downlink > 0.5,
  528. rrt: navigator.connection.rtt,
  529. rrtStatus: navigator.connection.rtt < 1000,
  530. },
  531. time: {
  532. // nowDate: Date.now(),
  533. // timeDifference: 0,
  534. currentTimeZone: moment().format("Z"),
  535. timeZoneStatus: new Date().getTimezoneOffset() / 60 === -8,
  536. clockRateDiff: null,
  537. clockRateStateResolved: false,
  538. clockRateStatus: false,
  539. },
  540. camera: false,
  541. sound: {
  542. downloadResolved: false,
  543. downloadStatus: false,
  544. playedStatusResolved: false,
  545. playedStatus: false,
  546. },
  547. wechat: {
  548. qrValue: " ",
  549. qrScannedResolved: false,
  550. qrScanned: false,
  551. uploadResolved: false,
  552. uploadStatus: false,
  553. studentAnswer: null,
  554. examRecordDataId: null,
  555. },
  556. };
  557. },
  558. async created() {
  559. this.getNowInterval = setInterval(() => {
  560. this.nowDate = Date.now();
  561. }, 1000);
  562. openWS({ examRecordDataId: this.$store.state.user.id });
  563. if (!getQRCode(1, "AUDIO", { testEnv: true })) {
  564. setTimeout(() => {
  565. getQRCode(1, "AUDIO", { testEnv: true });
  566. }, 3000);
  567. }
  568. },
  569. async mounted() {
  570. let start, end;
  571. // const networkStart = performance.now();
  572. fetch("/oe/login", { Method: "HEAD" }).then(e => {
  573. start = moment(e.headers.get("date"));
  574. // const networkEnd = performance.now();
  575. // this.timeDifference =
  576. // Math.abs(moment().diff(start) - (networkEnd - networkStart) / 2) <
  577. // 60 * 1000
  578. // ? "OK"
  579. // : "与服务器时间差异超过60秒";
  580. });
  581. this.checkClockRateTimeout = setTimeout(() => {
  582. fetch("/oe/login", { Method: "HEAD" }).then(e => {
  583. end = moment(e.headers.get("date"));
  584. this.time.clockRateStateResolved = true;
  585. this.time.clockRateDiff =
  586. end.diff(start, "seconds") - CLOCK_RATE_TIMEOUT;
  587. this.time.clockRateStatus =
  588. end.diff(start, "seconds") < CLOCK_RATE_TIMEOUT + 2;
  589. });
  590. }, CLOCK_RATE_TIMEOUT * 1000);
  591. await this.openCamera();
  592. },
  593. beforeDestroy() {
  594. if (this.$refs.video.srcObject) {
  595. this.$refs.video.srcObject.getTracks().forEach(function(track) {
  596. track.stop();
  597. });
  598. }
  599. clearInterval(this.getNowInterval);
  600. clearTimeout(this.checkClockRateTimeout);
  601. closeWsWithoutReconnect();
  602. },
  603. methods: {
  604. previous() {
  605. if (this.current >= 0) {
  606. this.current -= 1;
  607. }
  608. },
  609. next() {
  610. if (this.current < 5) {
  611. this.current += 1;
  612. }
  613. },
  614. async openCamera() {
  615. const video = this.$refs.video;
  616. if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
  617. try {
  618. console.log("启动摄像头");
  619. const stream = await navigator.mediaDevices.getUserMedia({
  620. video: {
  621. facingMode: "user",
  622. // width: 400,
  623. // height: this.showRecognizeButton ? 300 : 250
  624. },
  625. });
  626. if (stream) {
  627. video.srcObject = stream;
  628. try {
  629. await video.play();
  630. this.camera = true;
  631. } catch (error) {
  632. console.log("摄像头没有正常启用", error);
  633. this.$Message.error({
  634. content: "摄像头没有正常启用",
  635. duration: 15,
  636. closable: true,
  637. });
  638. }
  639. } else {
  640. this.$Message.error({
  641. content: "没有可用的视频流",
  642. duration: 15,
  643. closable: true,
  644. });
  645. window._hmt.push([
  646. "_trackEvent",
  647. "摄像头框-环境检测",
  648. "摄像头状态",
  649. "没有可用的视频流",
  650. ]);
  651. }
  652. } catch (error) {
  653. console.log("无法启用摄像头", error);
  654. this.$Message.error({
  655. content: "无法启用摄像头",
  656. duration: 15,
  657. closable: true,
  658. });
  659. window._hmt.push([
  660. "_trackEvent",
  661. "摄像头框-环境检测",
  662. "摄像头状态",
  663. "无法启用摄像头",
  664. ]);
  665. }
  666. } else {
  667. this.$Message.error({
  668. content: "没有找到可用的摄像头",
  669. duration: 15,
  670. closable: true,
  671. });
  672. window._hmt.push([
  673. "_trackEvent",
  674. "摄像头框-环境检测",
  675. "摄像头状态",
  676. "没有找到可用的摄像头",
  677. ]);
  678. }
  679. },
  680. },
  681. computed: {
  682. ...mapState([
  683. "questionQrCode",
  684. "questionQrCodeScanned",
  685. "questionAnswerFileUrl",
  686. ]),
  687. timeCurrent() {
  688. return moment(this.nowDate)
  689. .utcOffset("+08:00")
  690. .format("YYYY-MM-DD HH:mm:ssZZ");
  691. },
  692. step1Status() {
  693. return this.network.downlinkStatus && this.network.rrtStatus;
  694. },
  695. step2StatusResolved() {
  696. return this.time.clockRateStateResolved;
  697. },
  698. step2Status() {
  699. return this.time.timeZoneStatus && this.time.clockRateStatus;
  700. },
  701. step3Status() {
  702. return this.camera;
  703. },
  704. step4StatusResolved() {
  705. return this.sound.downloadResolved && this.sound.playedStatusResolved;
  706. },
  707. step4Status() {
  708. return this.sound.downloadStatus && this.sound.playedStatus;
  709. },
  710. step5StatusResolved() {
  711. return this.wechat.qrScannedResolved && this.wechat.uploadResolved;
  712. },
  713. step5Status() {
  714. return this.wechat.qrScanned && this.wechat.uploadStatus;
  715. },
  716. },
  717. watch: {
  718. questionQrCode(value) {
  719. // console.log(this.examQuestion.studentAnswer);
  720. // console.log("watch", value);
  721. this.wechat.qrValue = value.qrCode;
  722. this.wechat.examRecordDataId = decodeURIComponent(value.qrCode).match(
  723. /&examRecordDataId=(\d+)&/
  724. )[1];
  725. },
  726. questionQrCodeScanned() {
  727. // console.log(this.examQuestion.studentAnswer);
  728. // console.log("watch", value);
  729. this.wechat.qrScanned = true;
  730. this.wechat.qrScannedResolved = true;
  731. },
  732. questionAnswerFileUrl(value) {
  733. // console.log(this.examQuestion.studentAnswer);
  734. // console.log("watch", value);
  735. const examRecordDataId = this.wechat.examRecordDataId;
  736. for (const q of value) {
  737. if (!q.saved) {
  738. let acknowledgeStatus = "CONFIRMED";
  739. this.$http
  740. .post(
  741. "/api/ecs_oe_student/examControl/saveUploadedFileAcknowledgeStatus",
  742. {
  743. examRecordDataId,
  744. filePath: q.fileUrl,
  745. order: q.order,
  746. acknowledgeStatus,
  747. }
  748. )
  749. .then(() => {
  750. this.wechat.studentAnswer = q.fileUrl;
  751. this.wechat.uploadResolved = true;
  752. this.wechat.uploadStatus = true;
  753. q.saved = true;
  754. if (acknowledgeStatus === "CONFIRMED")
  755. this.$Message.info({
  756. content: "小程序作答已更新",
  757. duration: 5,
  758. closable: true,
  759. });
  760. })
  761. .catch(() => {
  762. this.$Message.error({
  763. content: "更新小程序答案失败!",
  764. duration: 15,
  765. closable: true,
  766. });
  767. });
  768. }
  769. }
  770. },
  771. },
  772. components: {
  773. qrcode: VueQrcode,
  774. PulseLoader,
  775. },
  776. };
  777. </script>
  778. <style scoped>
  779. .section {
  780. margin-top: 10px;
  781. }
  782. .list {
  783. border: 1px solid #eeeeee;
  784. border-radius: 6px;
  785. text-align: center;
  786. }
  787. .list table {
  788. width: 100%;
  789. border-collapse: collapse !important;
  790. border-spacing: 0;
  791. }
  792. .list td {
  793. border: 1px solid #eeeeee;
  794. border-radius: 6px;
  795. border-collapse: separate !important;
  796. padding: 10px;
  797. }
  798. .list .first-td {
  799. width: 50%;
  800. }
  801. .pass-check {
  802. font-size: 20px;
  803. color: green;
  804. }
  805. .fail-cross {
  806. font-size: 20px;
  807. color: red;
  808. }
  809. </style>