mo 1 year ago
parent
commit
b39b03d792
2 changed files with 25 additions and 8 deletions
  1. 23 6
      src/components/timerMeter/components/countdown.tsx
  2. 2 2
      vite.config.ts

+ 23 - 6
src/components/timerMeter/components/countdown.tsx

@@ -167,6 +167,8 @@ export default defineComponent({
           init();
         },600)
       }else {
+        // isPlaying.value = false
+        count.value = 0;
         init();
       }
 
@@ -209,11 +211,19 @@ export default defineComponent({
       second.value = Math.floor(count.value % 60);
     };
 
-    const updateMin = () => {
-
-        console.log(mine.value, count.value);
+    const updateMin = (e:any) => {
+      let targetCount =parseInt(e.target.value);
+      if(Number.isNaN(targetCount) ){
+        targetCount = 0
+      }
+      if(targetCount > 59){
+        targetCount = 59
+      }
+      mine.value = targetCount
         const lastStr = getSecond(count.value);
+        console.log( mine.value);
         count.value = mine.value * 60 + second.value;
+
         const str = getSecond(count.value);
         console.log(str, lastStr);
         for (let i = 0; i < flipObjs.value.length; i++) {
@@ -223,8 +233,15 @@ export default defineComponent({
           flipObjs.value[i].value.flipUp(lastStr[i], str[i]);
         }
     };
-    const updateSecond = () => {
-        console.log(mine.value);
+    const updateSecond = (e:any) => {
+      let targetCount =parseInt(e.target.value);
+      if(Number.isNaN(targetCount) ){
+        targetCount = 0
+      }
+      if(targetCount > 59){
+        targetCount = 59
+      }
+      second.value = targetCount
         const lastStr = getSecond(count.value);
         count.value = mine.value * 60 + second.value;
         const str = getSecond(count.value);
@@ -353,7 +370,7 @@ export default defineComponent({
             <NButton
               round
               type="primary"
-              disabled={count.value === 0}
+              disabled={count.value == 0}
               icon-placement="right"
               onClick={() => startTimer()}
               v-slots={{

+ 2 - 2
vite.config.ts

@@ -23,8 +23,8 @@ function resolve(dir: string) {
 }
 // https://vitejs.dev/config/
 // https://github.com/vitejs/vite/issues/1930 .env
-// const proxyUrl = 'https://dev.kt.colexiu.com/';
-const proxyUrl = 'https://test.lexiaoya.cn';
+const proxyUrl = 'https://dev.kt.colexiu.com/';
+// const proxyUrl = 'https://test.lexiaoya.cn';
 export default defineConfig({
   base: './',
   plugins: [