Răsfoiți Sursa

grid点击item进去也有封面header

onecold 1 an în urmă
părinte
comite
820614f52a

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

@@ -391,10 +391,10 @@ struct NewIndex {
               .textAlign(TextAlign.Center)
               .fontWeight(FontWeight.Bolder)
               .fontColor(Color.White)
-              .visibility(Utility.isNoble()?Visibility.Visible:Visibility.None)
           }
           .width(28)
           .height(16)
+          .visibility(Utility.isNoble()?Visibility.Visible:Visibility.None)
           .borderRadius(15)
           .backgroundColor(this.themeColor)
         }

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

@@ -481,10 +481,10 @@ export struct UserCenter {
               .textAlign(TextAlign.Center)
               .fontWeight(FontWeight.Bolder)
               .fontColor(Color.White)
-              .visibility(Utility.isNoble()?Visibility.Visible:Visibility.None)
           }
           .width(28)
           .height(16)
+          .visibility(Utility.isNoble()?Visibility.Visible:Visibility.None)
           .borderRadius(15)
           .backgroundColor(this.themeColor)
         }
@@ -897,7 +897,7 @@ export struct UserCenter {
       Button(this.isVip ? '升级会员' : '立即开通')
         .borderRadius(24)
         .backgroundColor(this.isDarkMode ? $r('app.color.user_center_button_background') : this.themeColor)
-        .width(this.currentBreakpoint !== BreakpointTypeEnum.SM ? '25%' : '60%')
+        .width(200)
         .fontColor(Color.White)
         .fontSize(18)
         .padding(12)

+ 70 - 49
entry/src/main/ets/view/LocalMusic.ets

@@ -2006,18 +2006,18 @@ export struct LocalMusic {
               }
 
               if(this.isGridMusic){
-                if(this.isShowCoverHeader()){
-                  Scroll(){
-                    Column(){
-                      this.coverHeader()
-                      this.getGridView()
-                    }
-
-                  }
-                  // .height(px2vp(DisplayUtil.getHeight()-AppUtil.getStatusBarHeight()-AppUtil.getNavigationIndicatorHeight()))
-                }else{
+                // if(this.isShowCoverHeader()){
+                //   Scroll(){
+                //     Column(){
+                //       this.coverHeader()
+                //       this.getGridView()
+                //     }
+                //
+                //   }
+                //
+                // }else{
                   this.getGridView()
-                }
+                // }
 
               }else {
                 this.getListView()
@@ -2068,7 +2068,7 @@ export struct LocalMusic {
               .height(60)
               .margin({ top: 10, bottom: 10, right: 6 })
               .backgroundColor(this.themeColor)
-              .clickEffect({level:ClickEffectLevel.HEAVY})
+              .clickEffect({level:ClickEffectLevel.MIDDLE, scale: 0.5})
               .onClick(() => {
                 if (this.isAllSelected) {
                   // 全不选
@@ -2084,7 +2084,7 @@ export struct LocalMusic {
               .height(60)
               .id('music_cut')
               .margin({ top: 10, bottom: 10, right: 6 })
-              .clickEffect({level:ClickEffectLevel.HEAVY})
+              .clickEffect({level:ClickEffectLevel.MIDDLE, scale: 0.5})
               .backgroundColor(this.themeColor)
               .onClick(() => {
                 this.showCutDialogForMultipleFiles(false, 'music_cut')
@@ -2097,7 +2097,7 @@ export struct LocalMusic {
               .visibility(this.isHasDir ? Visibility.Visible : Visibility.None)
               .margin({ top: 10, bottom: 10, right: 6 })
               .backgroundColor(this.themeColor)
-              .clickEffect({level:ClickEffectLevel.HEAVY})
+              .clickEffect({level:ClickEffectLevel.MIDDLE, scale: 0.5})
               .onClick(() => {
 
                 this.showCutDialogForMultipleFiles(true, 'music_cut_current')
@@ -2108,7 +2108,7 @@ export struct LocalMusic {
               .id('music_copy_current')// .visibility(this.isHasDir?Visibility.None:Visibility.None)
               .margin({ top: 10, bottom: 10, right: 6 })
               .backgroundColor(this.themeColor)
-              .clickEffect({level:ClickEffectLevel.HEAVY})
+              .clickEffect({level:ClickEffectLevel.MIDDLE, scale: 0.5})
               .onClick(() => {
                 this.showCopyDialogForMultipleFiles(false, 'music_copy_current')
               })
@@ -2119,7 +2119,7 @@ export struct LocalMusic {
               .margin({ top: 10, bottom: 10, right: 6 })
               .visibility(this.isFavMusic?Visibility.None:Visibility.Visible)
               .backgroundColor(this.themeColor)
-              .clickEffect({level:ClickEffectLevel.HEAVY})
+              .clickEffect({level:ClickEffectLevel.MIDDLE, scale: 0.5})
               .onClick(() => {
                 this.showWarnIsDelete()
               })
@@ -2128,7 +2128,7 @@ export struct LocalMusic {
               .height(60)
               .margin({ top: 10, bottom: 10, right: 6 })
               .backgroundColor(this.themeColor)
-              .clickEffect({level:ClickEffectLevel.HEAVY})
+              .clickEffect({level:ClickEffectLevel.MIDDLE, scale: 0.5})
               .onClick(() => {
                 this.selectedFiles = [];
                 this.isAllSelected = false
@@ -2794,6 +2794,7 @@ export struct LocalMusic {
           .margin({left:20})
         }
 
+
         this.listViewTitle()
 
       }
@@ -2806,16 +2807,10 @@ export struct LocalMusic {
       .padding({top:this.topRectHeight ,bottom:this.bottomBarHeight+48  })
       .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP])
       .justifyContent(FlexAlign.SpaceBetween)
-      // .transition({ type: TransitionType.Insert, translate: { x: -DisplayUtil.getWidth(), y: 0 } })
-      // .transition({ type: TransitionType.Delete, translate: { x: -DisplayUtil.getWidth(), y: 0 } })
-      // .transition(TransitionEffect.scale({ x: 1.2, y: 1.2 }).animation({ duration: 500 }))
       .transition(TransitionEffect.asymmetric(TransitionEffect.scale({ x: 0.7, y: 0.7}).animation({ duration: 500 }),
         TransitionEffect.scale({ x: 0, y: 0 })  ))
       .clickEffect({level:ClickEffectLevel.LIGHT})
-      // .animation({
-      //   duration: 666,
-      //   curve: 'ease-in-out' // 可选动画曲线
-      // })
+
     }
 
   }
@@ -3257,17 +3252,31 @@ export struct LocalMusic {
   @State endIndex:number = 0
   @State scaleValue:number = 1
   @State pinchValue:number = 1
+  layoutOptionsForHeader: GridLayoutOptions = {
+    regularSize: [1, 1],        // 只支持[1, 1]
+    irregularIndexes: [0],   // 索引为0和6的GridItem占用一行
+  };
+  layoutOptions: GridLayoutOptions = {
+    regularSize: [1, 1],        // 只支持[1, 1]
+  };
   @Builder
   getGridView(){
 
-    Grid(this.scroller) {
+    Grid(this.scroller,this.isShowCoverHeader()?this.layoutOptionsForHeader:this.layoutOptions) {
+      if(this.isShowCoverHeader()){
+        GridItem(){
+          this.coverHeader()
+        }
+
+      }
       LazyForEach(this.dataSource, (item: VideoItem, index: number) => {
+
         GridItem() {
           Stack({ alignContent: Alignment.Center }) {
             this.MusicItemGrid(item,index)
           }
         }
-        // .transition(TransitionEffect.scale({ x: 0.8, y: 0.8 }).animation({ duration: 500 }))
+
         .transition(TransitionEffect.asymmetric(TransitionEffect.scale({ x: 0.8, y: 0.8 }).animation({ duration: 500 }),
           TransitionEffect.scale({ x: 0, y: 0 })  ))
         .clickEffect({level:ClickEffectLevel.LIGHT})
@@ -3338,9 +3347,10 @@ export struct LocalMusic {
         )
         // [End gesture_start]
         // [EndExclude GridItem_start]
+
       }, (item: VideoItem) => item.filePath)
     }
-    .width('94%')
+    .width('100%')
     .height('100%')
     .editMode(true)
     .transition(TransitionEffect.move(TransitionEdge.BOTTOM)
@@ -3353,7 +3363,9 @@ export struct LocalMusic {
     .supportAnimation(true)
     .cachedCount(3)
     // .columnsTemplate('1fr '.repeat(this.currentWidthBreakpoint === WidthBreakpoint.WIDTH_SM ? 2 : 5))
-    .columnsTemplate(this.twoFingerType==3?'repeat(auto-fit, 160)':this.twoFingerType==2?'repeat(auto-fit, 110)':'repeat(auto-fit, 80)')
+    .columnsTemplate(
+      this.twoFingerType==3?'repeat(auto-fit, 160)':this.twoFingerType==2?'repeat(auto-fit, 110)':'repeat(auto-fit, 80)'
+    )
     .rowsGap(this.isShowDrawer?25:(this.twoFingerType==3?10:this.twoFingerType==2?5:1))
     .visibility(this.isGridMusic?Visibility.Visible:Visibility.None)
     .scale({x:this.scaleValue,y:this.scaleValue,z:1})
@@ -4079,16 +4091,18 @@ export struct LocalMusic {
           this.currentPath = item.filePath
           this.currentTitleCover = $r('app.media.ic_avatar5')
           this.getSortedFiles(this.currentPath)
+          if (this.isGridMusic) {
+            this.scroller.scrollToIndex(0)
+          }
+          // this.listScroller.scrollToIndex(0)
           //进入歌单的时候的滚动位置在顶部
           setTimeout(() => {
             if(this.modeType ==0){
-              if (this.isGridMusic) {
-                this.scroller.scrollTo({ xOffset: 0, yOffset: 0 })
-              } else {
-                this.listScroller.scrollTo({ xOffset: 0, yOffset: 0 })
+              if (!this.isGridMusic) {
+                this.listScroller.scrollToIndex(0)
               }
             }
-          }, 300)
+          }, 200)
         }
 
         break;
@@ -4228,6 +4242,7 @@ export struct LocalMusic {
           .margin({ right: 22 })
         }
         .layoutWeight(1)
+        .clickEffect({level:ClickEffectLevel.MIDDLE, scale: 0.5})
         .onClick(() => {
 
           if (ArrayUtil.isNotEmpty(this.songList)) {
@@ -4244,7 +4259,7 @@ export struct LocalMusic {
           Image($r('app.media.hm_previous'))
             .height(24)
             .width(24)
-            .clickEffect({level:ClickEffectLevel.HEAVY})
+            .clickEffect({level:ClickEffectLevel.MIDDLE, scale: 0.5})
             .margin({ left: 8, right: 16 })
             .fillColor(this.themeColor)
             .displayPriority(2)
@@ -4272,7 +4287,7 @@ export struct LocalMusic {
               .height(32)
               .width(32)
               .displayPriority(3)
-              .clickEffect({level:ClickEffectLevel.HEAVY})
+              .clickEffect({level:ClickEffectLevel.MIDDLE, scale: 0.5})
               .fillColor(this.themeColor)
               .onClick(() => {
                 if (ArrayUtil.isNotEmpty(this.songList)) {
@@ -4292,7 +4307,7 @@ export struct LocalMusic {
               left: 16
             })
             .fillColor(this.themeColor)
-            .clickEffect({level:ClickEffectLevel.HEAVY})
+            .clickEffect({level:ClickEffectLevel.MIDDLE, scale: 0.5})
             .displayPriority(2)
             .onClick(() => {
               if (ArrayUtil.isNotEmpty(this.songList)) {
@@ -4307,7 +4322,7 @@ export struct LocalMusic {
             .height(24)
             .width(24)
             .displayPriority(1)
-            .clickEffect({level:ClickEffectLevel.HEAVY})
+            .clickEffect({level:ClickEffectLevel.MIDDLE, scale: 0.5})
             .fillColor(this.themeColor)
             .bindSheet($$this.isShowSheet, this.PlayListSheet(), {
               height: '95%',
@@ -4952,7 +4967,7 @@ export struct LocalMusic {
         "定时关闭未开启")
         .fontSize(17)
         .fontColor($r('app.color.text_color'))
-        .margin({ top: 2 });
+        .margin({ top: 2,bottom:8 });
 
       Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start }) {
         ForEach(this.presetTimes, (minutes: number, index: number) => {
@@ -5004,17 +5019,18 @@ export struct LocalMusic {
             .alignItems(VerticalAlign.Center)
           }
           .width('100%')
-          .padding(10)
+          .padding({ top:18,bottom:18,left:18,right:18 })
           .backgroundColor(minutes === this.selectedMinutes ?$r('app.color.timeColor_bg') :$r('app.color.bottom_control_background')) // 选中背景高亮
           .borderRadius(12)
-          .margin({ bottom: 6 })
+          .clickEffect({level:ClickEffectLevel.LIGHT, scale: 0.5})
+          .margin({ bottom: 18 })
           .onClick(() => this.handleSelect(minutes)); // 点击整行触发选择
         });
       }
       .width('100%')
       .padding(16)
     }
-    .margin({bottom:18})
+
   }
 
   // 获取显示文本
@@ -6350,7 +6366,7 @@ export struct LocalMusic {
           .width(28)
           .aspectRatio(CommonConstants.ASPECT_RATIO)
           .margin({ right: 30 })
-          .clickEffect({level:ClickEffectLevel.HEAVY})
+          .clickEffect({level:ClickEffectLevel.LIGHT, scale: 0.5})
           .onClick(() => {
 
             this.isLyricSetting = !this.isLyricSetting;
@@ -6487,7 +6503,7 @@ export struct LocalMusic {
               backgroundColor: Color.Transparent,
             })
         }
-
+        .clickEffect({level:ClickEffectLevel.LIGHT, scale: 0.5})
         .backgroundColor(Color.Transparent)
         .onClick(() => {
           this.isShowMoreView = !this.isShowMoreView;
@@ -6498,10 +6514,11 @@ export struct LocalMusic {
             .width(33)
             .clickEffect({level:ClickEffectLevel.HEAVY})
             .aspectRatio(CommonConstants.ASPECT_RATIO)
-            .onClick(async () => {
-              this.playPrevious()
-            })
         }
+        .onClick(async () => {
+          this.playPrevious()
+        })
+        .clickEffect({level:ClickEffectLevel.LIGHT, scale: 0.5})
         .backgroundColor(Color.Transparent)
         .margin({ left: 5 })
 
@@ -6514,7 +6531,7 @@ export struct LocalMusic {
             (this.isCircleBtn?$r('app.media.hm_pause'):$r('app.media.ic_public_play'))
             : (this.isCircleBtn?$r('app.media.hm_play2'):$r('app.media.ic_public_pause')))
             .width(this.isPhoneLan()?48:60)
-            .clickEffect({level:ClickEffectLevel.HEAVY})
+            .clickEffect({level:ClickEffectLevel.LIGHT, scale: 0.5})
             .fillColor(Color.White)
             .aspectRatio(CommonConstants.ASPECT_RATIO)
             .onClick(async () => {
@@ -6534,7 +6551,7 @@ export struct LocalMusic {
         Button({ type: ButtonType.Capsule, stateEffect: true }) {
           Image($r('app.media.ic_next'))
             .width(33)
-            .clickEffect({level:ClickEffectLevel.HEAVY})
+            .clickEffect({level:ClickEffectLevel.LIGHT, scale: 0.5})
             .aspectRatio(CommonConstants.ASPECT_RATIO)
             .onClick(() => {
 
@@ -6553,6 +6570,7 @@ export struct LocalMusic {
             .width(24)
             .clickEffect({level:ClickEffectLevel.MIDDLE})
             .aspectRatio(CommonConstants.ASPECT_RATIO)
+            .clickEffect({level:ClickEffectLevel.LIGHT, scale: 0.5})
             .onClick(async () => {
               if(this.currentSong){
                 this.doFav(this.currentSong)
@@ -6603,6 +6621,7 @@ export struct LocalMusic {
       })
       .backgroundColor(Color.Transparent)
       .margin({ left:10,right:10 })
+      .clickEffect({level:ClickEffectLevel.LIGHT, scale: 0.5})
       .onClick(async () => {
         this.setLoopMode()
 
@@ -6677,6 +6696,7 @@ export struct LocalMusic {
       })
       .backgroundColor(Color.Transparent)
       .margin({ right: 10, left: 20 })
+      .clickEffect({level:ClickEffectLevel.LIGHT, scale: 0.5})
       .onClick(() => {
         this.isShowSheetView = !this.isShowSheetView;
         this.isFrontWhite = true
@@ -6925,6 +6945,7 @@ export struct LocalMusic {
 
       }
       .layoutWeight(1)
+      .clickEffect({level:ClickEffectLevel.LIGHT, scale: 0.5})
       .visibility(this.isHide ? Visibility.Hidden : Visibility.Visible)
       .onClick(() => {
 
@@ -7970,7 +7991,7 @@ export struct LocalMusic {
                     this.doMore(more.id)
                   })
                   .bindSheet($$this.isShowTimeCloseMore, this.TimeCloseSheet(), {
-                    height: this.isCoverOpacity() ? '95%' : '78%',
+                    height: this.isCoverOpacity() ? '95%' : '95%',
                     preferType: this.currentBreakpoint!==BreakpointTypeEnum.SM?SheetType.CENTER:SheetType.BOTTOM,
                     dragBar: true,
                     showClose: true,