index.tsx 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616
  1. import { Transition, defineComponent, onMounted, reactive, watch, defineAsyncComponent, computed, onUnmounted } from "vue";
  2. import { connectWebsocket, evaluatingData, handleEndBegin, handleStartBegin, handleStartEvaluat, handleViewReport, startCheckDelay, checkUseEarphone, handleCancelEvaluat, checkMinInterval, handleEndEvaluat } from "/src/view/evaluating";
  3. import Earphone from "./earphone";
  4. import styles from "./index.module.less";
  5. import SoundEffect from "./sound-effect";
  6. import state, { handleRessetState, resetPlaybackToStart, musicalInstrumentCodeInfo, clearSelection, initSetPlayRate } from "/src/state";
  7. import { storeData } from "/src/store";
  8. import { browser } from "/src/utils";
  9. import { getNoteByMeasuresSlursStart } from "/src/helpers/formateMusic";
  10. import { Icon, Popup, showToast, closeToast, showLoadingToast } from "vant";
  11. import EvaluatResult from "./evaluat-result";
  12. import EvaluatAudio from "./evaluat-audio";
  13. import { api_getDeviceDelay, api_openAdjustRecording, api_proxyServiceMessage, api_videoUpdate, getEarphone, api_back, api_startDelayCheck, api_cancelDelayCheck, api_remove_cancelDelayCheck, api_closeDelayCheck, api_finishDelayCheck, api_retryEvaluating, api_remove_finishDelayCheck } from "/src/helpers/communication";
  14. import EvaluatShare from "./evaluat-share";
  15. import { Vue3Lottie } from "vue3-lottie";
  16. import startData from "./data/start.json";
  17. import startingData from "./data/starting.json";
  18. import iconTastBg from "./icons/task-bg.svg";
  19. import iconEvaluat from "./icons/evaluating.json";
  20. import { headImg } from "/src/page-instrument/header-top/image";
  21. import { api_musicPracticeRecordVideoUpload } from "../api";
  22. import { headTopData } from "../header-top/index";
  23. import { getQuery } from "/src/utils/queryString";
  24. import Countdown from "./countdown";
  25. import { IPostMessage } from "/src/utils/native-message";
  26. import tipErjiBg from "./icons/tip_erji.png"
  27. import tipErjiBtn from "./icons/tip_btn.png"
  28. // const DelayCheck = defineAsyncComponent(() =>
  29. // import('./delay-check')
  30. // )
  31. // frequency 频率, amplitude 振幅, decibels 分贝
  32. type TCriteria = "frequency" | "amplitude" | "decibels";
  33. /**
  34. * 节拍器时长
  35. * 评测模式时,应该传节拍器时长
  36. * 阶段评测时,判断是否从第一小节开始,并且曲子本身含有节拍器,需要传节拍器时长,否则传0
  37. */
  38. let actualBeatLength = 0;
  39. let calculateInfo: any = {};
  40. let checkErjiTimer: any = null
  41. export const reCheckDelay = () => {
  42. headTopData.settingMode = false
  43. state.setting.soundEffect = false
  44. api_startDelayCheck({});
  45. }
  46. export default defineComponent({
  47. name: "evaluat-model",
  48. setup() {
  49. const query = getQuery();
  50. const evaluatModel = reactive({
  51. tips: true,
  52. evaluatUpdateAudio: false,
  53. isSaveVideo: state.setting.camera && state.setting.saveToAlbum,
  54. shareMode: false,
  55. });
  56. /**
  57. * 检测返回
  58. */
  59. const handleDelayBack = () => {
  60. if (query.workRecord) {
  61. evaluatingData.soundEffectMode = false;
  62. api_back();
  63. } else {
  64. evaluatingData.soundEffectMode = false;
  65. // handleRessetState();
  66. // headTopData.modeType = "init";
  67. }
  68. };
  69. /**
  70. * 执行检测
  71. */
  72. const handlePerformDetection = async () => {
  73. console.log(evaluatingData.checkStep, evaluatingData, "检测123");
  74. // 检测完成不检测了
  75. if (evaluatingData.checkEnd) return;
  76. // 延迟检测
  77. if (evaluatingData.checkStep === 0) {
  78. evaluatingData.checkStep = 10;
  79. // 没有设备延迟数据 或 开启了效音 显示检测组件,并持续检测耳机状态
  80. if (state.setting.soundEffect) {
  81. evaluatingData.soundEffectMode = true;
  82. return;
  83. }
  84. // 判断只有开始了设备检测之后才去调用api
  85. if (state.setting.soundEffect) {
  86. const delayData = await api_getDeviceDelay();
  87. // console.log("🚀 ~ delayTime:", delayData);
  88. if (delayData && delayData.content?.value < 0) {
  89. evaluatingData.soundEffectMode = true;
  90. return;
  91. }
  92. }
  93. handlePerformDetection();
  94. return;
  95. }
  96. // 效验完成
  97. if (evaluatingData.checkStep === 10) {
  98. const erji = await checkUseEarphone();
  99. if (!erji) {
  100. evaluatingData.earphoneMode = true;
  101. }
  102. evaluatingData.checkEnd = true;
  103. console.log("检测结束,生成数据");
  104. handleConnect();
  105. }
  106. };
  107. const browserInfo = browser();
  108. /** 是否是节奏练习 */
  109. const isRhythmicExercises = () => {
  110. const examSongName = state.examSongName || "";
  111. return examSongName.indexOf("节奏练习") > -1;
  112. };
  113. /** 获取评测标准 */
  114. const getEvaluationCriteria = () => {
  115. let criteria: TCriteria = "frequency";
  116. // 声部打击乐
  117. if ([23, 113, 121].includes(state.subjectId)) {
  118. criteria = "amplitude";
  119. } else if (isRhythmicExercises()) {
  120. // 分类为节奏练习
  121. criteria = "decibels";
  122. }
  123. return criteria;
  124. };
  125. /** 校验耳机状态 */
  126. const checkEarphoneStatus = async (type?: string) => {
  127. clearTimeout(checkErjiTimer);
  128. checkErjiTimer = null;
  129. if (type !== "start") {
  130. // const erji = await checkUseEarphone();
  131. const res = await getEarphone();
  132. const erji = res?.content?.checkIsWired || false;
  133. console.log("耳机状态111", res);
  134. evaluatingData.earphoneMode = true;
  135. evaluatingData.earPhoneType = res?.content?.type || "";
  136. if (evaluatingData.earPhoneType === "有线耳机") {
  137. clearTimeout(checkErjiTimer);
  138. checkErjiTimer = null;
  139. setTimeout(() => {
  140. evaluatingData.earphoneMode = false;
  141. }, 3000);
  142. } else {
  143. // 如果没有佩戴有限耳机,需要持续检测耳机状态
  144. checkErjiTimer = setTimeout(() => {
  145. checkEarphoneStatus();
  146. }, 1000);
  147. }
  148. }
  149. console.log("检测结束,生成数据", evaluatingData.websocketState, evaluatingData.startBegin, evaluatingData.checkEnd);
  150. handleConnect();
  151. };
  152. /** 生成评测曲谱数据 */
  153. const formatTimes = () => {
  154. console.log('评测111')
  155. let starTime = 0;
  156. let ListenMode = false;
  157. let dontEvaluatingMode = false;
  158. let skip = false;
  159. const datas = [];
  160. let selectTimes = state.times;
  161. let unitTestIdx = 0;
  162. let preTime = 0;
  163. let preTimes = [];
  164. // 系统节拍器时长
  165. actualBeatLength = Math.round((state.times[0].fixtime * 1000) / 1);
  166. // 如果是阶段评测,选取该阶段的times
  167. if (state.isSelectMeasureMode && state.section.length) {
  168. const startIndex = state.times.findIndex((n: any) => n.noteId == state.section[0].noteId);
  169. let endIndex = state.times.findIndex((n: any) => n.noteId == state.section[1].noteId);
  170. endIndex = endIndex < state.section[1].i ? state.section[1].i : endIndex;
  171. if (startIndex > 1) {
  172. // firstNoteTime应该取预备小节的第一个音符的开始播放的时间
  173. const idx = startIndex - 1 - state.times[startIndex - 1].si;
  174. preTime = state.times[idx] ? state.times[idx].time * 1000 : 0;
  175. }
  176. actualBeatLength = startIndex == 0 && state.isOpenMetronome ? actualBeatLength : 0;
  177. selectTimes = state.times.filter((n: any, index: number) => {
  178. return index >= startIndex && index <= endIndex;
  179. });
  180. preTimes = state.times.filter((n: any, index: number) => {
  181. return index < startIndex;
  182. });
  183. unitTestIdx = startIndex;
  184. starTime = selectTimes[0].sourceRelativeTime || selectTimes[0].relativeTime;
  185. }
  186. // 阶段评测beatLength需要加上预备小节的持续时长
  187. actualBeatLength = preTimes.length ? actualBeatLength + preTimes[preTimes.length - 1].relaMeasureLength * 1000 : actualBeatLength;
  188. // 如果是弱起,并且预备小节是第一节
  189. if (state.section.length && state.sectionFirst && state.sectionFirst.measureListIndex == 0) {
  190. actualBeatLength = actualBeatLength < Math.round((state.times[0].fixtime * 1000) / 1) ? Math.round((state.times[0].fixtime * 1000) / 1) : actualBeatLength;
  191. }
  192. let firstNoteTime = unitTestIdx > 1 ? preTime : 0;
  193. let measureIndex = -1;
  194. let recordMeasure = -1;
  195. for (let index = 0; index < selectTimes.length; index++) {
  196. const item = selectTimes[index];
  197. const note = getNoteByMeasuresSlursStart(item);
  198. // #8701 bug: 评测模式,是以曲谱本身的速度进行评测,所以rate取1,不需要转换
  199. // const rate = state.speed / state.originSpeed;
  200. const rate = state.basePlayRate * state.originAudioPlayRate; // 播放倍率
  201. // const difftime = item.difftime;
  202. const difftime = 0;
  203. const start = difftime + (item.sourceRelativeTime || item.relativeTime) - starTime;
  204. const end = difftime + (item.sourceRelaEndtime || item.relaEndtime) - starTime;
  205. const isStaccato = note.noteElement.voiceEntry.isStaccato();
  206. const noteRate = isStaccato ? 0.5 : 1;
  207. if (note.formatLyricsEntries.contains("Play") || note.formatLyricsEntries.contains("Play...")) {
  208. ListenMode = false;
  209. }
  210. if (note.formatLyricsEntries.contains("Listen")) {
  211. ListenMode = true;
  212. }
  213. if (note.formatLyricsEntries.contains("纯律结束")) {
  214. dontEvaluatingMode = false;
  215. }
  216. if (note.formatLyricsEntries.contains("纯律")) {
  217. dontEvaluatingMode = true;
  218. }
  219. const nextNote = selectTimes[index + 1];
  220. // console.log("noteinfo", note.noteElement.isRestFlag && !!note.stave && !!nextNote)
  221. if (skip && (note.stave || !item.noteElement.isRestFlag || (nextNote && !nextNote.noteElement.isRestFlag))) {
  222. skip = false;
  223. }
  224. if (note.noteElement.isRestFlag && !!note.stave && !!nextNote && nextNote.noteElement.isRestFlag) {
  225. skip = true;
  226. }
  227. // console.log(note.measureOpenIndex, item.measureOpenIndex, note);
  228. // console.log("skip", skip)
  229. // console.log(end,start,rate,noteRate, '评测')
  230. if (note.measureOpenIndex != recordMeasure) {
  231. measureIndex++;
  232. recordMeasure = note.measureOpenIndex;
  233. }
  234. // 是否是需要延续、不停顿演奏的音符
  235. let isTenutoSound = false;
  236. if (item?.noteElement?.tie && item.noteElement.tie?.StartNote) {
  237. const startId = item.noteElement.tie?.StartNote?.NoteToGraphicalNoteObjectId
  238. isTenutoSound = item.NoteToGraphicalNoteObjectId === startId ? false : true
  239. }
  240. const data = {
  241. timeStamp: (start * 1000) / rate,
  242. duration: ((end * 1000) / rate - (start * 1000) / rate) * noteRate,
  243. frequency: item.frequency,
  244. nextFrequency: item.nextFrequency,
  245. prevFrequency: item.prevFrequency,
  246. // 重复的情况index会自然累加,render的index是谱面渲染的index
  247. measureIndex: measureIndex,
  248. measureRenderIndex: item.measureListIndex,
  249. // item.MeasureNumberXML >= 1 ? item.MeasureNumberXML - 1 : note.noteElement.sourceMeasure.measureListIndex,
  250. dontEvaluating: item.hasGraceNote || ListenMode || dontEvaluatingMode || !!item?.voiceEntry?.ornamentContainer || !!item.noteElement?.speedInfo?.startWord?.includes('rit.') || item.skipMode,
  251. musicalNotesIndex: index,
  252. denominator: note.noteElement?.Length.denominator,
  253. // isOrnament: !!note?.voiceEntry?.ornamentContainer,
  254. isTenutoSound,
  255. isStaccato: item?.voiceEntry?.isStaccato, // 是否是重音
  256. };
  257. datas.push(data);
  258. }
  259. return {
  260. datas,
  261. firstNoteTime,
  262. };
  263. };
  264. /** 连接websocket */
  265. const handleConnect = async () => {
  266. const behaviorId = localStorage.getItem("behaviorId") || localStorage.getItem("BEHAVIORID") || undefined;
  267. // let rate = state.speed / state.originSpeed;
  268. const rate = state.basePlayRate * state.originAudioPlayRate; // 播放倍率
  269. // rate = parseFloat(rate.toFixed(2));
  270. console.log("速度比例", rate, "速度", state.speed);
  271. calculateInfo = formatTimes();
  272. // 评测的速度,如果是选段,则选选段开头小节的速度
  273. const evaluatSpeed = state.sectionStatus && state.section.length === 2 && state.section[0].measureSpeed ? state.section[0].measureSpeed * state.basePlayRate : state.speed;
  274. evaluatingData.evaluatSpeed = evaluatSpeed;
  275. const content = {
  276. musicXmlInfos: calculateInfo.datas,
  277. subjectId: state.musicalCode,
  278. detailId: state.detailId,
  279. examSongId: state.examSongId,
  280. xmlUrl: state.xmlUrl,
  281. partIndex: state.partIndex,
  282. behaviorId,
  283. platform: browserInfo.ios ? "IOS" : browserInfo.android ? "ANDROID" : "WEB",
  284. clientId: storeData.platformType === "STUDENT" ? "student" : storeData.platformType === "TEACHER" ? "teacher" : "education",
  285. hertz: state.setting.frequency,
  286. reactionTimeMs: state.setting.reactionTimeMs ? Number(state.setting.reactionTimeMs) : 0,
  287. speed: evaluatSpeed,
  288. heardLevel: state.setting.evaluationDifficulty,
  289. // beatLength: Math.round((state.fixtime * 1000) / rate),
  290. beatLength: actualBeatLength,
  291. evaluationCriteria: state.evaluationStandard,
  292. speedRate: parseFloat(rate.toFixed(2)), // 播放倍率
  293. };
  294. await connectWebsocket(content);
  295. // state.playSource = "music";
  296. };
  297. /** 评测结果按钮处理 */
  298. const handleEvaluatResult = (type: "practise" | "tryagain" | "look" | "share" | "update" | "selfCancel") => {
  299. if (type === "update") {
  300. if (state.isAppPlay) {
  301. evaluatModel.evaluatUpdateAudio = true;
  302. resetPlaybackToStart();
  303. return;
  304. } else if (evaluatingData.resultData?.recordIdStr || evaluatingData.resultData?.recordId) {
  305. const rate = state.basePlayRate * state.originAudioPlayRate; // 播放倍率
  306. // 上传云端
  307. // evaluatModel.evaluatUpdateAudio = true;
  308. api_openAdjustRecording({
  309. recordId: evaluatingData.resultData?.recordIdStr || evaluatingData.resultData?.recordId,
  310. title: state.examSongName || "曲谱演奏",
  311. coverImg: state.coverImg,
  312. speedRate: parseFloat(rate.toFixed(2)), // 播放倍率
  313. musicRenderType: state.musicRenderType,
  314. musicSheetId: state.examSongId,
  315. 'part-index': state.partIndex
  316. });
  317. return;
  318. }
  319. } else if (type === "share") {
  320. // 分享
  321. evaluatModel.shareMode = true;
  322. return;
  323. } else if (type === "look") {
  324. // 跳转
  325. handleViewReport("recordId", "instrument");
  326. return;
  327. } else if (type === "practise") {
  328. // 去练习
  329. handleStartEvaluat();
  330. } else if (type === "tryagain") {
  331. startBtnHandle();
  332. } else if (type === "selfCancel") {
  333. // 再来一次,需要手动取消评测,不生成评测记录,不显示评测结果弹窗
  334. evaluatingData.oneselfCancleEvaluating = true;
  335. // handleCancelEvaluat();
  336. handleEndEvaluat(true, 'selfCancel');
  337. evaluatingData.isBeginMask = true;
  338. state.playState = "paused";
  339. }
  340. resetPlaybackToStart();
  341. evaluatingData.resulstMode = false;
  342. };
  343. /** 上传音视频 */
  344. const hanldeUpdateVideoAndAudio = async (update = false) => {
  345. if (!update) {
  346. evaluatModel.evaluatUpdateAudio = false;
  347. return;
  348. }
  349. if (state.setting.camera && state.setting.saveToAlbum) {
  350. evaluatModel.evaluatUpdateAudio = false;
  351. api_videoUpdate((res: any) => {
  352. if (res) {
  353. if (res?.content?.type === "success") {
  354. handleSaveResult({
  355. id: evaluatingData.resultData?.recordId,
  356. videoFilePath: res?.content?.filePath,
  357. });
  358. } else if (res?.content?.type === "error") {
  359. showToast({
  360. message: res.content?.message || "上传失败",
  361. });
  362. }
  363. }
  364. });
  365. return;
  366. }
  367. evaluatModel.evaluatUpdateAudio = false;
  368. showToast("上传成功");
  369. };
  370. const handleSaveResult = async (_body: any) => {
  371. await api_musicPracticeRecordVideoUpload(_body);
  372. showToast("上传成功");
  373. };
  374. const startBtnHandle = async () => {
  375. // 如果打开了延迟检测开关,需要先发送开始检测的消息
  376. const delayData = await api_getDeviceDelay();
  377. console.log('设备的延迟值',delayData.content?.value)
  378. if (delayData && delayData.content?.value <= 0) {
  379. await api_startDelayCheck({});
  380. return;
  381. }
  382. evaluatingData.needReplayEvaluat = false;
  383. // 选段未完成时,清除选段状态
  384. if (state.sectionStatus && state.section.length < 2) {
  385. clearSelection();
  386. }
  387. // 如果是异常状态,先等待500ms再执行后续流程
  388. if (evaluatingData.isErrorState && !state.setting.soundEffect) {
  389. // console.log('异常流程1')
  390. showLoadingToast({
  391. message: "处理中",
  392. duration: 1000,
  393. overlay: true,
  394. overlayClass: styles.scoreMode,
  395. });
  396. await new Promise<void>((resolve) => {
  397. setTimeout(() => {
  398. closeToast();
  399. evaluatingData.isErrorState = false;
  400. // console.log('异常流程2')
  401. resolve();
  402. }, 1000);
  403. });
  404. }
  405. // console.log('异常流程3')
  406. // 非选段状态,从头开始评测,重置速度
  407. if (!state.sectionStatus && state.section.length === 0) {
  408. state.activeNoteIndex = 0;
  409. state.speed = state.times[0].measureSpeed * state.basePlayRate
  410. }
  411. initSetPlayRate();
  412. // 检测APP端socket状态
  413. const res: any = await startCheckDelay();
  414. if (res?.checked) {
  415. handleConnect();
  416. handleStartBegin(calculateInfo.firstNoteTime);
  417. if (evaluatingData.isErrorState) {
  418. evaluatingData.isErrorState = false;
  419. evaluatingData.resulstMode = false;
  420. }
  421. }
  422. };
  423. // 监听到APP取消延迟检测
  424. const handleCancelDelayCheck = async (res?: IPostMessage) => {
  425. console.log("监听取消延迟检测", res);
  426. if (res?.content) {
  427. // 关闭延迟检测页面,并返回到模式选择页面
  428. // await api_closeDelayCheck({});
  429. handleDelayBack();
  430. }
  431. };
  432. // 监听APP延迟成功的回调
  433. const handleFinishDelayCheck = async (res?: IPostMessage) => {
  434. console.log("监听延迟检测成功", res);
  435. evaluatingData.socketErrorPop = false;
  436. if (res?.content) {
  437. evaluatingData.checkEnd = true;
  438. state.setting.soundEffect = false;
  439. evaluatingData.tipErjiShow = true;
  440. }
  441. };
  442. // 监听重复评测消息
  443. const handRetryEvaluating = () => {
  444. handleEvaluatResult("tryagain");
  445. };
  446. const earPhonePopShow = computed(() => {
  447. return evaluatingData.earphoneMode && !state.isLoading && !state.hasDriverPop;
  448. });
  449. const tipErjiPopShow = computed(() => {
  450. return evaluatingData.tipErjiShow && !state.isLoading && !state.hasDriverPop;
  451. });
  452. // watch(
  453. // () => state.setting.soundEffect,
  454. // (val) => {
  455. // if (val) {
  456. // headTopData.settingMode = false
  457. // api_startDelayCheck({});
  458. // state.setting.soundEffect = false
  459. // }
  460. // }
  461. // );
  462. // 手动取消评测,需要自动再次评测
  463. watch(
  464. () => evaluatingData.needReplayEvaluat,
  465. (val) => {
  466. if (val && evaluatingData.oneselfCancleEvaluating) {
  467. setTimeout(() => {
  468. startBtnHandle();
  469. }, 500);
  470. }
  471. }
  472. );
  473. onMounted(async () => {
  474. // 如果打开了延迟检测开关,需要先发送开始检测的消息
  475. const delayData = await api_getDeviceDelay();
  476. console.log('设备的延迟值',delayData.content?.value)
  477. if (delayData && delayData.content?.value <= 0) {
  478. await api_startDelayCheck({});
  479. } else {
  480. evaluatingData.checkEnd = true;
  481. checkEarphoneStatus();
  482. }
  483. evaluatingData.isDisabledPlayMusic = true;
  484. // handlePerformDetection();
  485. api_cancelDelayCheck(handleCancelDelayCheck);
  486. api_finishDelayCheck(handleFinishDelayCheck);
  487. api_retryEvaluating(handRetryEvaluating);
  488. });
  489. onUnmounted(() => {
  490. api_remove_finishDelayCheck(handleFinishDelayCheck);
  491. api_remove_cancelDelayCheck(handleCancelDelayCheck);
  492. clearTimeout(checkErjiTimer);
  493. checkErjiTimer = null;
  494. });
  495. return () => (
  496. <div>
  497. <div class={styles.operatingBtn}>
  498. {!evaluatingData.startBegin && (
  499. <img
  500. class={[styles.iconBtn, "evaluting-1"]}
  501. src={headImg("icon_play.png")}
  502. onClick={() => {
  503. startBtnHandle();
  504. }}
  505. />
  506. )}
  507. {evaluatingData.startBegin && (
  508. <>
  509. <img class={styles.iconBtn} src={headImg("icon_reset.png")} onClick={() => {
  510. // 校验评测最小间隔时间
  511. const currentTime = +new Date();
  512. // 开始评测和结束评测的间隔时间小于800毫秒,则不处理
  513. if (currentTime - evaluatingData.recordingTime < 800) {
  514. return;
  515. }
  516. handleEvaluatResult("selfCancel")
  517. }} />
  518. <img class={styles.iconBtn} src={headImg("submit.png")} onClick={() => {
  519. // 校验评测最小间隔时间
  520. const currentTime = +new Date();
  521. // 开始评测和结束评测的间隔时间小于800毫秒,则不处理
  522. if (currentTime - evaluatingData.recordingTime < 800) {
  523. return;
  524. }
  525. handleEndBegin()
  526. }} />
  527. </>
  528. )}
  529. </div>
  530. {/* {evaluatingData.soundEffectMode && (
  531. <DelayCheck
  532. onClose={() => {
  533. evaluatingData.soundEffectMode = false;
  534. handlePerformDetection();
  535. }}
  536. onBack={() => handleDelayBack()}
  537. />
  538. )} */}
  539. {/* 倒计时 */}
  540. <Countdown />
  541. {/* 遮罩 */}
  542. {
  543. evaluatingData.isBeginMask && <div class={styles.beginMask}></div>
  544. }
  545. <Popup teleport="body" closeOnClickOverlay={false} class={["popup-custom", "van-scale"]} transition="van-scale" v-model:show={tipErjiPopShow.value}>
  546. <div class={styles.earphoneBox}>
  547. <img class={styles.earphoneBg} src={tipErjiBg} />
  548. <img class={styles.earphoneBtn} src={tipErjiBtn} onClick={() => {
  549. evaluatingData.tipErjiShow = false;
  550. checkEarphoneStatus();
  551. }} />
  552. </div>
  553. </Popup>
  554. <Popup teleport="body" closeOnClickOverlay={false} class={["popup-custom", "van-scale"]} transition="van-scale" v-model:show={earPhonePopShow.value}>
  555. <Earphone
  556. earphoneType={evaluatingData.earPhoneType}
  557. onClose={() => {
  558. clearTimeout(checkErjiTimer);
  559. checkErjiTimer = null;
  560. // #11035,可能刚好关闭耳机弹窗的时候,第二次又出现了弹窗
  561. setTimeout(() => {
  562. evaluatingData.earphoneMode = false;
  563. }, 300);
  564. // handlePerformDetection();
  565. checkEarphoneStatus("start");
  566. }}
  567. />
  568. </Popup>
  569. {/* 评测作业,非完整评测不显示评测结果弹窗 */}
  570. {evaluatingData.hideResultModal ? (
  571. <EvaluatResult onClose={handleEvaluatResult} />
  572. ) : (
  573. <Popup teleport="body" closeOnClickOverlay={false} class={["popup-custom", "van-scale"]} transition="van-scale" v-model:show={evaluatingData.resulstMode}>
  574. <EvaluatResult onClose={handleEvaluatResult} />
  575. </Popup>
  576. )}
  577. <Popup teleport="body" closeOnClickOverlay={false} class={["popup-custom", "van-scale"]} transition="van-scale" v-model:show={evaluatModel.evaluatUpdateAudio}>
  578. <EvaluatAudio onClose={hanldeUpdateVideoAndAudio} />
  579. </Popup>
  580. <Popup teleport="body" class={["popup-custom", "van-scale"]} transition="van-scale" v-model:show={evaluatModel.shareMode}>
  581. <EvaluatShare onClose={() => (evaluatModel.shareMode = false)} />
  582. </Popup>
  583. </div>
  584. );
  585. },
  586. });