|
@@ -26,14 +26,17 @@ import icon_4_2 from "./image/icon_4_2.png";
|
|
|
import icon_3_0 from "./image/icon_3_0.png";
|
|
|
import icon_3_1 from "./image/icon_3_1.png";
|
|
|
import icon_3_2 from "./image/icon_3_2.png";
|
|
|
+import iconBack from "./image/icon-back.png";
|
|
|
import { evaluatingData } from "/src/view/evaluating";
|
|
|
import { IPostMessage } from "/src/utils/native-message";
|
|
|
import state from "/src/state";
|
|
|
|
|
|
export default defineComponent({
|
|
|
name: "delay-check",
|
|
|
- emits: ["close"],
|
|
|
+ emits: ["close", "back"],
|
|
|
setup(props, { emit }) {
|
|
|
+ // startTune定时器
|
|
|
+ let startTuneTimer: any = null
|
|
|
const anim = ref();
|
|
|
const data = reactive({
|
|
|
show: false,
|
|
@@ -54,27 +57,19 @@ export default defineComponent({
|
|
|
};
|
|
|
/** 持续检测耳机状态 */
|
|
|
const keepCheckEarphone = async () => {
|
|
|
- if (data.step >= 7) return;
|
|
|
+ if (data.step >= 7 || !data.show) return;
|
|
|
evaluatingData.earphone = await getEarphoneState();
|
|
|
+ // console.log('erji',evaluatingData.earphone,data.step)
|
|
|
if (evaluatingData.earphone) {
|
|
|
- if (data.step <= 5) {
|
|
|
- if (data.checkStatus === "ing") {
|
|
|
- data.count = 0;
|
|
|
- clearTimeout(data.startTimer);
|
|
|
- clearTimeout(data.stopTimer);
|
|
|
- toggleTune("stop");
|
|
|
- }
|
|
|
- data.step = 3;
|
|
|
- }
|
|
|
+ clearTimeout(data.startTimer);
|
|
|
+ clearTimeout(data.stopTimer);
|
|
|
+ clearTimeout(startTuneTimer);
|
|
|
+ data.checkStatus = "init"
|
|
|
+ data.step = 3
|
|
|
} else {
|
|
|
- if (data.step === 2 || data.step === 3) {
|
|
|
- data.step = 4;
|
|
|
- setTimeout(() => {
|
|
|
- data.step = 5;
|
|
|
- data.checkStatus = "ing";
|
|
|
- data.count = 0;
|
|
|
- toggleTune("start");
|
|
|
- }, 2000);
|
|
|
+ if (data.step === 3) {
|
|
|
+ data.step = 2
|
|
|
+ data.checkStatus = "init"
|
|
|
}
|
|
|
}
|
|
|
setTimeout(() => {
|
|
@@ -101,14 +96,36 @@ export default defineComponent({
|
|
|
onMounted(() => {
|
|
|
data.show = true;
|
|
|
sendResult(listenerResult);
|
|
|
+ keepCheckEarphone();
|
|
|
});
|
|
|
onUnmounted(() => {
|
|
|
+ data.show = false;
|
|
|
removeResult(listenerResult);
|
|
|
});
|
|
|
|
|
|
const handleStartTune = async () => {
|
|
|
- await keepCheckEarphone();
|
|
|
// data.step = evaluatingData.earphone ? 4 : 3;
|
|
|
+ if (evaluatingData.earphone) {
|
|
|
+ if (data.step <= 5) {
|
|
|
+ if (data.checkStatus === "ing") {
|
|
|
+ data.count = 0;
|
|
|
+ clearTimeout(data.startTimer);
|
|
|
+ clearTimeout(data.stopTimer);
|
|
|
+ toggleTune("stop");
|
|
|
+ }
|
|
|
+ data.step = 3;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (data.step === 2 || data.step === 3) {
|
|
|
+ data.step = 4;
|
|
|
+ startTuneTimer = setTimeout(() => {
|
|
|
+ data.step = 5;
|
|
|
+ data.checkStatus = "ing";
|
|
|
+ data.count = 0;
|
|
|
+ toggleTune("start");
|
|
|
+ }, 2000);
|
|
|
+ }
|
|
|
+ }
|
|
|
};
|
|
|
const hanldeEndTune = () => {
|
|
|
console.log('设置soundEffect')
|
|
@@ -138,6 +155,11 @@ export default defineComponent({
|
|
|
v-model:show={data.show}
|
|
|
>
|
|
|
<div class={styles.delayBox}>
|
|
|
+ {/*返回按钮*/}
|
|
|
+ <img class={styles.delayBackBtn} src={iconBack} onClick={() => {
|
|
|
+ clearTimeout(startTuneTimer)
|
|
|
+ emit("back")
|
|
|
+ }} />
|
|
|
<div class={[styles.item, data.step !== 7 && styles.show]}>
|
|
|
<Vue3Lottie animationData={bg}></Vue3Lottie>
|
|
|
</div>
|