Просмотр исходного кода

修复编辑标签 获取封面Image没有显示封面

onecold 11 месяцев назад
Родитель
Сommit
abed86ff53
1 измененных файлов с 5 добавлено и 4 удалено
  1. 5 4
      entry/src/main/ets/view/LocalMusic.ets

+ 5 - 4
entry/src/main/ets/view/LocalMusic.ets

@@ -4843,9 +4843,10 @@ export struct LocalMusic {
         Row() {
           Stack() {
 
-            Image(StrUtil.isNotEmpty(this.imagePathStr)?this.imagePathStr:
-              StrUtil.isEmpty(item.pixelMapPath) ? $r('app.media.music_red') :
-              item.pixelMapPath)
+            Image(StrUtil.isNotEmpty(this.imagePathStr)?this.imagePathStr.startsWith('http')?
+                this.imagePathStr:fileUri.getUriFromPath(this.imagePathStr):
+                StrUtil.isEmpty(item.pixelMapPath) ? $r('app.media.music_red') :
+                item.pixelMapPath)
               .fillColor(this.themeColor)
               .height(55)
               .width(55)
@@ -4914,7 +4915,7 @@ export struct LocalMusic {
 
                 const imagePath:string | undefined = await this.doSearchCover(item);
                 console.info('onecold imagePath = '+imagePath)
-                if (imagePath) {
+                if (StrUtil.isNotEmpty(imagePath)) {
                   //用户更改过图片
                   this.imagePathStr = imagePath
                   ToastUtil.showToast('获取封面成功')