CheckComputer.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942
  1. <script setup lang="ts">
  2. import moment from "moment";
  3. import VueQrcode from "@chenfengyuan/vue-qrcode";
  4. import { onMounted, onUnmounted, watch } from "vue";
  5. import { useTimers } from "@/setups/useTimers";
  6. import { Close, Checkmark } from "@vicons/ionicons5";
  7. import { closeMediaStream, getMediaStream } from "@/utils/camera";
  8. import { useWXSocket } from "./Examing/setups/useWXSocket";
  9. import { store } from "@/store/store";
  10. import { httpApp } from "@/plugins/axiosApp";
  11. const emit = defineEmits<{ (e: "on-close"): void }>();
  12. const { addTimeout, addInterval } = useTimers();
  13. const show = $ref(true);
  14. let current = $ref(1);
  15. // @ts-expect-error chrome支持,但还有浏览器不支持,所以没进类型定义
  16. let downlink = navigator.connection.downlink;
  17. // @ts-expect-error
  18. let rtt = navigator.connection.rtt;
  19. const network = $ref({
  20. downlink,
  21. downlinkStatus: downlink > 0.5,
  22. rrt: rtt,
  23. rrtStatus: rtt < 1000,
  24. });
  25. const time = $ref({
  26. currentTimeZone: moment().format("Z"),
  27. timeZoneStatus: new Date().getTimezoneOffset() / 60 === -8,
  28. clockRateDiff: null as unknown as number | null,
  29. clockRateStateResolved: false,
  30. clockRateStatus: false,
  31. });
  32. const camera = $ref({
  33. openCameraResolved: false,
  34. openCameraStatus: false,
  35. identityStatus: false,
  36. identityResolved: false,
  37. });
  38. const sound = $ref({
  39. downloadResolved: false,
  40. downloadStatus: false,
  41. playedStatusResolved: false,
  42. playedStatus: false,
  43. });
  44. const wechat = $ref({
  45. qrValue: " ",
  46. qrScannedResolved: false,
  47. qrScanned: false,
  48. uploadResolved: false,
  49. uploadStatus: false,
  50. studentAnswer: null as unknown as string | null,
  51. examRecordDataId: null as unknown as string | null,
  52. });
  53. const step1Status = $computed(() => {
  54. return network.downlinkStatus && network.rrtStatus;
  55. });
  56. const step2StatusResolved = $computed(() => {
  57. return time.clockRateStateResolved;
  58. });
  59. const step2Status = $computed(() => {
  60. return time.timeZoneStatus && time.clockRateStatus;
  61. });
  62. const step3StatusResolved = $computed(() => {
  63. return camera.identityResolved && camera.openCameraResolved;
  64. });
  65. const step3Status = $computed(() => {
  66. return camera.identityStatus && camera.openCameraStatus;
  67. });
  68. const step4StatusResolved = $computed(() => {
  69. return sound.downloadResolved && sound.playedStatusResolved;
  70. });
  71. const step4Status = $computed(() => {
  72. return sound.downloadStatus && sound.playedStatus;
  73. });
  74. const step5StatusResolved = $computed(() => {
  75. return wechat.qrScannedResolved && wechat.uploadResolved;
  76. });
  77. const step5Status = $computed(() => {
  78. return wechat.qrScanned && wechat.uploadStatus;
  79. });
  80. //#region 时钟处理
  81. let nowDate: number = $ref(0);
  82. addInterval(() => (nowDate = Date.now()), 1000);
  83. console.log(nowDate);
  84. const CLOCK_RATE_TIMEOUT = 10;
  85. let start: moment.Moment, end: moment.Moment;
  86. void fetch("/oe-web/", { method: "HEAD" }).then((e) => {
  87. start = moment(e.headers.get("date"));
  88. });
  89. addTimeout(() => {
  90. void fetch("/oe-web/", { method: "HEAD" }).then((e) => {
  91. // 可能已经离开这个页面了
  92. if (isUnmounted) return;
  93. end = moment(e.headers.get("date"));
  94. time.clockRateStateResolved = true;
  95. time.clockRateDiff = end.diff(start, "seconds") - CLOCK_RATE_TIMEOUT;
  96. time.clockRateStatus = end.diff(start, "seconds") < CLOCK_RATE_TIMEOUT + 2;
  97. });
  98. }, CLOCK_RATE_TIMEOUT * 1000);
  99. let isUnmounted = false;
  100. onUnmounted(() => (isUnmounted = true));
  101. //#endregion 时钟处理
  102. //#region websocket
  103. // 初始化wxSocket的前提
  104. store.exam.WEIXIN_ANSWER_ENABLED = true;
  105. useWXSocket();
  106. onMounted(async () => {
  107. const examRecordDataId = store.user.id;
  108. const response = await httpApp.post<string>(
  109. "/api/ecs_oe_student/examControl/getQrCode",
  110. {
  111. examRecordDataId,
  112. order: 1,
  113. transferFileType: "AUDIO",
  114. testEnv: true,
  115. }
  116. );
  117. // let origin = window.location.origin.replace(
  118. // /.*(\.(ea100.com.cn|exam-cloud.cn))/,
  119. // `${location.protocol}//www$1`
  120. // );
  121. let origin = `${location.protocol}//${window.location.origin.slice(
  122. window.location.origin.indexOf(".")
  123. )}`;
  124. console.debug("测试验证:", origin);
  125. if (import.meta.env.DEV) {
  126. origin = import.meta.env.VITE_CONFIG_API_SERVER as string;
  127. }
  128. wechat.qrValue = response.data + encodeURIComponent("&apiServer=" + origin);
  129. const trueExamRecordDataId = decodeURIComponent(wechat.qrValue).match(
  130. /&examRecordDataId=(\d+)/
  131. )![1];
  132. wechat.examRecordDataId = trueExamRecordDataId;
  133. });
  134. // websocket 会在unmounted时自动关闭
  135. watch(
  136. () => store.exam.questionQrCodeScanned,
  137. () => {
  138. wechat.qrScanned = true;
  139. wechat.qrScannedResolved = true;
  140. }
  141. );
  142. watch(
  143. () => store.exam.questionAnswerFileUrl,
  144. (value) => {
  145. const examRecordDataId = wechat.examRecordDataId;
  146. for (const q of value) {
  147. if (!q.saved) {
  148. let acknowledgeStatus = "CONFIRMED";
  149. httpApp
  150. .post(
  151. "/api/ecs_oe_student/examControl/saveUploadedFileAcknowledgeStatus",
  152. {
  153. examRecordDataId,
  154. filePath: q.fileUrl,
  155. order: q.order,
  156. acknowledgeStatus,
  157. }
  158. )
  159. .then(() => {
  160. wechat.studentAnswer = q.fileUrl;
  161. wechat.uploadResolved = true;
  162. wechat.uploadStatus = true;
  163. q.saved = true;
  164. if (acknowledgeStatus === "CONFIRMED")
  165. $message.info("小程序作答已更新");
  166. })
  167. .catch(() => {
  168. $message.error("更新小程序答案失败!");
  169. });
  170. }
  171. }
  172. }
  173. );
  174. //#endregion websocket
  175. //#region 摄像头处理
  176. onMounted(async () => {
  177. await openCamera();
  178. });
  179. const video: HTMLVideoElement = $ref();
  180. async function openCamera() {
  181. const stream = await getMediaStream();
  182. video.srcObject = stream;
  183. try {
  184. await video.play();
  185. camera.openCameraStatus = true;
  186. } catch (error) {
  187. if (error instanceof Error) {
  188. if (error.name == "AbortError") {
  189. logger({
  190. cnl: ["server"],
  191. pgu: "AUTO",
  192. act: "video.paly",
  193. dtl: "AbortError and retry",
  194. });
  195. await video.play();
  196. logger({
  197. cnl: ["server"],
  198. pgu: "AUTO",
  199. act: "摄像头没有正常启用: AbortError 重试成功",
  200. });
  201. } else if (error.name == "NotSupportedError") {
  202. logger({
  203. cnl: ["server"],
  204. act: "摄像头没有正常启用",
  205. pgu: "AUTO",
  206. ejn: JSON.stringify(error),
  207. ext: {
  208. errorName: error.name,
  209. errorMessage: error.message,
  210. errorStack: error.stack,
  211. },
  212. });
  213. $message.error("摄像头没有正常启用: " + error);
  214. } else {
  215. throw error;
  216. }
  217. } else {
  218. logger({
  219. cnl: ["server"],
  220. pgu: "AUTO",
  221. act: "video.play",
  222. dtl: "not an Error",
  223. stk: error + "",
  224. });
  225. }
  226. throw error;
  227. } finally {
  228. camera.openCameraResolved = true;
  229. }
  230. }
  231. onUnmounted(() => {
  232. closeMediaStream();
  233. });
  234. //#endregion 摄像头处理
  235. function previous() {
  236. if (current > 1) {
  237. current -= 1;
  238. }
  239. }
  240. function next() {
  241. if (current < 6) {
  242. current += 1;
  243. }
  244. if (current === 6) {
  245. logger({
  246. cnl: ["server"],
  247. act: "环境检测",
  248. ext: {
  249. network: step1Status,
  250. time: step2Status,
  251. camera: step3Status,
  252. sound: step4Status,
  253. wechat: step5Status,
  254. },
  255. });
  256. }
  257. }
  258. </script>
  259. <template>
  260. <n-modal
  261. title="环境检测"
  262. :closable="false"
  263. :show="show"
  264. preset="card"
  265. style="width: 800px"
  266. >
  267. <div style="max-width: 800px; margin: 30px auto">
  268. <n-steps :current="current" size="small">
  269. <n-step title="网速"></n-step>
  270. <n-step title="时钟"></n-step>
  271. <n-step title="摄像头"></n-step>
  272. <n-step title="声音"></n-step>
  273. <n-step title="微信小程序"></n-step>
  274. <n-step title="检测结果"></n-step>
  275. </n-steps>
  276. <div v-if="current === 1" key="1" class="section">
  277. <div class="list">
  278. <table>
  279. <tbody class="list-row">
  280. <tr class="list-header qm-primary-strong-text">
  281. <td class="first-td">检查项</td>
  282. <td>值</td>
  283. <td>状态</td>
  284. </tr>
  285. <tr>
  286. <td>电脑当前下载速度</td>
  287. <td>{{ network.downlink }}Mb</td>
  288. <td>
  289. <div v-if="network.downlinkStatus">
  290. <n-icon class="pass-check" :component="Checkmark" />
  291. </div>
  292. <div v-else>
  293. <n-icon
  294. class="fail-cross"
  295. title="下载速度不佳"
  296. :component="Close"
  297. />
  298. </div>
  299. </td>
  300. </tr>
  301. <tr>
  302. <td>电脑当前网络延迟</td>
  303. <td>{{ network.rrt }}毫秒</td>
  304. <td>
  305. <div v-if="network.rrtStatus">
  306. <n-icon class="pass-check" :component="Checkmark" />
  307. </div>
  308. <div v-else>
  309. <n-icon
  310. class="fail-cross"
  311. title="网络延迟较大"
  312. :component="Close"
  313. />
  314. </div>
  315. </td>
  316. </tr>
  317. </tbody>
  318. </table>
  319. </div>
  320. </div>
  321. <div v-if="current === 2" key="2" class="section">
  322. <div class="list">
  323. <table>
  324. <tbody class="list-row">
  325. <tr class="list-header qm-primary-strong-text">
  326. <td class="first-td">检查项</td>
  327. <td>值</td>
  328. <td>状态</td>
  329. </tr>
  330. <tr>
  331. <td>电脑时区</td>
  332. <td>{{ time.currentTimeZone }}</td>
  333. <td>
  334. <div v-if="time.timeZoneStatus">
  335. <n-icon class="pass-check" :component="Checkmark" />
  336. </div>
  337. <div v-else>
  338. <n-icon
  339. class="fail-cross"
  340. title="请将电脑设置为北京时区"
  341. :component="Close"
  342. />
  343. </div>
  344. </td>
  345. </tr>
  346. <tr>
  347. <td>电脑时钟频率</td>
  348. <td>
  349. <div v-if="time.clockRateStateResolved">
  350. {{ (time.clockRateDiff ?? 0) > 3 ? "时钟过慢" : "正常" }}
  351. </div>
  352. <div v-else>
  353. <n-spin size="small" />
  354. </div>
  355. </td>
  356. <td>
  357. <div v-if="time.clockRateStateResolved">
  358. <n-icon
  359. v-if="time.clockRateStatus"
  360. class="pass-check"
  361. :component="Checkmark"
  362. />
  363. <n-icon
  364. v-else
  365. class="fail-cross"
  366. title="请更换电脑"
  367. :component="Close"
  368. />
  369. </div>
  370. <div v-else>
  371. <n-spin size="small" />
  372. </div>
  373. </td>
  374. </tr>
  375. </tbody>
  376. </table>
  377. </div>
  378. </div>
  379. <div v-show="current === 3" key="3" class="section">
  380. <div>
  381. <div style="display: flex">
  382. <video id="video" ref="video" width="400" height="300" autoplay />
  383. <div
  384. v-if="camera.openCameraResolved && camera.openCameraStatus"
  385. style="margin-left: 50px; margin-top: 100px"
  386. >
  387. <n-button
  388. type="warning"
  389. @click="
  390. camera.identityResolved = true;
  391. camera.identityStatus = false;
  392. "
  393. >
  394. 图像中不是电脑操作者本人
  395. </n-button>
  396. <div style="width: 30px; height: 30px"></div>
  397. <n-button
  398. type="primary"
  399. @click="
  400. camera.identityResolved = true;
  401. camera.identityStatus = true;
  402. "
  403. >
  404. 图像中是电脑操作者本人&nbsp;&nbsp;&nbsp;&nbsp;
  405. </n-button>
  406. </div>
  407. </div>
  408. </div>
  409. <div class="list">
  410. <table>
  411. <tbody class="list-row">
  412. <tr class="list-header qm-primary-strong-text">
  413. <td class="first-td">检查项</td>
  414. <td>值</td>
  415. <td>状态</td>
  416. </tr>
  417. <tr>
  418. <td>摄像头正常启用</td>
  419. <td>
  420. <div v-if="camera.openCameraResolved">
  421. {{ camera.openCameraStatus ? "正常" : "请检查摄像头" }}
  422. </div>
  423. <div v-else>
  424. <n-spin size="small" />
  425. </div>
  426. </td>
  427. <td>
  428. <div v-if="camera.openCameraResolved">
  429. <div v-if="camera.openCameraStatus">
  430. <n-icon class="pass-check" :component="Checkmark" />
  431. </div>
  432. <div v-else>
  433. <n-icon
  434. class="fail-cross"
  435. title="请检查摄像头"
  436. :component="Close"
  437. />
  438. </div>
  439. </div>
  440. <div v-else>
  441. <n-spin size="small" />
  442. </div>
  443. </td>
  444. </tr>
  445. <tr>
  446. <td>视频显示的是电脑操作者本人</td>
  447. <td>
  448. <div
  449. v-if="
  450. (camera.openCameraResolved && !camera.openCameraStatus) ||
  451. camera.identityResolved
  452. "
  453. >
  454. {{ camera.identityStatus ? "正常" : "请检查摄像头" }}
  455. </div>
  456. <div v-else>
  457. <n-spin size="small" />
  458. </div>
  459. </td>
  460. <td>
  461. <div
  462. v-if="
  463. (camera.openCameraResolved && !camera.openCameraStatus) ||
  464. camera.identityResolved
  465. "
  466. >
  467. <div v-if="camera.identityStatus">
  468. <n-icon class="pass-check" :component="Checkmark" />
  469. </div>
  470. <div v-else>
  471. <n-icon
  472. class="fail-cross"
  473. title="请检查摄像头"
  474. :component="Close"
  475. />
  476. </div>
  477. </div>
  478. <div v-else>
  479. <n-spin size="small" />
  480. </div>
  481. </td>
  482. </tr>
  483. </tbody>
  484. </table>
  485. </div>
  486. </div>
  487. <div
  488. v-show="current === 4"
  489. key="4"
  490. class="section"
  491. style="text-align: center"
  492. >
  493. <div>
  494. <div style="display: flex; margin-bottom: 30px">
  495. <audio
  496. src="https://ecs-static.qmth.com.cn/check-audio.mp3"
  497. controls
  498. nodownload
  499. @loadeddata="
  500. sound.downloadResolved = true;
  501. sound.downloadStatus = true;
  502. "
  503. @error="
  504. sound.downloadResolved = true;
  505. sound.downloadStatus = false;
  506. "
  507. />
  508. <div style="margin-left: 30px; display: flex">
  509. <n-button
  510. type="warning"
  511. title="或者听不到声音"
  512. @click="
  513. sound.playedStatusResolved = true;
  514. sound.playedStatus = false;
  515. "
  516. >
  517. 不能播放声音
  518. </n-button>
  519. <div style="width: 30px; height: 30px"></div>
  520. <n-button
  521. type="primary"
  522. @click="
  523. sound.playedStatusResolved = true;
  524. sound.playedStatus = true;
  525. "
  526. >
  527. 能够播放声音
  528. </n-button>
  529. </div>
  530. </div>
  531. </div>
  532. <div class="list">
  533. <table>
  534. <tbody class="list-row">
  535. <tr class="list-header qm-primary-strong-text">
  536. <td class="first-td">检查项</td>
  537. <td>值</td>
  538. <td>状态</td>
  539. </tr>
  540. <tr>
  541. <td>文件下载</td>
  542. <td>
  543. <div v-if="sound.downloadResolved">
  544. {{ sound.downloadStatus ? "正常" : "出错" }}
  545. </div>
  546. <div v-else>
  547. <n-spin size="small" />
  548. </div>
  549. </td>
  550. <td>
  551. <div v-if="sound.downloadResolved">
  552. <div v-if="sound.downloadStatus">
  553. <n-icon class="pass-check" :component="Checkmark" />
  554. </div>
  555. <div v-else>
  556. <n-icon
  557. class="fail-cross"
  558. title="下载出错"
  559. :component="Close"
  560. />
  561. </div>
  562. </div>
  563. <div v-else>
  564. <n-spin size="small" />
  565. </div>
  566. </td>
  567. </tr>
  568. <tr>
  569. <td>声音播放</td>
  570. <td>
  571. <div v-if="sound.playedStatusResolved">
  572. {{ sound.playedStatus ? "正常" : "出错" }}
  573. </div>
  574. <div v-else>
  575. <n-spin size="small" />
  576. </div>
  577. </td>
  578. <td>
  579. <div v-if="sound.playedStatusResolved">
  580. <div v-if="sound.playedStatus">
  581. <n-icon class="pass-check" :component="Checkmark" />
  582. </div>
  583. <div v-else>
  584. <n-icon
  585. class="fail-cross"
  586. title="不能播放声音"
  587. :component="Close"
  588. />
  589. </div>
  590. </div>
  591. <div v-else>
  592. <n-spin size="small" />
  593. </div>
  594. </td>
  595. </tr>
  596. </tbody>
  597. </table>
  598. </div>
  599. </div>
  600. <div v-show="current === 5" key="5" class="section">
  601. <div>
  602. <div style="display: flex">
  603. <div>
  604. <div v-if="wechat.qrValue" style="display: flex">
  605. <VueQrcode
  606. :value="wechat.qrValue"
  607. :options="{ width: 200 }"
  608. style="margin-left: -10px"
  609. ></VueQrcode>
  610. <div style="margin-top: 10px">
  611. <div style="font-size: 30px">
  612. 请使用<span style="font-weight: 900; color: #1e90ff"
  613. >微信</span
  614. >扫描二维码后,在微信小程序上录音,并上传文件。
  615. </div>
  616. <div
  617. v-if="wechat.qrScanned"
  618. style="margin-top: 30px; font-size: 30px"
  619. >
  620. {{ wechat.studentAnswer ? "已上传" : "已扫描" }}
  621. <n-icon :component="Checkmark" />
  622. </div>
  623. </div>
  624. </div>
  625. <div v-else>正在获取二维码...</div>
  626. </div>
  627. </div>
  628. <div
  629. class="audio-answer audio-answer-line-height"
  630. style="margin-top: 20px; text-align: left"
  631. >
  632. <span class="audio-answer-line-height">上传文件:</span>
  633. <audio
  634. v-if="wechat.studentAnswer"
  635. class="audio-answer-line-height"
  636. controls
  637. controlsList="nodownload"
  638. :src="wechat.studentAnswer"
  639. />
  640. <span v-else class="audio-answer-line-height">未上传文件</span>
  641. </div>
  642. <div style="margin-top: 30px; display: flex; margin-bottom: 30px">
  643. <n-button
  644. type="warning"
  645. title="扫码不成功"
  646. @click="
  647. wechat.qrScannedResolved = true;
  648. wechat.qrScanned = false;
  649. "
  650. >
  651. 不能正确扫描二维码
  652. </n-button>
  653. <div style="width: 30px; height: 30px"></div>
  654. <n-button
  655. type="warning"
  656. title="上传不成功"
  657. @click="
  658. wechat.uploadResolved = true;
  659. wechat.uploadStatus = false;
  660. "
  661. >
  662. 上传不成功
  663. </n-button>
  664. </div>
  665. </div>
  666. <div class="list">
  667. <table>
  668. <tbody class="list-row">
  669. <tr class="list-header qm-primary-strong-text">
  670. <td class="first-td">检查项</td>
  671. <td>值</td>
  672. <td>状态</td>
  673. </tr>
  674. <tr>
  675. <td>扫描二维码</td>
  676. <td>
  677. <div v-if="wechat.qrScannedResolved">
  678. {{ wechat.qrScanned ? "正常" : "出错" }}
  679. </div>
  680. <div v-else>
  681. <n-spin size="small" />
  682. </div>
  683. </td>
  684. <td>
  685. <div v-if="wechat.qrScannedResolved">
  686. <div v-if="wechat.qrScanned">
  687. <n-icon class="pass-check" :component="Checkmark" />
  688. </div>
  689. <div v-else>
  690. <n-icon
  691. class="fail-cross"
  692. title="扫描出错"
  693. :component="Close"
  694. />
  695. </div>
  696. </div>
  697. <div v-else>
  698. <n-spin size="small" />
  699. </div>
  700. </td>
  701. </tr>
  702. <tr>
  703. <td>上传录音</td>
  704. <td>
  705. <div v-if="wechat.uploadResolved">
  706. {{ wechat.uploadStatus ? "正常" : "出错" }}
  707. </div>
  708. <div v-else>
  709. <n-spin size="small" />
  710. </div>
  711. </td>
  712. <td>
  713. <div v-if="wechat.uploadResolved">
  714. <div v-if="wechat.uploadStatus">
  715. <n-icon class="pass-check" :component="Checkmark" />
  716. </div>
  717. <div v-else>
  718. <n-icon class="fail-cross" :component="Close" />
  719. </div>
  720. </div>
  721. <div v-else>
  722. <n-spin size="small" />
  723. </div>
  724. </td>
  725. </tr>
  726. </tbody>
  727. </table>
  728. </div>
  729. </div>
  730. <div v-show="current === 6" key="6" class="section">
  731. <div class="list">
  732. <table>
  733. <tbody class="list-row">
  734. <tr class="list-header qm-primary-strong-text">
  735. <td class="first-td">检查项</td>
  736. <td>结果</td>
  737. </tr>
  738. <tr>
  739. <td>网速</td>
  740. <td>
  741. <div v-if="step1Status">
  742. <n-icon class="pass-check" :component="Checkmark" />
  743. </div>
  744. <div v-else>
  745. <n-icon class="fail-cross" :component="Close" />
  746. </div>
  747. </td>
  748. </tr>
  749. <tr>
  750. <td>时钟</td>
  751. <td>
  752. <div v-if="step2StatusResolved">
  753. <div v-if="step2Status">
  754. <n-icon class="pass-check" :component="Checkmark" />
  755. </div>
  756. <div v-else>
  757. <n-icon class="fail-cross" :component="Close" />
  758. </div>
  759. </div>
  760. <div v-else>
  761. <n-spin size="small" />
  762. </div>
  763. </td>
  764. </tr>
  765. <tr>
  766. <td>摄像头</td>
  767. <td>
  768. <div v-if="step3StatusResolved">
  769. <div v-if="step3Status">
  770. <n-icon class="pass-check" :component="Checkmark" />
  771. </div>
  772. <div v-else>
  773. <n-icon class="fail-cross" :component="Close" />
  774. </div>
  775. </div>
  776. <div v-else class="fail-cross">
  777. 请在“摄像头”步骤进行人工确认!
  778. </div>
  779. </td>
  780. </tr>
  781. <tr>
  782. <td>声音</td>
  783. <td>
  784. <div v-if="step4StatusResolved">
  785. <div v-if="step4Status">
  786. <n-icon class="pass-check" :component="Checkmark" />
  787. </div>
  788. <div v-else>
  789. <n-icon class="fail-cross" :component="Close" />
  790. </div>
  791. </div>
  792. <div v-else class="fail-cross">
  793. 请在“声音”步骤进行人工确认!
  794. </div>
  795. </td>
  796. </tr>
  797. <tr>
  798. <td>微信小程序</td>
  799. <td>
  800. <div v-if="step5StatusResolved">
  801. <div v-if="step5Status">
  802. <n-icon class="pass-check" :component="Checkmark" />
  803. </div>
  804. <div v-else>
  805. <n-icon class="fail-cross" :component="Close" />
  806. </div>
  807. </div>
  808. <div v-else class="fail-cross">
  809. 请在“微信小程序”步骤进行人工确认!
  810. </div>
  811. </td>
  812. </tr>
  813. </tbody>
  814. </table>
  815. </div>
  816. <div style="color: red">
  817. <div v-if="!step1Status" key="a">
  818. 检查网络是否连接,路由器是否正常工作。
  819. </div>
  820. <div v-if="step2StatusResolved && !step2Status" key="b">
  821. 请调整电脑时间和社区与北京时间一致。
  822. </div>
  823. <div v-if="step3StatusResolved && !step3Status" key="c">
  824. 请确认摄像头连接线正常,能正常工作,关闭杀毒软件、关闭摄像头滤镜软件;请确认您的电脑是否为双摄摄像头,启用的摄像头是否正确。
  825. </div>
  826. <div v-if="step4StatusResolved && !step4Status" key="d">
  827. 请确认音箱连接正常,调整音量开关及大小。
  828. </div>
  829. <div v-if="step5StatusResolved && !step5Status" key="e">
  830. 请确认微信已登录并连接网络。
  831. </div>
  832. <div
  833. v-if="
  834. !step1Status ||
  835. (step2StatusResolved && !step2Status) ||
  836. (step3StatusResolved && !step3Status) ||
  837. (step4StatusResolved && !step4Status) ||
  838. (step5StatusResolved && !step5Status)
  839. "
  840. key="f"
  841. >
  842. 请按提示检查并调试,调试后可再次进行环境检测。
  843. </div>
  844. </div>
  845. </div>
  846. <div style="margin-top: 30px; text-align: center">
  847. <n-button type="primary" :disabled="current === 1" @click="previous">
  848. 上一步
  849. </n-button>
  850. <div style="width: 30px; height: 1px; display: inline-block"></div>
  851. <n-button type="primary" :disabled="current === 6" @click="next">
  852. 下一步
  853. </n-button>
  854. <div style="width: 30px; height: 1px; display: inline-block"></div>
  855. <n-button
  856. v-if="current === 6"
  857. key="xxx"
  858. type="primary"
  859. @click="() => emit('on-close')"
  860. >
  861. 进入考试
  862. </n-button>
  863. </div>
  864. </div>
  865. </n-modal>
  866. </template>
  867. <style scoped>
  868. .section {
  869. margin-top: 10px;
  870. }
  871. .list {
  872. border: 1px solid #eeeeee;
  873. border-radius: 6px;
  874. text-align: center;
  875. }
  876. .list table {
  877. width: 100%;
  878. border-collapse: collapse !important;
  879. border-spacing: 0;
  880. }
  881. .list td {
  882. border: 1px solid #eeeeee;
  883. border-radius: 6px;
  884. border-collapse: separate !important;
  885. padding: 10px;
  886. }
  887. .list .first-td {
  888. width: 50%;
  889. }
  890. .pass-check {
  891. font-size: 20px;
  892. color: green;
  893. }
  894. .fail-cross {
  895. font-size: 20px;
  896. color: red;
  897. }
  898. </style>