Преглед на файлове

跳整动画效果
修复全选的bug

onecold преди 1 година
родител
ревизия
9cf34fb836
променени са 3 файла, в които са добавени 19 реда и са изтрити 11 реда
  1. 3 2
      entry/src/main/ets/pages/UserCenter.ets
  2. 13 6
      entry/src/main/ets/view/LocalMusic.ets
  3. 3 3
      lib/src/main/ets/view/LyricView2.ets

+ 3 - 2
entry/src/main/ets/pages/UserCenter.ets

@@ -442,14 +442,15 @@ export struct UserCenter {
       .padding({
         bottom: 45
       })
+      .transition(TransitionEffect.move(TransitionEdge.BOTTOM)
+        .animation({ duration: 380, curve: Curve.Ease,delay:50 }))
     }
     .backgroundColor($r('app.color.index_background'))
     .width('100%')
     .height('100%')
     .layoutWeight(1)
 
-    .transition(TransitionEffect.move(TransitionEdge.BOTTOM)
-      .animation({ duration: 380, curve: Curve.Ease,delay:50 }))
+
   }
 
   // 用户信息卡片

+ 13 - 6
entry/src/main/ets/view/LocalMusic.ets

@@ -2057,9 +2057,11 @@ export struct LocalMusic {
   // 处理文件选择的函数
   handleFileSelection(item: VideoItem, checked: boolean) {
     if (checked) {
-      this.selectedFiles.push(item);
+      if (!this.selectedFiles.some(x => x.filePath == item.filePath)) {
+        this.selectedFiles.push(item);
+      }
     } else {
-      const index = this.selectedFiles.indexOf(item);
+      const index = this.selectedFiles.findIndex(x => x.filePath == item.filePath);
       if (index > -1) {
         this.selectedFiles.splice(index, 1);
       }
@@ -3249,7 +3251,7 @@ export struct LocalMusic {
 
 
         Checkbox({ name: 'checkbox' + index })
-          .select(this.selectedFiles.some(x  => x.filePath  === item.filePath))
+          .select(this.selectedFiles.some(x  => x.filePath  == item.filePath))
           .selectedColor(this.themeColor)
           .shape(CheckBoxShape.CIRCLE)
           .opacity(this.isMultiSelect ? 1 : 0)
@@ -3269,7 +3271,8 @@ export struct LocalMusic {
     .height(this.getGridAllHeight())
     .onClick(() => {
       if(this.isMultiSelect&&item.type!==CommonConstants.TYPE_IS_DIR){
-        this.handleFileSelection(item, !this.selectedFiles.some(x  => x.filePath  === item.filePath))
+        const isChecked = this.selectedFiles.some(x => x.filePath == item.filePath);
+        this.handleFileSelection(item, !isChecked);
       }else{
         this.doPlay(item, index)
       }
@@ -3495,8 +3498,12 @@ export struct LocalMusic {
             && item.type !== CommonConstants.TYPE_IS_CSJAD &&
             !this.isHistory) ? { end: this.DeleteButton(item, index, item.filePath) } : {}) //左滑
         .onClick(() => {
-
-          this.doPlay(item, index)
+          if(this.isMultiSelect&&item.type!==CommonConstants.TYPE_IS_DIR){
+            const isChecked = this.selectedFiles.some(x => x.filePath == item.filePath);
+            this.handleFileSelection(item, !isChecked);
+          }else{
+            this.doPlay(item, index)
+          }
 
         })
 

+ 3 - 3
lib/src/main/ets/view/LyricView2.ets

@@ -206,10 +206,10 @@ export struct LyricView2 {
 
                 }
                 .padding(8)
-                // .transition(TransitionEffect.asymmetric(TransitionEffect.scale({ x: 1.2, y: 1.2 }).animation({ duration: 500 }),
-                //     TransitionEffect.scale({ x: 0, y: 0 })  ))
-                .transition(TransitionEffect.asymmetric(TransitionEffect.move(TransitionEdge.BOTTOM).animation({ duration: 500,curve: Curve.Ease, delay: 100*index  }),
+                .transition(TransitionEffect.asymmetric(TransitionEffect.scale({ x: 1.2, y: 1.2 }).animation({ duration: 500 }),
                     TransitionEffect.scale({ x: 0, y: 0 })  ))
+                // .transition(TransitionEffect.asymmetric(TransitionEffect.move(TransitionEdge.BOTTOM).animation({ duration: 500,curve: Curve.Ease, delay: 100*index  }),
+                //     TransitionEffect.scale({ x: 0, y: 0 })  ))
                 .border({ radius: 4 })
                 .backgroundColor(this.seekUIStyle == 'listItem' && index == this.seekIndex && item.text.length > 0
                     && this.enableSeek && this.isUserTouching ? '#80a9a9a9' : '#00000000')