fix: 更新首页内容 (#1495)

Reviewed-on: daoyoucloud/tachybase#1495
Co-authored-by: wjh <wwwjh0710@163.com>
Co-committed-by: wjh <wwwjh0710@163.com>
This commit is contained in:
wjh 2024-08-29 16:33:43 +08:00 committed by bai.zixv
parent b4ca48201b
commit e11da78904
2 changed files with 58 additions and 112 deletions

View File

@ -1,69 +1,47 @@
import React from 'react'; import React from 'react';
import { useRequest } from '@tachybase/client';
import { Carousel, Image } from 'antd'; import { Button, Col, Image, Row } from 'antd';
import { useStyles } from './style'; import { useStyles } from './style';
export const HomePage: React.FC<{}> = () => { export const HomePage: React.FC<{}> = () => {
const { styles } = useStyles(); const { styles } = useStyles();
const { data, loading } = useRequest<{ data: any }>({ const onClick = () => {
url: 'home_page_presentations:list', window.location.href = '/admin';
params: { };
'appends[]': 'pictures',
},
});
if (loading) {
return;
}
const date = new Date(); const date = new Date();
const year = date.getFullYear(); const year = date.getFullYear();
return ( return (
<div className={styles.home}> <div className={styles.home}>
<header> <header>
<div className="headerStyle"> <Row className="headerStyle">
<span className="headerTitle"></span> <Col span={4}>
<ul> <span className="headerTitle"></span>
<li className="active"></li> </Col>
<li></li> <Col span={15}>
<li></li> <ul>
<li></li> <li className="active"></li>
<li></li> <li></li>
</ul> <li></li>
</div> <li></li>
<li></li>
</ul>
</Col>
<Col span={5}>
<Button type="primary" onClick={onClick}>
</Button>
</Col>
</Row>
</header> </header>
<main> <main>
<Carousel autoplay> <Image
{data?.data?.map((item) => ( preview={false}
<div key={item.id}> src="https://tachybase-1321007335.cos.ap-shanghai.myqcloud.com/de1b13e4e7f31e4b6c012f9290aff6dc.jpg"
<Image preview={false} src={item.pictures[0].url} /> />
</div> <Button onClick={onClick}></Button>
))}
</Carousel>
</main> </main>
<footer> <footer>©2023-{year} ICP备2023024678号</footer>
<ul>
<li>
<a></a>
</li>
<li>
<a></a>
</li>
<li>
<a></a>
</li>
<li>
<a></a>
</li>
<li>
<a href="/admin"></a>
</li>
</ul>
<div>
<span>©2023-{year} ICP备2023024678号</span>
</div>
</footer>
</div> </div>
); );
}; };

View File

@ -9,28 +9,27 @@ export const useStyles = createStyles(({ css }) => ({
header { header {
.headerStyle { .headerStyle {
width: 100%; width: 100%;
height: 60px; height: 80px;
background-color: #f7f7f7;
display: flex; display: flex;
align-items: center; align-items: center;
border-radius: 8px; border-radius: 8px;
box-shadow: 0 0 1px 1px #e3e3e3; padding: 0px 20px 0px 20px;
padding: 0px 10px 0px 15px;
.headerTitle { .headerTitle {
height: 60px; height: 60px;
color: #6c6c6c; color: #6c6c6c;
font-size: 20px; font-size: 20px;
font-weight: 400; font-weight: 400;
line-height: 60px; text-align: right;
} }
ul { ul {
color: #6c6c6c; color: #6c6c6c;
display: flex; display: flex;
justify-content: space-evenly;
align-items: center; align-items: center;
height: 100%; height: 100%;
margin-top: 0; margin-top: 0;
margin-bottom: 0; margin-bottom: 0;
padding: 0 0 0 25px; padding: 0 20px 0 20px;
li { li {
list-style: none; list-style: none;
padding-left: 5px; padding-left: 5px;
@ -38,76 +37,45 @@ export const useStyles = createStyles(({ css }) => ({
text-align: center; text-align: center;
height: 100%; height: 100%;
line-height: 60px; line-height: 60px;
cursor: pointer;
&:hover { &:hover {
background-color: #e3e3e3; color: #3578e2;
} }
} }
.active { .active {
background-color: #e3e3e3; color: #3578e2;
}
}
.ant-btn {
width: 70%;
height: 50px;
&:hover {
color: white;
} }
} }
} }
} }
main { main {
padding: 20px 10px;
height: 500px; height: 500px;
div { position: relative;
height: 500px; img {
img { width: 100%;
width: 100%; height: auto;
height: auto;
}
} }
.ant-carousel .slick-dots-bottom { .ant-btn {
bottom: 50px; width: 10%;
} height: 50px;
.ant-carousel .slick-dots li { position: absolute;
width: 10px; top: 48%;
height: 10px; left: 56%;
border-radius: 50px; border-radius: 20px;
border: 1px solid #ffffff;
}
.ant-carousel .slick-dots li button {
width: 10px;
height: 10px;
border-radius: 50px;
opacity: 0;
}
.ant-carousel .slick-dots li.slick-active button {
opacity: 1;
} }
} }
footer { footer {
position: absolute;
bottom: -30px;
width: 100%; width: 100%;
display: flex; text-align: center;
flex-direction: column;
justify-content: center;
align-items: center;
margin-top: 22px;
a {
color: #3372af;
}
ul {
display: flex;
margin: 0;
bottom: 0;
li {
list-style: none;
a {
border-right: 1.5px solid black;
padding: 0 5px;
}
&:nth-last-child(1) a {
border-right: 0;
}
}
}
div {
a {
margin-left: 5px;
}
}
} }
`, `,
})); }));