Unverified Commit 2b3d0b65 authored by zhu-mingye's avatar zhu-mingye Committed by GitHub

[Refactor][web] refactor login page (#1962)

* refactor login page * optimize login page layout * modify style import * modify style * modify style * fix lang hidden bug * fix lang hidden bug * added initialValues={{autoLogin: true}}
parent 12989375
......@@ -61,9 +61,10 @@
"rc-util": "^5.30.0",
"react": "^18.2.0",
"react-dev-inspector": "^1.8.1",
"react-monaco-editor": "^0.52.0",
"react-dom": "^18.0.0",
"react-helmet-async": "^1.3.0",
"react-monaco-editor": "^0.52.0",
"react-spring": "^9.7.1",
"screenfull": "^6.0.2",
"use-sse": "^2.0.1"
},
......
This diff is collapsed.
<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
style="margin:auto;background:#ffffff;display:block;z-index:1;position:relative" width="1920" height="900"
preserveAspectRatio="xMidYMid" viewBox="0 0 1920 900">
<g transform="translate(960,450) scale(1,1) translate(-960,-450)">
<linearGradient id="lg-0.519274329747355" x1="0" x2="1" y1="0" y2="0">
<stop stop-color="#ff00ff" offset="0"></stop>
<stop stop-color="#00ffff" offset="1"></stop>
</linearGradient>
<path d="" fill="url(#lg-0.519274329747355)" opacity="0.4">
<animate attributeName="d" dur="10s" repeatCount="indefinite" keyTimes="0;0.333;0.667;1" calcMode="spline"
keySplines="0.5 0 0.5 1;0.5 0 0.5 1;0.5 0 0.5 1" begin="0s"
values="M0 0L 0 785.259160569599Q 240 656.0433469925683 480 637.0752028346935T 960 557.6511412538559T 1440 538.1676182198316T 1920 422.9912052090322L 1920 0 Z;M0 0L 0 869.3686064070597Q 240 804.5310406677979 480 764.687604193349T 960 533.6611205206846T 1440 469.26735052182323T 1920 344.9492092972185L 1920 0 Z;M0 0L 0 776.2588822803325Q 240 756.123750936792 480 739.0851270344987T 960 593.2668471013939T 1440 602.4749771919371T 1920 491.8715740333309L 1920 0 Z;M0 0L 0 785.259160569599Q 240 656.0433469925683 480 637.0752028346935T 960 557.6511412538559T 1440 538.1676182198316T 1920 422.9912052090322L 1920 0 Z"></animate>
</path>
<path d="" fill="url(#lg-0.519274329747355)" opacity="0.4">
<animate attributeName="d" dur="10s" repeatCount="indefinite" keyTimes="0;0.333;0.667;1" calcMode="spline"
keySplines="0.5 0 0.5 1;0.5 0 0.5 1;0.5 0 0.5 1" begin="-1.6666666666666667s"
values="M0 0L 0 841.7278151678291Q 240 709.5691578182891 480 664.0626117076251T 960 576.8239855514423T 1440 490.9529427276996T 1920 379.75490287303495L 1920 0 Z;M0 0L 0 873.7966661736656Q 240 685.1417039527854 480 642.3100791748109T 960 637.5020456997963T 1440 501.68507752601516T 1920 410.41832016280705L 1920 0 Z;M0 0L 0 841.7634476827059Q 240 784.6401480971722 480 765.4623448919933T 960 559.3896033898495T 1440 452.68605339210575T 1920 458.91398611015785L 1920 0 Z;M0 0L 0 841.7278151678291Q 240 709.5691578182891 480 664.0626117076251T 960 576.8239855514423T 1440 490.9529427276996T 1920 379.75490287303495L 1920 0 Z"></animate>
</path>
<path d="" fill="url(#lg-0.519274329747355)" opacity="0.4">
<animate attributeName="d" dur="10s" repeatCount="indefinite" keyTimes="0;0.333;0.667;1" calcMode="spline"
keySplines="0.5 0 0.5 1;0.5 0 0.5 1;0.5 0 0.5 1" begin="-3.3333333333333335s"
values="M0 0L 0 786.8909553904731Q 240 701.2583618134627 480 681.4242125981768T 960 632.4496279828533T 1440 529.0590793857682T 1920 362.72498457606815L 1920 0 Z;M0 0L 0 833.9584624186427Q 240 735.4403353186682 480 702.4020046056404T 960 570.4767335180484T 1440 450.08759759097467T 1920 359.1040448444771L 1920 0 Z;M0 0L 0 765.4099774301828Q 240 704.7963548229467 480 673.7582827447468T 960 656.2104940291773T 1440 425.0093230246074T 1920 271.6894553796988L 1920 0 Z;M0 0L 0 786.8909553904731Q 240 701.2583618134627 480 681.4242125981768T 960 632.4496279828533T 1440 529.0590793857682T 1920 362.72498457606815L 1920 0 Z"></animate>
</path>
<path d="" fill="url(#lg-0.519274329747355)" opacity="0.4">
<animate attributeName="d" dur="10s" repeatCount="indefinite" keyTimes="0;0.333;0.667;1" calcMode="spline"
keySplines="0.5 0 0.5 1;0.5 0 0.5 1;0.5 0 0.5 1" begin="-5s"
values="M0 0L 0 822.4557366212265Q 240 765.5066045370316 480 719.2819384572789T 960 540.3639065906938T 1440 527.150908480367T 1920 414.5631837554528L 1920 0 Z;M0 0L 0 875.5260228215574Q 240 794.7141130311742 480 756.8415527267248T 960 651.9097097189215T 1440 550.8682975628969T 1920 337.0562067352248L 1920 0 Z;M0 0L 0 873.748659659927Q 240 797.5211793320077 480 781.1044419661057T 960 608.6345675815076T 1440 462.75312160161303T 1920 361.48332490728023L 1920 0 Z;M0 0L 0 822.4557366212265Q 240 765.5066045370316 480 719.2819384572789T 960 540.3639065906938T 1440 527.150908480367T 1920 414.5631837554528L 1920 0 Z"></animate>
</path>
<path d="" fill="url(#lg-0.519274329747355)" opacity="0.4">
<animate attributeName="d" dur="10s" repeatCount="indefinite" keyTimes="0;0.333;0.667;1" calcMode="spline"
keySplines="0.5 0 0.5 1;0.5 0 0.5 1;0.5 0 0.5 1" begin="-6.666666666666667s"
values="M0 0L 0 873.647875622009Q 240 765.5359005266773 480 737.8271639269435T 960 543.31426199662T 1440 454.9947328786053T 1920 429.06869345810384L 1920 0 Z;M0 0L 0 810.5839078080603Q 240 657.087523035116 480 631.0404451118314T 960 613.5463982001205T 1440 508.62448745772207T 1920 474.77480760232476L 1920 0 Z;M0 0L 0 879.1645841568322Q 240 708.8217616107146 480 676.661694158219T 960 502.78360994854404T 1440 406.1982594036439T 1920 347.64231444300896L 1920 0 Z;M0 0L 0 873.647875622009Q 240 765.5359005266773 480 737.8271639269435T 960 543.31426199662T 1440 454.9947328786053T 1920 429.06869345810384L 1920 0 Z"></animate>
</path>
<path d="" fill="url(#lg-0.519274329747355)" opacity="0.4">
<animate attributeName="d" dur="10s" repeatCount="indefinite" keyTimes="0;0.333;0.667;1" calcMode="spline"
keySplines="0.5 0 0.5 1;0.5 0 0.5 1;0.5 0 0.5 1" begin="-8.333333333333334s"
values="M0 0L 0 733.9093912932839Q 240 778.6160456622737 480 761.2933820552004T 960 532.4871003060606T 1440 530.0169721737684T 1920 334.6896655690745L 1920 0 Z;M0 0L 0 793.9134378152942Q 240 732.3392293126255 480 703.3910208231505T 960 553.26103152101T 1440 522.0902204190934T 1920 271.62904995207697L 1920 0 Z;M0 0L 0 775.4813280019614Q 240 765.9027552225774 480 714.7381461623293T 960 566.8546168573004T 1440 504.35305448396156T 1920 504.4404420245271L 1920 0 Z;M0 0L 0 733.9093912932839Q 240 778.6160456622737 480 761.2933820552004T 960 532.4871003060606T 1440 530.0169721737684T 1920 334.6896655690745L 1920 0 Z"></animate>
</path>
</g>
</svg>
......@@ -98,6 +98,7 @@ export const layout: RunTimeLayoutConfig = ({initialState, setInitialState}) =>
content: initialState?.currentUser?.user.username + " " + new Date().toLocaleString(),
fontColor: theme === THEME.light|| undefined ? "rgba(0, 0, 0, 0.15)" : "rgba(255, 255, 255, 0.15)",
},
isChildrenLayout: true,
onPageChange: () => {
const {location} = history;
// 如果没有登录,重定向到 login
......@@ -105,26 +106,6 @@ export const layout: RunTimeLayoutConfig = ({initialState, setInitialState}) =>
history.push(loginPath);
}
},
layoutBgImgList: [
{
src: "https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/D2LWSqNny4sAAAAAAAAAAAAAFl94AQBr",
left: 85,
bottom: 100,
height: "303px",
},
{
src: "https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/C2TWRpJpiC0AAAAAAAAAAAAAFl94AQBr",
bottom: -68,
right: -45,
height: "303px",
},
{
src: "https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/F6vSTbj8KpYAAAAAAAAAAAAAFl94AQBr",
bottom: 0,
left: 0,
width: "331px",
},
],
menuHeaderRender: undefined,
// 自定义 403 页面
unAccessible:<UnAccessible/>,
......
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {useSpring, animated} from "react-spring";
const FadeIn = (props: any) => {
const {children} = props;
const fadeIn = useSpring({
opacity: 1,
from: {opacity: 0},
config: {
duration: 1000,
delay: 1000,
},
});
return <animated.div style={fadeIn}>{children}</animated.div>;
};
export default FadeIn;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { useSpring, animated } from 'react-spring';
const Scale = (props:any) => {
const {children} = props;
const scale = useSpring({
transform: 'scale(1)',
from: { transform: 'scale(0)' },
config: { tension: 2000, friction: 300, duration: 500 },
});
return (
<animated.div style={scale}>
{children}
</animated.div>
);
}
export default Scale
......@@ -24,9 +24,7 @@ const Footer: React.FC = () => {
const currentYear = new Date().getFullYear();
return (
<DefaultFooter
style={{
background: 'none',
}}
style={{background: 'none'}}
copyright={`${currentYear} ` + l('app.copyright.produced')}
links={[
{
......
......@@ -21,11 +21,77 @@ body,
height: 100%;
margin: 0;
padding: 0;
overflow-x: auto;
overflow-y: auto;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
'Noto Color Emoji';
}
// .login-form style --- start ----
.content {
padding: 32px 0 24px;
}
.top {
text-align: center;
}
.header {
height: 100px;
line-height: 144px;
position: relative;
font-weight: 600;
font-size: 4rem;
font-family: PMingLiU-ExtB, 'Helvetica Neue', Arial, Helvetica, sans-serif;
}
.logo {
position: absolute;
width: 28vw;
left: -30vw;
top: -5vh;
display: flex;
flex: auto ;
flex-flow: column-reverse;
}
.desc {
margin-bottom: 2rem;
margin-top: 2rem;
color: @text-color-secondary;
font-size: @font-size-base;
}
.loginformMain {
display: flex;
flex: auto;
max-height: max-content;
padding: 0vh 6vh 30vh 2vh;
justify-content: center ;
align-items: center;
flex-direction: column;
background-size: cover;
background-position: left center;
background-repeat: no-repeat;
z-index: 1;
.form{
position: relative;
height: 100%;
box-shadow: 0 0 10px 5px rgba(0, 0, 0, 0.4);
margin-left: 60vw;
margin-bottom: -15vh;
}
.loginform {
padding: 2vh 2vw;
}
}
// .login-form style --- end ----
// scrollbar style --- start ----
::-webkit-scrollbar {
width: 0.5vw;
......
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import React from "react";
import {CheckCard} from "@ant-design/pro-components";
import {UserBaseInfo} from "@/types/User/data";
import {CheckGroupValueType} from "@ant-design/pro-card/es/components/CheckCard/Group";
type TenantCardProps = {
tenant: UserBaseInfo.Tenant[];
handleChangeTenant: (value :CheckGroupValueType) => void
}
const TenantCard: React.FC<TenantCardProps> = (props) => {
const {tenant,handleChangeTenant} = props;
const chooseCard = () => {
let cardList: any[] = [];
// if no tenant is selected, the confirm button is disabled
if (tenant) {
cardList = tenant.map((item: any) => {
return (
<CheckCard
size={"default"}
key={item?.id}
avatar="/icons/tenant_default.svg"
title={item?.tenantCode}
value={item?.id}
description={item?.note}
/>
);
});
}
return cardList;
};
return <>
<CheckCard.Group
multiple={false}
onChange={handleChangeTenant}
>
{chooseCard()}
</CheckCard.Group>
</>;
};
export default TenantCard;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import {l} from "@/utils/intl";
import {Modal} from "antd";
import {setTenantStorageAndCookie} from "@/utils/function";
import React, {useState} from "react";
import {UserBaseInfo} from "@/types/User/data";
import TenantCard from "@/pages/Other/Login/ChooseModal/TenantCard";
import {NORMAL_MODAL_OPTIONS} from "@/services/constants";
import {CheckGroupValueType} from "@ant-design/pro-card/es/components/CheckCard/Group";
type ChooseModalProps = {
tenantVisible: boolean;
handleTenantVisible: () => void;
submitting: boolean;
handleChooseTenant: (tenantId: number) => void
tenant: UserBaseInfo.Tenant[]
}
const ChooseModal: React.FC<ChooseModalProps> = (props) => {
const {tenantVisible, handleTenantVisible, submitting, tenant,handleChooseTenant} = props;
const [check, setChecked] = useState<boolean>(true);
const [checkedTenantId, setCheckedTenantId] = useState<any>();
const tenantChange = (value: CheckGroupValueType) => {
if (value) {
// if no tenant is selected, the confirm button is disabled
setChecked(false);
setCheckedTenantId(value );
setTenantStorageAndCookie(value as number);
// setTenantIdParams(value as number);
} else {
setChecked(true);
}
};
return <>
<Modal
title={l("login.chooseTenant")}
open={tenantVisible}
{...NORMAL_MODAL_OPTIONS}
onCancel={handleTenantVisible}
onOk={() => handleChooseTenant(checkedTenantId)}
okText={l("button.confirm")}
okButtonProps={{
disabled: check,
loading: submitting
}}
>
<TenantCard tenant={tenant} handleChangeTenant={tenantChange}/>
</Modal>
</>;
};
export default ChooseModal;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import {l} from "@/utils/intl";
import Settings from "../../../../../config/defaultSettings";
import {Helmet} from "@@/exports";
import React from "react";
export default () => {
return <>
<Helmet>
<title>
{l("menu.login")} - {Settings.title}
</title>
</Helmet>
</>
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {useEmotionCss} from "@ant-design/use-emotion-css";
import {SelectLang} from "@@/exports";
import React from "react";
const LangSwitch = () => {
const langClassName = useEmotionCss(({token}) => {
return {
width: 42,
lineHeight: "42px",
position: "absolute",
top: 10,
right: 10,
borderRadius: token.borderRadius,
zIndex: 9999,
":hover": {
backgroundColor: token.colorBgTextHover,
},
};
});
return <div className={langClassName}>
{SelectLang && <SelectLang/>}
</div>
;
};
export default LangSwitch;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {l} from "@/utils/intl";
import React from "react";
import Settings from "../../../../../../config/defaultSettings";
import style from "../../../../../global.less";
import Scale from "@/components/Animation/Scale";
const MainWithStyle = (props: any) => {
const {children} = props;
return <div
className={style.loginformMain}
style={{backgroundImage: `url('/icons/main-bg.svg')`}}
>
<Scale><img className={style.logo} src={Settings.logo}/></Scale>
<div className={style.form}>
<div className={style.top}>
<div className={style.header}>Dinky</div>
<div className={style.desc}>{l("layouts.userLayout.title")}</div>
</div>
{children}
</div>
</div>;
};
export default MainWithStyle;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import React, {useState} from "react";
import {l} from "@/utils/intl";
import {ProForm, ProFormCheckbox, ProFormText} from "@ant-design/pro-components";
import {LockOutlined, UserOutlined} from "@ant-design/icons";
import MainWithStyle from "./MainWithStyle";
import {SubmitterProps} from "@ant-design/pro-form/es/components";
import style from "../../../../global.less";
import FadeIn from "@/components/Animation/FadeIn";
type LoginFormProps = {
onSubmit: (values: any) => Promise<void>;
}
const LoginForm: React.FC<LoginFormProps> = (props) => {
const {onSubmit} = props;
const [form] = ProForm.useForm();
const [submitting, setSubmitting] = useState(false);
const handleClickLogin = async () => {
setSubmitting(true);
await onSubmit({...form.getFieldsValue()});
setSubmitting(false);
};
const renderLoginForm = () => {
return <>
<ProFormText
name="username"
width={"lg"}
fieldProps={{
prefix: <UserOutlined/>,
}}
required
placeholder={l("login.username.placeholder")}
rules={[
{
required: true,
message: l("login.username.required"),
},
]}
/>
<ProFormText.Password
name="password"
fieldProps={{
prefix: <LockOutlined/>,
}}
placeholder={l("login.password.placeholder")}
rules={[
{
required: true,
message: l("login.password.required"),
},
]}
/>
<ProFormCheckbox name="autoLogin">
{l("login.rememberMe")}
</ProFormCheckbox>
</>;
};
const proFormSubmitter: SubmitterProps = {
searchConfig: {submitText: l("menu.login")},
resetButtonProps: false,
submitButtonProps: {
loading: submitting,
size: "large",
shape: "round",
style: {width: "100%"}
}
};
return <MainWithStyle>
<FadeIn>
<ProForm
className={style.loginform}
form={form}
onFinish={handleClickLogin}
initialValues={{autoLogin: true}}
submitter={{...proFormSubmitter}}
>
{renderLoginForm()}
</ProForm>
</FadeIn>
</MainWithStyle>;
};
export default LoginForm;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import {history} from "@@/core/history";
/** 此方法会跳转到 redirect 参数所在的位置 */
export const gotoRedirectUrl = () => {
if (!history) return;
setTimeout(() => {
const urlParams = new URL(window.location.href).searchParams;
history.push(urlParams.get("redirect") || "/");
}, 10);
};
This diff is collapsed.
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