|
@@ -1,7 +1,7 @@
|
|
|
import { Button, Popup } from "vant";
|
|
|
import styles from "./index.module.less";
|
|
|
import { defineComponent, onMounted, onUnmounted, reactive, ref } from "vue";
|
|
|
-import { api_toggleTune, getEarphone, removeResult, sendResult } from "/src/helpers/communication";
|
|
|
+import { api_toggleTune, getEarphone, removeResult, sendResult, addCheckPlayEnd, removeCheckPlayEnd } from "/src/helpers/communication";
|
|
|
import { Vue3Lottie } from "vue3-lottie";
|
|
|
import bg from "./json/bg.json";
|
|
|
import bg1 from "./json/bg1.json";
|
|
@@ -94,22 +94,30 @@ export default defineComponent({
|
|
|
toggleTune("start");
|
|
|
}, 100);
|
|
|
}
|
|
|
- // startTune效音通过返回后,调用endTune
|
|
|
- if (header?.commond === "result") {
|
|
|
- clearTimeout(data.startAbnormalTimer);
|
|
|
- data.startTuneResult = true
|
|
|
- toggleTune("stop");
|
|
|
- }
|
|
|
}
|
|
|
};
|
|
|
+
|
|
|
+ // 监听到校音音频播放完成
|
|
|
+ const checkAudioPlayEnd = (res?: IPostMessage) => {
|
|
|
+ console.log("🚀 ~ res:校音音频", res);
|
|
|
+ // startTune效音通过返回后,调用endTune
|
|
|
+ if (res) {
|
|
|
+ clearTimeout(data.startAbnormalTimer);
|
|
|
+ data.startTuneResult = true
|
|
|
+ toggleTune("stop");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
onMounted(() => {
|
|
|
data.show = true;
|
|
|
sendResult(listenerResult);
|
|
|
+ addCheckPlayEnd(checkAudioPlayEnd);
|
|
|
keepCheckEarphone();
|
|
|
});
|
|
|
onUnmounted(() => {
|
|
|
data.show = false;
|
|
|
removeResult(listenerResult);
|
|
|
+ removeCheckPlayEnd(checkAudioPlayEnd);
|
|
|
});
|
|
|
|
|
|
const handleStartTune = async () => {
|