diff --git a/Build_God_Api/Build_God_Api/Dto/ScrapDto.cs b/Build_God_Api/Build_God_Api/Dto/ScrapDto.cs index db489f3..4ba9d4a 100644 --- a/Build_God_Api/Build_God_Api/Dto/ScrapDto.cs +++ b/Build_God_Api/Build_God_Api/Dto/ScrapDto.cs @@ -16,6 +16,7 @@ namespace Build_God_Api.Dto public int HpBonus { get; set; } public int MagicBonus { get; set; } public bool IsActive { get; set; } = true; + public string? Icon { get; set; } } public class ScrapScanResultDto diff --git a/Build_God_Api/Build_God_Api/Services/ScrapService.cs b/Build_God_Api/Build_God_Api/Services/ScrapService.cs index 1db1b5e..4e04901 100644 --- a/Build_God_Api/Build_God_Api/Services/ScrapService.cs +++ b/Build_God_Api/Build_God_Api/Services/ScrapService.cs @@ -213,7 +213,8 @@ namespace Build_God_Api.Services DefenseBonus = dto.DefenseBonus, HpBonus = dto.HpBonus, MagicBonus = dto.MagicBonus, - IsActive = dto.IsActive + IsActive = dto.IsActive, + Icon = dto.Icon }; await db.Insertable(scrap).ExecuteCommandAsync(); @@ -237,6 +238,7 @@ namespace Build_God_Api.Services scrap.HpBonus = dto.HpBonus; scrap.MagicBonus = dto.MagicBonus; scrap.IsActive = dto.IsActive; + scrap.Icon = dto.Icon; await db.Updateable(scrap).ExecuteCommandAsync(); return true; diff --git a/Build_God_Game/src/assets/icons/scrap/铅笔.svg b/Build_God_Game/src/assets/icons/scrap/铅笔.svg new file mode 100644 index 0000000..7e9f963 --- /dev/null +++ b/Build_God_Game/src/assets/icons/scrap/铅笔.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Build_God_Game/src/views/BagView.vue b/Build_God_Game/src/views/BagView.vue index f9dda8d..f4df902 100644 --- a/Build_God_Game/src/views/BagView.vue +++ b/Build_God_Game/src/views/BagView.vue @@ -46,7 +46,8 @@ const scrapLevelColorMap: Record = { const getItemIcon = (item: { icon: string | null }) => { if (item.icon) { - return new URL(`../assets/icons/${item.icon}`, import.meta.url).href + const [dir, file] = item.icon.split('/') + return new URL(`../assets/icons/${dir}/${file}`, import.meta.url).href } return itemDefaultIcon } @@ -82,11 +83,13 @@ onMounted(() => {