|
@@ -10,7 +10,18 @@ import { getNoteByMeasuresSlursStart } from "/src/helpers/formateMusic";
|
|
|
import { Icon, Popup, showToast, closeToast, showLoadingToast } from "vant";
|
|
|
import EvaluatResult from "./evaluat-result";
|
|
|
import EvaluatAudio from "./evaluat-audio";
|
|
|
-import { api_getDeviceDelay, api_openAdjustRecording, api_proxyServiceMessage, api_videoUpdate, getEarphone, api_back, api_startDelayCheck } from "/src/helpers/communication";
|
|
|
+import {
|
|
|
+ api_getDeviceDelay,
|
|
|
+ api_openAdjustRecording,
|
|
|
+ api_proxyServiceMessage,
|
|
|
+ api_videoUpdate,
|
|
|
+ getEarphone,
|
|
|
+ api_back,
|
|
|
+ api_startDelayCheck,
|
|
|
+ api_cancelDelayCheck,
|
|
|
+ api_closeDelayCheck,
|
|
|
+ api_finishDelayCheck
|
|
|
+ } from "/src/helpers/communication";
|
|
|
import EvaluatShare from "./evaluat-share";
|
|
|
import { Vue3Lottie } from "vue3-lottie";
|
|
|
import startData from "./data/start.json";
|
|
@@ -23,6 +34,7 @@ import { api_musicPracticeRecordVideoUpload } from "../api";
|
|
|
import { headTopData } from "../header-top/index";
|
|
|
import { getQuery } from "/src/utils/queryString";
|
|
|
import Countdown from "./countdown"
|
|
|
+import { IPostMessage } from "/src/utils/native-message";
|
|
|
|
|
|
const DelayCheck = defineAsyncComponent(() =>
|
|
|
import('./delay-check')
|
|
@@ -123,6 +135,25 @@ export default defineComponent({
|
|
|
return criteria;
|
|
|
};
|
|
|
|
|
|
+ /** 校验耳机状态 */
|
|
|
+ const checkEarphoneStatus = async (type?: string) => {
|
|
|
+ if (type !== 'start') {
|
|
|
+ // const erji = await checkUseEarphone();
|
|
|
+ const res = await getEarphone();
|
|
|
+ const erji = res?.content?.checkIsWired || false;
|
|
|
+ console.log('耳机状态111',res)
|
|
|
+ evaluatingData.earphoneMode = true;
|
|
|
+ evaluatingData.earPhoneType = res?.content?.type || "";
|
|
|
+ if (evaluatingData.earPhoneType === "有线耳机") {
|
|
|
+ setTimeout(() => {
|
|
|
+ evaluatingData.earphoneMode = false;
|
|
|
+ }, 3000);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log("检测结束,生成数据",evaluatingData.websocketState , evaluatingData.startBegin , evaluatingData.checkEnd);
|
|
|
+ handleConnect();
|
|
|
+ }
|
|
|
+
|
|
|
/** 生成评测曲谱数据 */
|
|
|
const formatTimes = () => {
|
|
|
let starTime = 0
|
|
@@ -362,13 +393,38 @@ export default defineComponent({
|
|
|
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ // 监听到APP取消延迟检测
|
|
|
+ const handleCancelDelayCheck = async (res?: IPostMessage) => {
|
|
|
+ console.log('监听取消延迟检测', res)
|
|
|
+ if (res?.content) {
|
|
|
+ // 关闭延迟检测页面,并返回到模式选择页面
|
|
|
+ // await api_closeDelayCheck({});
|
|
|
+ handleDelayBack()
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ // 监听APP延迟成功的回调
|
|
|
+ const handleFinishDelayCheck = async (res?: IPostMessage) => {
|
|
|
+ console.log('监听延迟检测成功', res)
|
|
|
+ if (res?.content) {
|
|
|
+ evaluatingData.checkEnd = true
|
|
|
+ checkEarphoneStatus()
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
onMounted(async () => {
|
|
|
// 如果打开了延迟检测开关,需要先发送开始检测的消息
|
|
|
if (state.setting.soundEffect) {
|
|
|
await api_startDelayCheck({});
|
|
|
+ } else {
|
|
|
+ evaluatingData.checkEnd = true
|
|
|
+ checkEarphoneStatus()
|
|
|
}
|
|
|
evaluatingData.isDisabledPlayMusic = true;
|
|
|
- handlePerformDetection();
|
|
|
+ // handlePerformDetection();
|
|
|
+ api_cancelDelayCheck(handleCancelDelayCheck);
|
|
|
+ api_finishDelayCheck(handleFinishDelayCheck);
|
|
|
});
|
|
|
return () => (
|
|
|
<div>
|
|
@@ -402,9 +458,11 @@ export default defineComponent({
|
|
|
|
|
|
<Popup teleport="body" closeOnClickOverlay={false} class={["popup-custom", "van-scale"]} transition="van-scale" v-model:show={evaluatingData.earphoneMode}>
|
|
|
<Earphone
|
|
|
+ earphoneType={evaluatingData.earPhoneType}
|
|
|
onClose={() => {
|
|
|
evaluatingData.earphoneMode = false;
|
|
|
- handlePerformDetection();
|
|
|
+ // handlePerformDetection();
|
|
|
+ checkEarphoneStatus('start');
|
|
|
}}
|
|
|
/>
|
|
|
</Popup>
|