From 430e17c10b9e54a8a9b1f3c75f01dae1054fc160 Mon Sep 17 00:00:00 2001 From: meetqy Date: Wed, 1 Feb 2023 10:26:04 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E9=A2=9C=E8=89=B2=E5=A4=84=E7=90=86=E4=B8=AD,=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=98=BE=E7=A4=BA=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/JustifyLayout/index.tsx | 9 +++++++-- env.d.ts | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/components/JustifyLayout/index.tsx b/components/JustifyLayout/index.tsx index afa4eec1..49eb13a3 100644 --- a/components/JustifyLayout/index.tsx +++ b/components/JustifyLayout/index.tsx @@ -5,6 +5,7 @@ import { useEffect, useMemo, useState } from "react"; import { handleImageAlt, handleImageUrl } from "@/hooks"; import { useRecoilState } from "recoil"; import { rightBasicState } from "@/store"; +import _ from "lodash"; interface LayoutBox { aspectRatio: number; @@ -94,7 +95,9 @@ const JustifyLayout = ({ infiniteScroll, header }: Props) => { {layoutPos.boxes.map((item, i: number) => { const image = images[i]; if (!image) return null; - const palettes: EagleUse.ImagePalette = JSON.parse(image.palettes); + const palettes: EagleUse.ImagePalette = image.processingPalette + ? null + : JSON.parse(image.palettes); return ( { style={{ ...item, position: "absolute", - background: `rgb(${palettes[0].color}, .25)`, + background: !_.isEmpty(palettes) + ? `rgb(${palettes[0].color}, .25)` + : token.colorBgBase, overflow: "hidden", outline: activeImage?.id === image.id diff --git a/env.d.ts b/env.d.ts index dffd2362..d7d275ab 100644 --- a/env.d.ts +++ b/env.d.ts @@ -28,12 +28,12 @@ namespace EagleUse { modificationTime: number; width: number; height: number; + // json字符串 palettes: string; lastModified: number; isDeleted: boolean; deletedTime: number; - // json字符串 - processingPalette: string; + processingPalette: boolean; noThumbnail: boolean; star: number; tags?: Tag[];