From 03acf52dec8c4fb88518b6bd27ea4774fd35edba Mon Sep 17 00:00:00 2001 From: syb01094648 Date: Thu, 7 Mar 2024 17:23:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9ts=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../official-layer-control/index.tsx | 12 +++--------- src/recoil/atomState.ts | 2 +- src/types/l7editor.ts | 6 +++--- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/components/map-control-group/official-layer-control/index.tsx b/src/components/map-control-group/official-layer-control/index.tsx index 221be3c..cc28cbc 100644 --- a/src/components/map-control-group/official-layer-control/index.tsx +++ b/src/components/map-control-group/official-layer-control/index.tsx @@ -20,6 +20,7 @@ import { OfficeLayerEnum, } from '../../../constants'; import { useGlobal } from '../../../recoil'; +import type { CustomTilesProps } from '../../../types/l7editor'; import useStyle from './styles'; const layout = { @@ -31,13 +32,6 @@ const enLayout = { wrapperCol: { span: 15 }, }; -type CustomTilesItemProps = { - id: string; - image?: string; - title?: string; - layers?: string[]; -}; - export function OfficialLayerControl() { const [form] = Form.useForm(); const styles = useStyle(); @@ -98,7 +92,7 @@ export function OfficialLayerControl() { return false; // 阻止antd组件自动上传 }; - const onItemClick = (item: CustomTilesItemProps) => { + const onItemClick = (item: CustomTilesProps) => { setRadioValue(item.id); setLayerType( item.id === OfficeLayerEnum.VectorMap ? [] : ([item.id] as string[]), @@ -144,7 +138,7 @@ export function OfficialLayerControl() { const onConfirm = ( e: React.MouseEvent | undefined, - item: CustomTilesItemProps, + item: CustomTilesProps, ) => { e?.stopPropagation(); const newCustomTiles = customTiles.filter((val) => { diff --git a/src/recoil/atomState.ts b/src/recoil/atomState.ts index a7da11d..b75ccef 100644 --- a/src/recoil/atomState.ts +++ b/src/recoil/atomState.ts @@ -173,7 +173,7 @@ const textLayerFieldsState = atom({ effects: [localStorageEffect(LocalStorageKey.textLayerFields)], }); -const customTilesState = atom({ +const customTilesState = atom({ key: 'customTiles', default: [], effects: [localStorageEffect(LocalStorageKey.customTiles)], diff --git a/src/types/l7editor.ts b/src/types/l7editor.ts index 8fa4493..a9574b7 100644 --- a/src/types/l7editor.ts +++ b/src/types/l7editor.ts @@ -2,13 +2,13 @@ import type { LarkMapProps } from '@antv/larkmap'; import type { Feature } from '@turf/turf'; import type { TabsProps } from 'antd'; -export type CustomTilesProps = { +export interface CustomTilesProps { [key: string]: any; id: string; image: string; title: string; layers: string[]; -}[]; +} export interface MapControlProps { logoControl?: boolean; @@ -158,5 +158,5 @@ export interface L7EditorProps { /** * 自定义瓦片底图图层 */ - customTiles?: CustomTilesProps; + customTiles?: CustomTilesProps[]; }