CheckComputer.vue 29 KB

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