Commit 8548779f authored by 周宏民's avatar 周宏民

fix: 修改项目简介在切换 站点时,图片显示错误的问题

parent bf2331e2
Pipeline #85986 waiting for manual action with stages
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState, useCallback } from 'react';
import { FullscreenExitOutlined, FullscreenOutlined } from '@ant-design/icons'; import { FullscreenExitOutlined, FullscreenOutlined } from '@ant-design/icons';
import { notification } from 'antd'; import { notification } from 'antd';
import classnames from 'classnames'; import classnames from 'classnames';
import { cloudService } from '@/api'; import { cloudService } from '@/api';
import { connect } from 'react-redux';
import useFullScreen from '../iframe/useFullScreen'; import useFullScreen from '../iframe/useFullScreen';
import styles from './index.less'; import styles from './index.less';
...@@ -14,8 +15,8 @@ const PrevieView = props => { ...@@ -14,8 +15,8 @@ const PrevieView = props => {
const { imgName, accountName, fullscreen, canScroll } = params; const { imgName, accountName, fullscreen, canScroll } = params;
const [ref, isFullscreen, handleFullScreen, handleExitFullScreen] = useFullScreen(fullscreen); const [ref, isFullscreen, handleFullScreen, handleExitFullScreen] = useFullScreen(fullscreen);
const [imgUrl, setImgUrl] = useState(''); const [imgUrl, setImgUrl] = useState('');
const userInfo = props.global?.userInfo;
const getImgUrl = () => { const getImgUrl = useCallback(() => {
cloudService cloudService
.getAccountPageList({ .getAccountPageList({
pageIndex: 1, pageIndex: 1,
...@@ -30,18 +31,18 @@ const PrevieView = props => { ...@@ -30,18 +31,18 @@ const PrevieView = props => {
if (configData.length > 0 && configData[0]['演示图片']) { if (configData.length > 0 && configData[0]['演示图片']) {
const url = `${window.location.origin}/PandaWorkFlow/WorkFlow/AccountManage/DownloadFiles?filePath=${ const url = `${window.location.origin}/PandaWorkFlow/WorkFlow/AccountManage/DownloadFiles?filePath=${
configData[0]['演示图片'] configData[0]['演示图片']
}&_site=${window.globalConfig?.userInfo?.site}`; }&_site=${userInfo?.site}`;
setImgUrl(url); setImgUrl(url);
} }
}) })
.catch(err => { .catch(err => {
notification.error({ message: '提示', duration: 3, description: '获取图片信息错误' }); notification.error({ message: '提示', duration: 3, description: '获取图片信息错误' });
}); });
}; });
useEffect(() => { useEffect(() => {
getImgUrl(); getImgUrl();
}, []); }, [getImgUrl, userInfo]);
return ( return (
<div className={classnames(styles['tab-preview'], canScroll ? styles['long-img'] : styles['normal-img'])} ref={ref}> <div className={classnames(styles['tab-preview'], canScroll ? styles['long-img'] : styles['normal-img'])} ref={ref}>
...@@ -59,5 +60,7 @@ const PrevieView = props => { ...@@ -59,5 +60,7 @@ const PrevieView = props => {
</div> </div>
); );
}; };
const mapStateToProps = state => ({
export default PrevieView; global: state.getIn(['global', 'globalConfig']),
});
export default connect(mapStateToProps)(PrevieView);
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