Bladeren bron

修复ui问题,还有提示配置服务器地址

onecold 1 jaar geleden
bovenliggende
commit
fe730a7e83

+ 2 - 2
AppScope/app.json5

@@ -2,8 +2,8 @@
   "app": {
     "bundleName": "com.xgplayer.ttmusic.hm",
     "vendor": "example",
-    "versionCode": 20250522,
-    "versionName": "1.3.8",
+    "versionCode": 20250605,
+    "versionName": "1.3.9",
     "icon": "$media:app_icon",
     "label": "$string:app_name",
     "multiAppMode": {

+ 6 - 2
entry/src/main/ets/common/constants/CommonConstants.ets

@@ -22,7 +22,7 @@ import { VideoSpeed } from '../../viewmodel/VideoSpeed';
  */
 export class CommonConstants {
 
-  static readonly OPEN_DATE: string = '2025-05-24';
+  static readonly OPEN_DATE: string = '2025-06-06';
 
   static readonly ICP_NO: string = '闽ICP备18015191号-16A';
 
@@ -41,6 +41,10 @@ export class CommonConstants {
   static readonly LRC_API_2: string = 'https://api.lrc.cx/lyrics'
 
   static readonly COVER_API: string = 'https://lrc.ss5.xyz/cover'//https://lrc.ss5.xyz/cover?title=%E5%B1%B1%E6%B0%B4%E4%B9%8B%E9%97%B4&artist=%E8%AE%B8%E5%B5%A9
+
+
+  static readonly COVER_API2: string = 'https://api.lrc.cx/cover'
+
   //网络测速
   static readonly IS_YUN_CESU: string = "https://test.nju.edu.cn/";
   static readonly IS_YUN_CESU2: string = "http://speedtest.im/";
@@ -86,7 +90,7 @@ export class CommonConstants {
   static readonly SORT_ARRAY = ["按艺术家升序", "按艺术家降序", "按专辑升序", "按专辑降序", "按名称升序", "按名称降序", "按添加时间升序",
   "按添加时间降序"]
 
-  static readonly TOP_HEIGHT: number = 35;
+  static readonly TOP_HEIGHT: number = 33;
 
   //德本的接口调用微信支付下单接口返回的支付交易会话ID,该值有效期为2小时。
   static readonly WX_PAY_API: string = "https://pay.ss5.xyz/wechat/prepay"

+ 5 - 2
entry/src/main/ets/common/util/NetAxiosUtil.ets

@@ -41,7 +41,7 @@ class NetAxiosUtil{
 
       if(response.responseCode === 200){
         let res = response.result as string;
-        LogUtil.debug("onecold res 11 =" + res)
+        // LogUtil.debug("onecold res 11 =" + res)
         let fileContent = ''
         if(isApi2){
           fileContent =  res
@@ -70,7 +70,7 @@ class NetAxiosUtil{
       let baseUrl = cover_api
       LogUtil.debug("onecold getLyricCover baseUrl = "+baseUrl+title+artist);
       if(cover_api==undefined&&StrUtil.isEmpty(cover_api)){
-        LogUtil.debug("onecold getLyricCover baseUrl2 = "+baseUrl);
+        // LogUtil.debug("onecold getLyricCover baseUrl2 = "+baseUrl);
         // baseUrl =  PreferencesUtil.getStringSync('COVER_API','')
         baseUrl = ''
       }
@@ -79,6 +79,9 @@ class NetAxiosUtil{
         LogUtil.debug("onecold Heanup 未设置API");
         return ''
       }
+      if(baseUrl ===CommonConstants.COVER_API2){
+        baseUrl = CommonConstants.COVER_API
+      }
       const cover_url = baseUrl
         + '?title=' + encodeURIComponent(title.trim()) + '&artist=' + encodeURIComponent(artist.trim());
       const httpRequest = http.createHttp();

+ 30 - 27
entry/src/main/ets/pages/ScanFilePage.ets

@@ -155,11 +155,11 @@ export struct ScanFilePage{
           }
 
 
-          Text(this.strText)
-            .margin({ right: 20,top:20,bottom:20 })
-            .fontSize(16)
-            .fontColor(Color.Black)
-            .fontWeight(480)
+          // Text(this.strText)
+          //   .margin({ right: 20,top:20,bottom:20 })
+          //   .fontSize(16)
+          //   .fontColor(Color.Black)
+          //   .fontWeight(480)
 
 
           Column() {
@@ -175,13 +175,13 @@ export struct ScanFilePage{
                 +`${this.appName} `+
               Utility.resourceToString(getContext(this),$r('app.string.file_scan_tip_one_1')))
                 .margin({ left: 10, right: 20 })
-                .fontSize(11)
+                .fontSize(15)
                 .fontColor(Color.Gray)
                 .fontWeight(480)
                 .layoutWeight(1)
             }
             .width('100%')
-            .margin({ left:25,right: 10 ,top:20 })
+            .margin({ left:25,right: 25 ,top:20 })
 
 
             Row() {
@@ -194,34 +194,37 @@ export struct ScanFilePage{
                 .alignSelf(ItemAlign.Center)
               Text($r('app.string.file_scan_tip_two'))
                 .margin({ left: 10, right: 20 })
-                .fontSize(11)
+                .fontSize(15)
                 .fontColor(Color.Gray)
                 .fontWeight(480)
                 .layoutWeight(1)
 
             }
             .width('100%')
-            .margin({ left:25,right: 10 ,top:20 })
-
-            Column() {
-              Button($r('app.string.start_scan'), { type: ButtonType.Capsule, stateEffect: false })
-
-                .width('60%')
-                .height(55)
-                .margin({ top: 50, bottom: 20 })
-                .linearGradient({
-                  direction: GradientDirection.Right,
-                  colors: [['#ff37a0fc', 0.0], ['#67e667', 0.5], ['#f5856e', 1.0]]
-                })
-                .visibility(this.isStart ? Visibility.Hidden : Visibility.Visible)
-                .onClick(() => {
-                  this.doOptimize()
-
-                })
-                .alignSelf(ItemAlign.Center)
+            .margin({ left:25,right: 25 ,top:20,bottom:20 })
 
+          }
+          .backgroundColor($r('app.color.index_background'))
+          .margin({ left:25,right: 25,top:20,bottom:20  })
+          .borderRadius(20)
+
+          Column() {
+            Button(this.isStart?'正在扫描':$r('app.string.start_scan'), { type: ButtonType.Capsule, stateEffect: false })
+
+              .width('60%')
+              .height(55)
+              .margin({ top: 30, bottom: 20 })
+              .linearGradient({
+                direction: GradientDirection.Right,
+                colors: [['#ff37a0fc', 0.0], ['#67e667', 0.5], ['#f5856e', 1.0]]
+              })
+              .enabled(this.isStart ?false:true)
+              .onClick(() => {
+                this.doOptimize()
+
+              })
+              .alignSelf(ItemAlign.Center)
 
-            }
 
           }
 

+ 13 - 5
entry/src/main/ets/pages/SettingPage.ets

@@ -508,20 +508,28 @@ export struct SettingPage {
               this.tempApiUrl = this.coverApiUrl
               this.apiDialogController.open()
             })
+            .justifyContent(FlexAlign.Center)
             .height(55)
           }
           .backgroundColor($r('app.color.settings_background_main'))
           .borderRadius(20)
-          .margin({ left: 0, right: 0, top: 10, bottom: 30 })
+          .margin({ left: 0, right: 0, top: 10, bottom: 20 })
           .padding(0)
+
+          //空白
+          Column() {
+            Blank()
+              .height(88)
+          }.height(88)
         }
-        .margin({ left: 35, right: 35, top: 20, bottom: 30 })
+        .margin({ left: this.currentBreakpoint !== BreakpointTypeEnum.SM?35:20,
+          right: this.currentBreakpoint !== BreakpointTypeEnum.SM?35:20, top: 20, bottom: 20 })
         .justifyContent(FlexAlign.Start)
       }
       .scrollBar(BarState.Auto)
       .height('100%')
       .width('100%')
-      .margin({bottom:40})
+      .margin({bottom:10})
       .backgroundColor($r('app.color.settings_background'))
     }
 
@@ -588,12 +596,12 @@ export struct SettingPage {
   CustomizeBg() {
     Column() {
       Image( this.customizeBgPath)
-        .height('62%')
+        .height('52%')
         .alt($r('app.color.white'))
         .objectFit( ImageFit.Contain)
         .borderRadius(20)
         .clip(true)
-        .margin({bottom:30 })
+        .margin({left:30,right:30,bottom:30 })
 
       Row() {
 

+ 60 - 53
entry/src/main/ets/view/LocalMusic.ets

@@ -1547,6 +1547,7 @@ export struct LocalMusic {
       pup = XPopup.Builder()
         .setPopupPosition(popupPosition)
         .atView(id)
+        // .setHeight(this.isCoverOpacity()?100:420)
         .setBackgroundColor(Color.Black)
         .asBubble(wrapBuilder(cutPopupBuilder), dataBean)
         .show()
@@ -1555,6 +1556,7 @@ export struct LocalMusic {
       pup = XPopup.Builder()
         .setPopupPosition(popupPosition)
         .atView(id)
+        // .setHeight(this.isCoverOpacity()?280:420)
         .setBackgroundColor(Color.White)
         .asBubble(wrapBuilder(cutPopupBuilder), dataBean)
         .show()
@@ -1622,6 +1624,7 @@ export struct LocalMusic {
       pup = XPopup.Builder()
         .setPopupPosition(popupPosition)
         .atView(id)
+        .setMaxHeight('60%')
         .setBackgroundColor(Color.Black)
         .asBubble(wrapBuilder(cutPopupBuilder), dataBean)
         .show();
@@ -1629,6 +1632,7 @@ export struct LocalMusic {
       pup = XPopup.Builder()
         .setPopupPosition(popupPosition)
         .atView(id)
+        .setMaxHeight('60%')
         .setBackgroundColor(Color.White)
         .asBubble(wrapBuilder(cutPopupBuilder), dataBean)
         .show();
@@ -1812,29 +1816,29 @@ export struct LocalMusic {
             duration: 666,
             curve: 'ease-in-out' // 可选动画曲线
           })
-          .position({ bottom: 108 }) // 将 Row 固定在底部
-
-          Column() {
-            Button('导入音乐', { type: ButtonType.Capsule, stateEffect: true })
-              .width('50%')
-              .height(55)
-              .margin({ top: 50, bottom: 40 })
-              .backgroundColor($r('app.color.title_bar_bg'))
-
-              .onClick(() => {
-                this.showSheelDialog()
-              })
-
-          }
-          .height('100%')
-          .justifyContent(FlexAlign.Center)
-          .opacity(this.isZero ? 1 : 0)
-          .visibility(this.isZero && this.modeType === 0 ? Visibility.None : Visibility.None)
-          .animation({
-            duration: 666,
-            curve: 'ease-in-out' // 可选动画曲线
-          })
-          .width('100%')
+          .position({ bottom:this.isPhoneLan()?130: 168 }) // 将 Row 固定在底部
+
+          // Column() {
+          //   Button('导入音乐', { type: ButtonType.Capsule, stateEffect: true })
+          //     .width('50%')
+          //     .height(55)
+          //     .margin({ top: 50, bottom: 40 })
+          //     .backgroundColor($r('app.color.title_bar_bg'))
+          //
+          //     .onClick(() => {
+          //       this.showSheelDialog()
+          //     })
+          //
+          // }
+          // .height('100%')
+          // .justifyContent(FlexAlign.Center)
+          // .opacity(this.isZero ? 1 : 0)
+          // .visibility(this.isZero && this.modeType === 0 ? Visibility.None : Visibility.None)
+          // .animation({
+          //   duration: 666,
+          //   curve: 'ease-in-out' // 可选动画曲线
+          // })
+          // .width('100%')
         }
         .width('100%')
         .height('100%')
@@ -1850,9 +1854,8 @@ export struct LocalMusic {
       .width('100%')
       .height('100%')
       .backgroundImage(this.isCustomizeBg?this.customizeBgPath:$r('app.color.bottom_control_background'))
-      .backgroundImageSize({ height: '100%'})
+      .backgroundImageSize(this.isCoverOpacity()?{width:'100%'}:{ height: '100%'})
       .backgroundImagePosition(Alignment.Center)
-      // .backgroundColor($r('app.color.bottom_control_background'))
       .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
 
     }
@@ -2313,7 +2316,8 @@ export struct LocalMusic {
                 });
             }
             .layoutWeight(1)
-            .margin({ left: 5, right: 5, bottom: 1 });
+            .margin({ left: this.currentBreakpoint !== BreakpointTypeEnum.SM?35:5,
+              right: this.currentBreakpoint !== BreakpointTypeEnum.SM?35:5, bottom: 1 });
           });
         }
         .width('100%')
@@ -2823,7 +2827,7 @@ export struct LocalMusic {
       }, (item: VideoItem) => item.filePath)
     }
     // .divider({ strokeWidth: 1, color: this.isDarkMode? '#333333':'#ffe9f0f0' })
-    .margin({ bottom: this.isPuraWP() ? 100 : 158 })
+    .margin({ bottom: this.isCoverOpacity() ? 50 : 158 })
     .cachedCount(30)
     .borderRadius(20)
     .layoutWeight(1)
@@ -2844,6 +2848,7 @@ export struct LocalMusic {
       }).getValue(this.currentBreakpoint)
     )
     .onScrollFrameBegin((offset: number) => {
+
       if (this.currentWidthBreakpoint !== WidthBreakpoint.WIDTH_SM ||
         (this.currentHeightBreakpoint !== HeightBreakpoint.HEIGHT_MD &&
           this.currentHeightBreakpoint !== HeightBreakpoint.HEIGHT_SM)) {
@@ -3127,6 +3132,7 @@ export struct LocalMusic {
         right: 16
       })
       Line().width('100%').height(25).backgroundColor($r('app.color.bottom_control_background'))
+        // .visibility(this.isPhoneLan()?Visibility.None:this.isCustomizeBg?Visibility.Hidden:Visibility.Visible)
         .visibility(this.isCustomizeBg?Visibility.Hidden:Visibility.Visible)
     }
 
@@ -3301,14 +3307,7 @@ export struct LocalMusic {
               .stateEffect(true)
               .margin({ right: 12, left: 5 })
               .onClick(async () => {
-
-                if (this.currentSong !== undefined) {
-                  let artist = this.currentSong?.artist
-                  if (StrUtil.isEmpty(artist) || artist === undefined) {
-                    artist = ''
-                  }
-                  this.searchCover(this.name, artist)
-                }
+                this.doSearchCover()
 
               })
 
@@ -4131,7 +4130,7 @@ export struct LocalMusic {
     return this.currentWidthBreakpoint === WidthBreakpoint.WIDTH_SM
       && this.currentHeightBreakpoint === HeightBreakpoint.HEIGHT_MD
   }
-
+  //是否是Pura X外屏,或者小屏幕,手机横屏
   isCoverOpacity() {
     if (this.isPuraWP()) {
       return true
@@ -4310,7 +4309,7 @@ export struct LocalMusic {
   @State bright: number = PlayConstants.BRIGHT;
   @State brightShow: boolean = PlayConstants.BRIGHT_SHOW;
   @State seekToShow: boolean = PlayConstants.BRIGHT_SHOW;
-  // @State screenHeight:number = 0
+
   @State screenWidth: number = 0
   @State screenHeight: number = 0
   @State statusBarHeight: number = 0
@@ -5426,7 +5425,7 @@ export struct LocalMusic {
 
       Row() {
         this.pushLyricButton($r('app.media.cut_current'), 0, '本地歌词')
-        // this.pushLyricButton($r('app.media.white_search'),  1, '获取歌词')
+        this.pushLyricButton($r('app.media.white_search'),  1, '获取歌词')
         // this.pushLyricButton($r('app.media.white_search'),  2, '获取歌词')
 
 
@@ -5566,10 +5565,10 @@ export struct LocalMusic {
     Row() {
       Image(icon)
         .width(14)
-        .margin({ left: 6 })
+        .margin({ left: 13 })
 
       Text(label)
-        .fontSize(10)
+        .fontSize(12)
         .margin({ left: 6 })
         .fontColor('#FFFFFF')
     }
@@ -5581,17 +5580,17 @@ export struct LocalMusic {
           break;
         case 1:
           //判断是不是赞助会员
-          // if(Utility.isNoble()){
+          if(PreferencesUtil.getStringSync('LRC_API','')===''){
+            ToastUtil.showToast('请到设置界面配置歌词服务器地址')
+            return
+          }
           if (StrUtil.isNotEmpty(this.videoUrl)) {
             ToastUtil.showToast('正在获取')
             this.isLyricSetting = false
             let lyricPath = this.videoUrl.substring(0, this.videoUrl.lastIndexOf('.')) + '.lrc'
             this.initLyric(lyricPath, true);
           }
-          // }else{
-          //   this.isLyricSetting = false
-          //   this.showVipDialog()
-          // }
+
 
           break;
         case 2:
@@ -5612,7 +5611,7 @@ export struct LocalMusic {
       }
     })
     .padding(5)
-    .width(90)
+    .width(110)
     .height(40)
     .margin({ left: 6, right: 6 })
     .border({
@@ -6071,19 +6070,27 @@ export struct LocalMusic {
         break;
 
       case 14: //搜索封面
-        if (this.currentSong !== undefined) {
-          let artist = this.currentSong?.artist
-          if (StrUtil.isEmpty(artist) || artist === undefined) {
-            artist = ''
-          }
-          this.searchCover(this.name, artist)
-        }
+        this.doSearchCover()
         this.isShowMoreView = false
         break;
     }
 
   }
 
+  doSearchCover(){
+    if(PreferencesUtil.getStringSync('COVER_API','')===''){
+      ToastUtil.showToast('请到设置界面配置封面服务器地址')
+      return
+    }
+    if (this.currentSong !== undefined) {
+      let artist = this.currentSong?.artist
+      if (StrUtil.isEmpty(artist) || artist === undefined) {
+        artist = ''
+      }
+      this.searchCover(this.name, artist)
+    }
+  }
+
   searchCover(title: string, artist: string) {
 
 

+ 1 - 1
entry/src/main/resources/base/element/string.json

@@ -386,7 +386,7 @@
     },
     {
       "name": "file_scan_tip_one_1",
-      "value": "文件夹下,即可扫描。"
+      "value": "文件夹下,即可一键扫描。"
     },
     {
       "name": "file_scan_tip_two",