forked from Gitlink/forgeplus-react
新增首页modal导航
This commit is contained in:
parent
129f7eab8d
commit
f129a2cc7d
|
@ -0,0 +1,45 @@
|
|||
import React, { memo, useEffect, useState } from 'react';
|
||||
import { Button, Modal } from 'antd';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
import bg from '../img/modal.png';
|
||||
import './index.scss';
|
||||
|
||||
|
||||
|
||||
function QzModal() {
|
||||
|
||||
const [visible, setVisible] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
let qzModalTime = localStorage.qzModalTime;
|
||||
let nowTime = new Date().getTime();
|
||||
if (qzModalTime) {
|
||||
if (nowTime - qzModalTime > 24 * 3600 * 1000) {
|
||||
setVisible(true);
|
||||
localStorage.setItem('qzModalTime', nowTime);
|
||||
}
|
||||
} else {
|
||||
setVisible(true);
|
||||
localStorage.setItem('qzModalTime', nowTime);
|
||||
}
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<Modal
|
||||
title="Basic Modal"
|
||||
visible={visible}
|
||||
onCancel={() => { setVisible(false) }}
|
||||
footer={null}
|
||||
className='qzModal'
|
||||
width='728px'
|
||||
maskClosable={false}
|
||||
>
|
||||
<img src={bg} />
|
||||
|
||||
<Link to="/competition/qz2022" className="qz-btn">查看详情</Link>
|
||||
</Modal>
|
||||
)
|
||||
}
|
||||
|
||||
export default memo(QzModal);
|
|
@ -0,0 +1,39 @@
|
|||
.qzModal {
|
||||
.ant-modal-body {
|
||||
padding: 0;
|
||||
|
||||
img {
|
||||
border-radius: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.ant-modal-header {
|
||||
height: 0;
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.ant-modal-close {
|
||||
top: 0 !important;
|
||||
}
|
||||
.ant-modal-close-icon {
|
||||
border: 1px solid #fff;
|
||||
color: #fff;
|
||||
border-radius: 50%;
|
||||
padding: 5%;
|
||||
}
|
||||
|
||||
.qz-btn {
|
||||
position: absolute;
|
||||
bottom: -70px;
|
||||
left: 295px;
|
||||
width: 137px;
|
||||
height: 49px;
|
||||
background-color: #e96d2a;
|
||||
border-color: #e96d2a;
|
||||
border-radius: 6px;
|
||||
color: #fff;
|
||||
font-size:16px;
|
||||
text-align: center;
|
||||
line-height: 49px;
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 295 KiB |
Binary file not shown.
After Width: | Height: | Size: 306 KiB |
|
@ -4,6 +4,7 @@ import { isMobile } from 'educoder';
|
|||
import './index.scss';
|
||||
|
||||
import Slider from './Slider';
|
||||
import QzModal from './QzModal';
|
||||
import FirstSection from './FirstSection';
|
||||
import SecondSection from './SecondSection';
|
||||
import ThirdSection from './ThirdSection';
|
||||
|
@ -128,7 +129,7 @@ function HomePage({ history }) {
|
|||
<div className="homePage">
|
||||
|
||||
<Slider />
|
||||
|
||||
<QzModal />
|
||||
<div id="home-first-section" className="home-first-section">
|
||||
<FirstSection first={first} />
|
||||
</div>
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 475 KiB After Width: | Height: | Size: 497 KiB |
Binary file not shown.
Before Width: | Height: | Size: 518 KiB After Width: | Height: | Size: 542 KiB |
Loading…
Reference in New Issue