Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
b381d994
authored
Dec 11, 2024
by
CalciumIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 首页优化
parent
aa7d5f51
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
17 deletions
+41
-17
web/src/components/HeaderBar.js
+31
-17
web/src/index.css
+8
-0
web/src/pages/Home/index.js
+2
-0
No files found.
web/src/components/HeaderBar.js
View file @
b381d994
...
@@ -33,14 +33,6 @@ let headerButtons = [
...
@@ -33,14 +33,6 @@ let headerButtons = [
},
},
];
];
let
buttons
=
[
{
text
:
'首页'
,
itemKey
:
'home'
,
to
:
'/'
,
},
];
if
(
localStorage
.
getItem
(
'chat_link'
))
{
if
(
localStorage
.
getItem
(
'chat_link'
))
{
headerButtons
.
splice
(
1
,
0
,
{
headerButtons
.
splice
(
1
,
0
,
{
name
:
'聊天'
,
name
:
'聊天'
,
...
@@ -64,6 +56,19 @@ const HeaderBar = () => {
...
@@ -64,6 +56,19 @@ const HeaderBar = () => {
currentDate
.
getDate
()
>=
9
&&
currentDate
.
getDate
()
>=
9
&&
currentDate
.
getDate
()
<=
24
);
currentDate
.
getDate
()
<=
24
);
let
buttons
=
[
{
text
:
'首页'
,
itemKey
:
'home'
,
to
:
'/'
,
},
{
text
:
'控制台'
,
itemKey
:
'detail'
,
to
:
'/'
,
},
];
async
function
logout
()
{
async
function
logout
()
{
await
API
.
get
(
'/api/user/logout'
);
await
API
.
get
(
'/api/user/logout'
);
showSuccess
(
'注销成功!'
);
showSuccess
(
'注销成功!'
);
...
@@ -102,21 +107,30 @@ const HeaderBar = () => {
...
@@ -102,21 +107,30 @@ const HeaderBar = () => {
<
div
style
=
{{
width
:
'100%'
}}
>
<
div
style
=
{{
width
:
'100%'
}}
>
<
Nav
<
Nav
mode
=
{
'horizontal'
}
mode
=
{
'horizontal'
}
// bodyStyle={{ height: 100 }}
renderWrapper
=
{({
itemElement
,
isSubNav
,
isInSubNav
,
props
})
=>
{
renderWrapper
=
{({
itemElement
,
isSubNav
,
isInSubNav
,
props
})
=>
{
const
routerMap
=
{
const
routerMap
=
{
about
:
'/about'
,
about
:
'/about'
,
login
:
'/login'
,
login
:
'/login'
,
register
:
'/register'
,
register
:
'/register'
,
detail
:
'/detail'
,
home
:
'/'
,
home
:
'/'
,
};
};
return
(
return
(
<
Link
<
div
onClick
=
{(
e
)
=>
{
style
=
{{
textDecoration
:
'none'
}}
if
(
props
.
itemKey
===
'home'
)
{
to
=
{
routerMap
[
props
.
itemKey
]}
styleDispatch
({
type
:
'SET_SIDER'
,
payload
:
true
});
>
}
else
{
{
itemElement
}
styleDispatch
({
type
:
'SET_SIDER'
,
payload
:
false
});
<
/Link
>
}
}}
>
<
Link
className
=
"header-bar-text"
style
=
{{
textDecoration
:
'none'
}}
to
=
{
routerMap
[
props
.
itemKey
]}
>
{
itemElement
}
<
/Link
>
<
/div
>
);
);
}}
}}
selectedKeys
=
{[]}
selectedKeys
=
{[]}
...
@@ -127,10 +141,10 @@ const HeaderBar = () => {
...
@@ -127,10 +141,10 @@ const HeaderBar = () => {
<>
<>
{
{
styleState
.
showSider
?
styleState
.
showSider
?
<
Button
icon
=
{
<
IconMenu
/>
}
theme
=
"light"
style
=
{{
marginRight
:
10
}}
aria
-
label
=
"展开侧边栏"
onClick
=
{
<
Button
icon
=
{
<
IconMenu
/>
}
theme
=
"light"
aria
-
label
=
"展开侧边栏"
onClick
=
{
()
=>
styleDispatch
({
type
:
'SET_SIDER'
,
payload
:
false
})
()
=>
styleDispatch
({
type
:
'SET_SIDER'
,
payload
:
false
})
}
/>
:
}
/>
:
<
Button
icon
=
{
<
IconIndentLeft
/>
}
theme
=
"light"
style
=
{{
marginRight
:
10
}}
aria
-
label
=
"关闭侧边栏"
onClick
=
{
<
Button
icon
=
{
<
IconIndentLeft
/>
}
theme
=
"light"
aria
-
label
=
"关闭侧边栏"
onClick
=
{
()
=>
styleDispatch
({
type
:
'SET_SIDER'
,
payload
:
true
})
()
=>
styleDispatch
({
type
:
'SET_SIDER'
,
payload
:
true
})
}
/
>
}
/
>
}
}
...
...
web/src/index.css
View file @
b381d994
...
@@ -17,6 +17,10 @@ body {
...
@@ -17,6 +17,10 @@ body {
flex-direction
:
column
;
flex-direction
:
column
;
}
}
#root
>
section
>
header
>
section
>
div
>
div
>
div
>
div
.semi-navigation-header-list-outer
>
div
.semi-navigation-list-wrapper
>
ul
>
div
>
a
>
li
>
span
{
font-weight
:
600
!important
;
}
@media
only
screen
and
(
max-width
:
767px
)
{
@media
only
screen
and
(
max-width
:
767px
)
{
.semi-table-tbody
,
.semi-table-tbody
,
.semi-table-row
,
.semi-table-row
,
...
@@ -39,6 +43,10 @@ body {
...
@@ -39,6 +43,10 @@ body {
row-gap
:
3px
;
row-gap
:
3px
;
column-gap
:
10px
;
column-gap
:
10px
;
}
}
.semi-navigation-horizontal
.semi-navigation-header
{
margin-right
:
0
;
}
}
}
.semi-table-tbody
>
.semi-table-row
>
.semi-table-row-cell
{
.semi-table-tbody
>
.semi-table-row
>
.semi-table-row-cell
{
...
...
web/src/pages/Home/index.js
View file @
b381d994
...
@@ -3,11 +3,13 @@ import { Card, Col, Row } from '@douyinfe/semi-ui';
...
@@ -3,11 +3,13 @@ import { Card, Col, Row } from '@douyinfe/semi-ui';
import
{
API
,
showError
,
showNotice
,
timestamp2string
}
from
'../../helpers'
;
import
{
API
,
showError
,
showNotice
,
timestamp2string
}
from
'../../helpers'
;
import
{
StatusContext
}
from
'../../context/Status'
;
import
{
StatusContext
}
from
'../../context/Status'
;
import
{
marked
}
from
'marked'
;
import
{
marked
}
from
'marked'
;
import
{
StyleContext
}
from
'../../context/Style/index.js'
;
const
Home
=
()
=>
{
const
Home
=
()
=>
{
const
[
statusState
]
=
useContext
(
StatusContext
);
const
[
statusState
]
=
useContext
(
StatusContext
);
const
[
homePageContentLoaded
,
setHomePageContentLoaded
]
=
useState
(
false
);
const
[
homePageContentLoaded
,
setHomePageContentLoaded
]
=
useState
(
false
);
const
[
homePageContent
,
setHomePageContent
]
=
useState
(
''
);
const
[
homePageContent
,
setHomePageContent
]
=
useState
(
''
);
const
[
styleState
,
styleDispatch
]
=
useContext
(
StyleContext
);
const
displayNotice
=
async
()
=>
{
const
displayNotice
=
async
()
=>
{
const
res
=
await
API
.
get
(
'/api/notice'
);
const
res
=
await
API
.
get
(
'/api/notice'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment