79 lines
2.3 KiB
JavaScript
79 lines
2.3 KiB
JavaScript
|
|
import React, { useEffect } from 'react';
|
||
|
|
import { Grid, Header, Placeholder, Segment } from 'semantic-ui-react';
|
||
|
|
import { API, showError, showNotice } from '../../helpers';
|
||
|
|
|
||
|
|
const Home = () => {
|
||
|
|
const displayNotice = async () => {
|
||
|
|
const res = await API.get('/api/notice');
|
||
|
|
const { success, message, data } = res.data;
|
||
|
|
if (success) {
|
||
|
|
let oldNotice = localStorage.getItem('notice');
|
||
|
|
if (data !== oldNotice && data !== '') {
|
||
|
|
showNotice(data);
|
||
|
|
localStorage.setItem('notice', data);
|
||
|
|
}
|
||
|
|
} else {
|
||
|
|
showError(message);
|
||
|
|
}
|
||
|
|
};
|
||
|
|
|
||
|
|
useEffect(() => {
|
||
|
|
displayNotice().then();
|
||
|
|
}, []);
|
||
|
|
return (
|
||
|
|
<>
|
||
|
|
<Segment>
|
||
|
|
<Header as="h3">示例标题</Header>
|
||
|
|
<Grid columns={3} stackable>
|
||
|
|
<Grid.Column>
|
||
|
|
<Segment raised>
|
||
|
|
<Placeholder>
|
||
|
|
<Placeholder.Header image>
|
||
|
|
<Placeholder.Line />
|
||
|
|
<Placeholder.Line />
|
||
|
|
</Placeholder.Header>
|
||
|
|
<Placeholder.Paragraph>
|
||
|
|
<Placeholder.Line length="medium" />
|
||
|
|
<Placeholder.Line length="short" />
|
||
|
|
</Placeholder.Paragraph>
|
||
|
|
</Placeholder>
|
||
|
|
</Segment>
|
||
|
|
</Grid.Column>
|
||
|
|
|
||
|
|
<Grid.Column>
|
||
|
|
<Segment raised>
|
||
|
|
<Placeholder>
|
||
|
|
<Placeholder.Header image>
|
||
|
|
<Placeholder.Line />
|
||
|
|
<Placeholder.Line />
|
||
|
|
</Placeholder.Header>
|
||
|
|
<Placeholder.Paragraph>
|
||
|
|
<Placeholder.Line length="medium" />
|
||
|
|
<Placeholder.Line length="short" />
|
||
|
|
</Placeholder.Paragraph>
|
||
|
|
</Placeholder>
|
||
|
|
</Segment>
|
||
|
|
</Grid.Column>
|
||
|
|
|
||
|
|
<Grid.Column>
|
||
|
|
<Segment raised>
|
||
|
|
<Placeholder>
|
||
|
|
<Placeholder.Header image>
|
||
|
|
<Placeholder.Line />
|
||
|
|
<Placeholder.Line />
|
||
|
|
</Placeholder.Header>
|
||
|
|
<Placeholder.Paragraph>
|
||
|
|
<Placeholder.Line length="medium" />
|
||
|
|
<Placeholder.Line length="short" />
|
||
|
|
</Placeholder.Paragraph>
|
||
|
|
</Placeholder>
|
||
|
|
</Segment>
|
||
|
|
</Grid.Column>
|
||
|
|
</Grid>
|
||
|
|
</Segment>
|
||
|
|
</>
|
||
|
|
);
|
||
|
|
};
|
||
|
|
|
||
|
|
export default Home;
|