mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-06 16:53:42 +08:00
Initial commit
This commit is contained in:
78
web/src/pages/Home/index.js
Normal file
78
web/src/pages/Home/index.js
Normal file
@@ -0,0 +1,78 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user