Browse Source

分数运算的小数点问题

Michael Wang 4 years ago
parent
commit
bf81a54041
1 changed files with 4 additions and 3 deletions
  1. 4 3
      src/features/mark/MarkBody.vue

+ 4 - 3
src/features/mark/MarkBody.vue

@@ -337,9 +337,10 @@ export default defineComponent({
       }
       }
       // 是否保留当前的轨迹分
       // 是否保留当前的轨迹分
       const ifKeepScore =
       const ifKeepScore =
-        store.currentQuestion.maxScore -
-        (store.currentQuestion.score || 0) -
-        store.currentScore * 2;
+        (store.currentQuestion.maxScore * 10 -
+          (store.currentQuestion.score || 0) * 10 -
+          store.currentScore * 2 * 10) /
+        10;
       if (
       if (
         (ifKeepScore < 0 && store.currentScore > 0) ||
         (ifKeepScore < 0 && store.currentScore > 0) ||
         (ifKeepScore * 10) % (store.currentQuestion.intervalScore * 10) !== 0
         (ifKeepScore * 10) % (store.currentQuestion.intervalScore * 10) !== 0