Browse Source

修复倒计时 禁止输入 加上工具兼容

黄琪勇 11 months ago
parent
commit
cf13ab3d8b

+ 1 - 1
dev-dist/sw.js

@@ -82,7 +82,7 @@ define(['./workbox-5357ef54'], (function (workbox) { 'use strict';
     "revision": "3ca0b8505b4bec776b69afdba2768812"
   }, {
     "url": "index.html",
-    "revision": "0.ebto14d5ab8"
+    "revision": "0.tepotf17th8"
   }], {});
   workbox.cleanupOutdatedCaches();
   workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {

+ 1 - 1
public/version.json

@@ -1 +1 @@
-{"version":1715344402195}
+{"version":1715581675172}

+ 7 - 0
src/components/Metronome/Metronome.vue

@@ -44,6 +44,7 @@
           <div class="optMid">
             <img class="optImg" src="./imgs/yin.png" />
             <n-input-number
+              :disabled="true"
               placeholder=""
               :value="speedNum"
               :show-button="false"
@@ -504,6 +505,12 @@ defineExpose({
               font-size: 45Px !important;
               color: #000000 !important;
             }
+            &.n-input--disabled {
+              cursor: initial;
+              .n-input__input-el {
+                cursor: initial;
+              }
+            }
           }
         }
       }

+ 4 - 0
src/components/layout/index.tsx

@@ -689,6 +689,10 @@ export default defineComponent({
                 style={{
                   display: !studyData.homeStatus ? 'none' : 'block'
                 }}
+                //兼容触摸屏
+                onTouchstart={() => {
+                  NPopoverRef?.value.setShow(true);
+                }}
                 class={[
                   styles.toolboxImg,
                   'moveNPopover',

+ 10 - 6
src/components/timerMeter/TimerMeter.vue

@@ -17,7 +17,7 @@
           </div>
           <div class="timeInputBox">
             <n-input-number
-              :disabled="timeType === 'countup' || playState === 'play'"
+              :disabled="true"
               placeholder=""
               :value="mmValue"
               :format="(value: number | null)=>{
@@ -65,7 +65,7 @@
           </div>
           <div class="timeInputBox">
             <n-input-number
-              :disabled="timeType === 'countup' || playState === 'play'"
+              :disabled="true"
               placeholder=""
               :value="ssValue"
               :format="(value: number | null)=>{
@@ -232,18 +232,22 @@ function handlePause() {
 let _time: NodeJS.Timer;
 // 倒计时
 function handleCountdownStart() {
+  // 由于时间结束之后还会有尾音,所以开始时候可能音乐在播放,所以这里先暂停
+  soundVIdeo.pause();
   soundVIdeo.currentTime = 0;
-  if (timeNum.value <= 4) {
-    soundVIdeo.currentTime = 4 - timeNum.value;
+  if (timeNum.value <= 3) {
+    soundVIdeo.currentTime = 3 - timeNum.value;
     soundVIdeo.play();
   }
   _time = setInterval(() => {
     timeNum.value--;
-    if (timeNum.value === 4) {
+    if (timeNum.value === 3) {
       soundVIdeo.play();
     }
     if (timeNum.value <= 0) {
-      handlePause();
+      // 结束的时候音乐不暂停
+      clearInterval(_time);
+      playState.value = 'pause';
     }
   }, 1000);
 }