11import * as React from 'react' ;
2- import { Layout } from 'antd' ;
2+ import { Layout , Modal } from 'antd' ;
33import classnames from 'classnames' ;
44import { renderRoutes } from 'react-router-config'
55import './style.scss' ;
66import Header from '../header/header' ;
7+ import { ChromeOutlined } from '@ant-design/icons' ;
78const { Content} = Layout ;
89
910const BasicLayout = ( props : any ) => {
10- const { className, route, location} = props ;
11+ const { className, route, location} = props ;
1112 const { pathname } = location ;
13+
14+ // 如果弹出过哆啦A梦 Chrome 插件的弹框,则后续不再弹出
15+ React . useEffect ( ( ) => {
16+ const key = 'show_chrome_tool'
17+ const hasBeenShowed = localStorage . getItem ( key ) === 'yes'
18+ const chromeToolUrl = 'https://github.com/JackWang032/doraemon-proxy-tool'
19+
20+ ! hasBeenShowed && Modal . info ( {
21+ title : '哆啦A梦 Chrome 插件' ,
22+ icon : < ChromeOutlined /> ,
23+ content : < >
24+ < p > 支持代理服务的快速切换环境、数栈自动登录等功能,请点击下方链接了解详情:</ p >
25+ < a href = { chromeToolUrl } target = '_blank' > { chromeToolUrl } </ a >
26+ </ > ,
27+ onOk ( ) {
28+ localStorage . setItem ( key , 'yes' )
29+ }
30+ } ) ;
31+ } , [ pathname ] )
32+
1233 return (
1334 < Layout className = "layout-basic" >
1435 < Header location = { location } />
@@ -17,4 +38,4 @@ const BasicLayout = (props: any)=>{
1738 </ Content >
1839 </ Layout > )
1940}
20- export default BasicLayout ;
41+ export default BasicLayout ;
0 commit comments