Pārlūkot izejas kodu

Revert "修改"

This reverts commit 5ebcd8126470aa8e7071b87b1c45ef11ffbb402c.
lex 1 gadu atpakaļ
vecāks
revīzija
675625ff11

+ 1 - 1
src/views/tempo-practice/beat-tick.ts

@@ -85,7 +85,7 @@ export const handleStartBeat = async () => {
       const part = setting.scorePart[i][j];
       const params = {
         ...part,
-        ...beatDesc[part.index]
+        ...beatDesc[part.index + 1]
       };
       // console.log(params);
       const single16th = beatData.beatLengthInMilliseconds;

+ 5 - 4
src/views/tempo-practice/index.tsx

@@ -154,10 +154,12 @@ export default defineComponent({
                             return;
                           }
                           // const obj = randomScoreElement(child.index);
-                          const obj = elementDirection('up', Number(child.key));
+                          const obj = elementDirection(
+                            'up',
+                            Number(child.index)
+                          );
                           child.index = obj.index;
                           child.url = obj.url;
-                          child.key = obj.key;
                         }}></div>
                       <div
                         class={styles.down}
@@ -170,11 +172,10 @@ export default defineComponent({
                           // const obj = randomScoreElement(child.index);
                           const obj = elementDirection(
                             'down',
-                            Number(child.key)
+                            Number(child.index)
                           );
                           child.index = obj.index;
                           child.url = obj.url;
-                          child.key = obj.key;
                         }}></div>
                     </div>
                     <div class={styles.imgSection}>

+ 5 - 9
src/views/tempo-practice/setting.ts

@@ -60,24 +60,21 @@ export const randomScoreElement = (element?: string) => {
     const randomIndex = Math.floor(Math.random() * newArr.length);
     return {
       url: prefix + newArr[randomIndex] + '.png',
-      index: newArr[randomIndex],
-      key: randomIndex
+      index: randomIndex
     };
   } else {
     // 如果只有一个就直接返回
     if (tempoList.length === 1) {
       return {
         url: prefix + tempoList[0] + '.png',
-        index: tempoList[0],
-        key: 0
+        index: 0
       };
     } else {
       const randomIndex = Math.floor(Math.random() * tempoList.length);
       const randomItem = tempoList[randomIndex];
       return {
         url: prefix + randomItem + '.png',
-        index: randomItem,
-        key: randomIndex
+        index: randomIndex
       };
     }
   }
@@ -107,11 +104,10 @@ export const elementDirection = (type: string, index: number) => {
     }
   }
 
-  // console.log(ele, Number(index), type, i);
+  console.log(ele, Number(index), type, i);
   return {
     url: prefix + ele + '.png',
-    index: Number(ele),
-    key: Number(i)
+    index: Number(i)
   };
 };