新增首页modal导航

This commit is contained in:
何童崇 2022-04-21 10:42:17 +08:00
parent 129f7eab8d
commit f129a2cc7d
7 changed files with 86 additions and 1 deletions

View File

@ -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);

View File

@ -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;
}
}

BIN
src/home/img/modal.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 295 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 KiB

View File

@ -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