|
@@ -8,6 +8,7 @@ import { metronomeData } from "../../../helpers/metronome";
|
|
|
import { getQuery } from "/src/utils/queryString";
|
|
|
import { api_createMusicPlayer, api_updateMusicPlayer, api_checkSocketStatus } from "/src/helpers/communication";
|
|
|
import { storeData } from "/src/store";
|
|
|
+import { data as workData } from "/src/page-instrument/custom-plugins/work-index";
|
|
|
|
|
|
export default defineComponent({
|
|
|
name: "speed",
|
|
@@ -62,7 +63,9 @@ export default defineComponent({
|
|
|
const toggleSwitch = async (res: any) => {
|
|
|
switchLoading.value = true;
|
|
|
try {
|
|
|
- if (storeData.isApp) {
|
|
|
+ if (storeData.isApp && state.enableEvaluation) {
|
|
|
+ // 加载弹窗的开始时间
|
|
|
+ let startTime = +new Date();
|
|
|
state.loadingText = '节拍器准备中,请稍等…'
|
|
|
state.isLoading = true;
|
|
|
const targetSrc = res ? state.beatSong.accompany || state.beatSong.music : state.accompany || state.music;
|
|
@@ -73,9 +76,21 @@ export default defineComponent({
|
|
|
})
|
|
|
// console.log('切换节拍器音频',resData)
|
|
|
if (resData?.content) {
|
|
|
- state.isLoading = false;
|
|
|
- metronomeDisable.value = res;
|
|
|
- switchLoading.value = false;
|
|
|
+ // 返回结果的时间
|
|
|
+ let intervalTime = +new Date() - startTime;
|
|
|
+ // 超过1秒直接关闭加载弹窗,小于1秒则最短显示1秒加载弹窗
|
|
|
+ if (intervalTime >= 1000) {
|
|
|
+ state.isLoading = false;
|
|
|
+ metronomeDisable.value = res;
|
|
|
+ switchLoading.value = false;
|
|
|
+ } else {
|
|
|
+ const continueTime = 1000 - intervalTime;
|
|
|
+ setTimeout(() => {
|
|
|
+ state.isLoading = false;
|
|
|
+ metronomeDisable.value = res;
|
|
|
+ switchLoading.value = false;
|
|
|
+ }, continueTime);
|
|
|
+ }
|
|
|
}
|
|
|
// api_checkSocketStatus();
|
|
|
} else {
|
|
@@ -98,7 +113,7 @@ export default defineComponent({
|
|
|
<div class={styles.content}>
|
|
|
<div class={styles.conBox}>
|
|
|
<div class={styles.tit}>速度</div>
|
|
|
- <div class={[styles.spendCon, query.workRecord && styles.disableSpend]}>
|
|
|
+ <div class={[styles.spendCon, workData.trainingType === "PRACTICE" && styles.disableSpend]}>
|
|
|
<img src={headImg("cutImg.png")} class={[styles.btn]} onClick={minusSpeed} />
|
|
|
<div class={styles.sliderCon}>
|
|
|
<Slider class={styles.slider} max={270} min={speed.value < 45 ? speed.value : 45} v-model={speed.value}>
|
|
@@ -113,7 +128,7 @@ export default defineComponent({
|
|
|
</div>
|
|
|
<img src={headImg("addImg.png")} class={[styles.btn]} onClick={plusSpeed} />
|
|
|
</div>
|
|
|
- <div class={[styles.speedSel, query.workRecord && styles.disableSpend]}>
|
|
|
+ <div class={[styles.speedSel, workData.trainingType === "PRACTICE" && styles.disableSpend]}>
|
|
|
<div onClick={resetCurrentSpeed}>原速</div>
|
|
|
<div onClick={()=>{ speed.value = 70 }}>70</div>
|
|
|
<div onClick={()=>{ speed.value = 80 }}>80</div>
|