diff --git a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/utils/buttonEvent.js b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/utils/buttonEvent.js index c724281d..4b14cc68 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/utils/buttonEvent.js +++ b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/utils/buttonEvent.js @@ -112,17 +112,21 @@ function resolveDataOptions(data, config, component, isDefault) { name: "", config: { markerClick: (extData, item) => { - const formData = (extData?.otherConfig && typeof extData?.otherConfig !== 'string') - ? JSON.parse(extData.otherConfig) - : null; + // 兼容不同的返回类型 + let formData = extData.otherConfig; + try{ + formData = JSON.parse(otherConfig) + }catch(e){ + formData = null; + } // formData.pictures = ["https://pic1.zhimg.com/80/v2-c00beaae1f6e3c09a6d77c16c70002fe_1440w.webp?source=1def8aca","https://pic1.zhimg.com/80/v2-c56626621906417a453d262ac11f3385_1440w.webp?source=1def8aca"] - console.log(component, "DialogComponent"); + // console.log(component, "DialogComponent",extData); this.dialogConfig = { component, data: { ...extData, formData, - parseOtherConfig: JSON.parse((extData.otherConfig && typeof extData.otherConfig !== 'string')|| "{}"), + parseOtherConfig: formData, _itemData: item, }, };