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