Commit 73c913e7 authored by 张烨's avatar 张烨

fix: 修复图片配置回显

parent 798fe789
...@@ -36,7 +36,8 @@ interface PicturesWallType { ...@@ -36,7 +36,8 @@ interface PicturesWallType {
onChange?: (v: any) => void; onChange?: (v: any) => void;
cropRate?: number | boolean; cropRate?: number | boolean;
isCrop?: boolean; isCrop?: boolean;
type?: 'CityTemp'|'icon'|'androidMenu'|'menuNew' type?: 'CityTemp'|'icon'|'androidMenu'|'menuNew',
value?: string,
} }
class PicturesWall extends React.Component<PicturesWallType> { class PicturesWall extends React.Component<PicturesWallType> {
...@@ -47,7 +48,12 @@ class PicturesWall extends React.Component<PicturesWallType> { ...@@ -47,7 +48,12 @@ class PicturesWall extends React.Component<PicturesWallType> {
previewTitle: '', previewTitle: '',
imgBed: [], imgBed: [],
curSelectedImg: '', curSelectedImg: '',
fileList: this.props.fileList || [], fileList: this.props.value ? [{
url: this.props.value,
uid: uuid(8, 16),
name: '熊猫运维中台系统',
status: 'done',
}] : [],
}; };
handleCancel = () => this.setState({ previewVisible: false }); handleCancel = () => this.setState({ previewVisible: false });
...@@ -144,6 +150,9 @@ class PicturesWall extends React.Component<PicturesWallType> { ...@@ -144,6 +150,9 @@ class PicturesWall extends React.Component<PicturesWallType> {
if(path&&path.indexOf('data:') === 0) { if(path&&path.indexOf('data:') === 0) {
return path return path
} }
if(path && path.indexOf('assets') === 0) {
return `${window.location.origin}/Web4/${path}`.replace(/\\/g, '/')
}
return `${window.location.origin}/${path}`.replace(/\\/g, '/') return `${window.location.origin}/${path}`.replace(/\\/g, '/')
} }
......
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import PageContainer from '@/components/BasePageContainer'; import PageContainer from '@/components/BasePageContainer';
import { Tabs } from 'antd'; import { Tabs } from 'antd';
import { getWebModuleTree, getWebConfigByName } from '@/services/webConfig/api'; import {
getWebModuleTree,
getWebConfigByName,
getWebconfig,
} from '@/services/webConfig/api';
import styles from './index.less'; import styles from './index.less';
import SiteConfig from './components/siteConfigDrawer'; import SiteConfig from './components/siteConfigDrawer';
import { appConnector } from '@/containers/App/store'; import { appConnector } from '@/containers/App/store';
...@@ -12,8 +16,9 @@ const WebConfigPage = props => { ...@@ -12,8 +16,9 @@ const WebConfigPage = props => {
const [configVisible, setConfigVisible] = useState(false); const [configVisible, setConfigVisible] = useState(false);
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [webs, setWebs] = useState([]); const [webs, setWebs] = useState([]);
const [curWeb, setCurWeb] = useState(null); // 当前展示的web配置 const [curWeb, setCurWeb] = useState(null); // 当前展示的web
const [configObj, setConfigObj] = useState({}); const [configObj, setConfigObj] = useState({}); // 获取当前的web的配置
const [toEdit, setToEdit] = useState(null); // 编辑展示用的配置
const hasIntegerate = () => webs.some(w => w.webType === 'integrate'); const hasIntegerate = () => webs.some(w => w.webType === 'integrate');
...@@ -33,9 +38,23 @@ const WebConfigPage = props => { ...@@ -33,9 +38,23 @@ const WebConfigPage = props => {
}); });
}, []); }, []);
useEffect(() => {
// eslint-disable-next-line no-unused-expressions
curWeb && getWebconfig(curWeb.text).then(res => setConfigObj(res));
}, [curWeb]);
const renderTabPane = tabPaneItem => ( const renderTabPane = tabPaneItem => (
<TabPane key={tabPaneItem.text} tab={tabPaneItem.text}> <TabPane key={tabPaneItem.text} tab={tabPaneItem.text}>
<></> <>
<span
onClick={() => {
setToEdit(configObj);
setConfigVisible(true);
}}
>
查看配置
</span>
</>
</TabPane> </TabPane>
); );
...@@ -68,7 +87,7 @@ const WebConfigPage = props => { ...@@ -68,7 +87,7 @@ const WebConfigPage = props => {
<SiteConfig <SiteConfig
visible={configVisible} visible={configVisible}
onClose={onDrawerClose} onClose={onDrawerClose}
config={configObj} config={toEdit}
hasIntegerate={hasIntegerate()} hasIntegerate={hasIntegerate()}
/> />
</div> </div>
......
...@@ -22,3 +22,6 @@ export const getMapCofigs = () => ...@@ -22,3 +22,6 @@ export const getMapCofigs = () =>
`${CITY_SERVICE}/OMS.svc/GetAllConfigText?terminalType=scheme&isBaseMap=false`, `${CITY_SERVICE}/OMS.svc/GetAllConfigText?terminalType=scheme&isBaseMap=false`,
{ query: '' }, { query: '' },
); );
export const getWebconfig = title =>
get(`${CITY_SERVICE}/OMS.svc/W4_GetWebsite`, { title });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment