Browse Source

Merge pull request '合并arm-build-zw' (#143) from arm-build-zw into arm-build

arm-build
cp3hnu 1 year ago
parent
commit
4e13e1a036
2 changed files with 6 additions and 5 deletions
  1. +6
    -4
      react-ui/src/components/IFramePage/index.tsx
  2. +0
    -1
      react-ui/src/pages/Authorize/index.tsx

+ 6
- 4
react-ui/src/components/IFramePage/index.tsx View File

@@ -4,6 +4,7 @@ import { getLabelStudioUrl } from '@/services/developmentEnvironment';
import { generateSign } from '@/utils';
import { to } from '@/utils/promise';
import SessionStorage from '@/utils/sessionStorage';
import { useModel } from '@umijs/max';
import classNames from 'classnames';
import { useEffect, useState } from 'react';
import { createPortal } from 'react-dom';
@@ -16,13 +17,12 @@ export enum IframePageType {
GitLink = 'GitLink',
}

const getRequestAPI = (type: IframePageType): (() => Promise<any>) => {
const getRequestAPI = (type: IframePageType, loginName: string): (() => Promise<any>) => {
switch (type) {
case IframePageType.DatasetAnnotation:
return getLabelStudioUrl;
case IframePageType.AppDevelopment: {
// return () => Promise.resolve({ code: 200, data: 'http://172.20.32.185:30080/' });
const loginName = 'test3';
const sign = generateSign(loginName);

return () =>
@@ -31,7 +31,6 @@ const getRequestAPI = (type: IframePageType): (() => Promise<any>) => {
data: `http://10.43.107.27:24078/uap/nudt/sso/login?name=${loginName}&sign=${sign}`,
});
}

case IframePageType.DevEnv:
return () =>
Promise.resolve({
@@ -52,6 +51,9 @@ type IframePageProps = {
function IframePage({ type, className, style }: IframePageProps) {
const [iframeUrl, setIframeUrl] = useState('');
const [loading, setLoading] = useState(false);
const { initialState } = useModel('@@initialState');
const { currentUser } = initialState || {};

useEffect(() => {
requestIframeUrl();
return () => {
@@ -62,7 +64,7 @@ function IframePage({ type, className, style }: IframePageProps) {
}, []);
const requestIframeUrl = async () => {
setLoading(true);
const [res] = await to(getRequestAPI(type)());
const [res] = await to(getRequestAPI(type, currentUser?.userName || '')());
if (res && res.data) {
setIframeUrl(res.data);
} else {


+ 0
- 1
react-ui/src/pages/Authorize/index.tsx View File

@@ -22,7 +22,6 @@ function Authorize() {
code,
};
const [res] = await to(loginByOauth2Req(params));
debugger;
if (res && res.data) {
const { access_token, expires_in } = res.data;
setSessionToken(access_token, access_token, expires_in);


Loading…
Cancel
Save