Procházet zdrojové kódy

修复按名称排序的bug 复像这样的《侯卫东官场笔记2》003.wma 《侯卫东官场笔记2》001.wma 《侯卫东官场笔记2》016.wma 排序的bug

onecold před 1 rokem
rodič
revize
51c65b1e24

+ 11 - 4
entry/src/main/ets/common/util/Utility.ets

@@ -1235,14 +1235,21 @@ interface VideoNameParts {
   numeric: number;
 }
 
+// 提取文件名中的非数字和数字部分
 function extractParts(name: string): VideoNameParts {
-  const match = name.match(/^(\D*)(\d*)/);
+  // 使用正则表达式来捕获非数字部分和数字部分
+  const match = name.match(/^(.+?)(\d+)(\.\w+)?$/);
+  if (match) {
+    return {
+      nonNumeric: match[1],
+      numeric: parseInt(match[2], 10),
+    };
+  }
   return {
-    nonNumeric: match?.[1] || '',
-    numeric: parseInt(match?.[2] || '0', 10)
+    nonNumeric: name,
+    numeric: 0,
   };
 }
-
 function getInstallTime(): number | null {
   // 从本地存储中获取安装时间
   return PreferencesUtil.getNumberSync('installTime')

+ 0 - 1
entry/src/main/ets/pages/NewIndex.ets

@@ -666,7 +666,6 @@ struct NewIndex {
             }
           })
         }
-        .clickEffect({ level: ClickEffectLevel.HEAVY })
         .transition(TransitionEffect.move(TransitionEdge.BOTTOM)
           .animation({ duration: 600, curve: Curve.Ease, delay: 60 * index }))
         .width('90%')

+ 1 - 0
entry/src/main/ets/view/LocalMusic.ets

@@ -8192,6 +8192,7 @@ export struct LocalMusic {
             .borderRadius(12)
             .margin({ bottom: 6 })
           }
+          .clickEffect({ level: ClickEffectLevel.MIDDLE,scale:0.9 })
           .transition(TransitionEffect.move(TransitionEdge.BOTTOM).animation({ duration: 600, curve: Curve.Ease, delay: 60*index }))
           .backgroundColor(Color.Transparent)
           .onClick(() => {