Skip to content

Commit 790d64c

Browse files
authored
feat: show chrome tool (#77)
1 parent 310a71f commit 790d64c

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed
Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,35 @@
11
import * as React from 'react';
2-
import {Layout } from 'antd';
2+
import { Layout, Modal } from 'antd';
33
import classnames from 'classnames';
44
import { renderRoutes } from 'react-router-config'
55
import './style.scss';
66
import Header from '../header/header';
7+
import { ChromeOutlined } from '@ant-design/icons';
78
const { Content} = Layout;
89

910
const 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

Comments
 (0)