|
|
|
@@ -2,6 +2,11 @@ import FullScreenFrame from '@/components/FullScreenFrame'; |
|
|
|
import KFSpin from '@/components/KFSpin'; |
|
|
|
import { getLabelStudioUrl } from '@/services/developmentEnvironment'; |
|
|
|
import { to } from '@/utils/promise'; |
|
|
|
import { |
|
|
|
editorUrlKey, |
|
|
|
getSessionStorageItem, |
|
|
|
removeSessionStorageItem, |
|
|
|
} from '@/utils/sessionStorage'; |
|
|
|
import classNames from 'classnames'; |
|
|
|
import { useEffect, useState } from 'react'; |
|
|
|
import './index.less'; |
|
|
|
@@ -9,6 +14,7 @@ import './index.less'; |
|
|
|
export enum IframePageType { |
|
|
|
DatasetAnnotation = 'DatasetAnnotation', // 数据标注 |
|
|
|
AppDevelopment = 'AppDevelopment', // 应用开发 |
|
|
|
DevEnv = 'DevEnv', // 开发环境 |
|
|
|
} |
|
|
|
|
|
|
|
const getRequestAPI = (type: IframePageType): (() => Promise<any>) => { |
|
|
|
@@ -17,6 +23,8 @@ const getRequestAPI = (type: IframePageType): (() => Promise<any>) => { |
|
|
|
return getLabelStudioUrl; |
|
|
|
case IframePageType.AppDevelopment: |
|
|
|
return () => Promise.resolve({ code: 200, data: 'http://172.20.32.181:30080/' }); |
|
|
|
case IframePageType.DevEnv: |
|
|
|
return () => Promise.resolve({ code: 200, data: getSessionStorageItem(editorUrlKey) || '' }); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
@@ -31,6 +39,11 @@ function IframePage({ type, className, style }: IframePageProps) { |
|
|
|
const [loading, setLoading] = useState(false); |
|
|
|
useEffect(() => { |
|
|
|
requestIframeUrl(); |
|
|
|
return () => { |
|
|
|
if (type === IframePageType.DevEnv) { |
|
|
|
removeSessionStorageItem(editorUrlKey); |
|
|
|
} |
|
|
|
}; |
|
|
|
}, []); |
|
|
|
const requestIframeUrl = async () => { |
|
|
|
setLoading(true); |
|
|
|
|