Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mes-kanban
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ximai
mes-kanban
Commits
b50971f0
Commit
b50971f0
authored
Nov 16, 2024
by
沈翠玲
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
欢迎页自适应
parent
96011e8a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
7 deletions
+25
-7
app.tsx
src/app.tsx
+2
-0
Welcome.less
src/pages/Welcome.less
+3
-2
Welcome.tsx
src/pages/Welcome.tsx
+20
-5
No files found.
src/app.tsx
View file @
b50971f0
...
...
@@ -206,7 +206,9 @@ export async function getInitialState(): Promise<{
// 如果是登录页面,不执行
if
(
history
.
location
.
pathname
!==
loginPath
)
{
const
currentUser
=
await
fetchUserInfo
();
console
.
log
(
'currentUser'
,
currentUser
)
if
(
currentUser
&&
currentUser
.
user
.
locale
)
{
console
.
log
(
'locale'
,
currentUser
.
user
.
locale
)
setLocale
(
currentUser
.
user
.
locale
)
}
return
{
...
...
src/pages/Welcome.less
View file @
b50971f0
...
...
@@ -8,14 +8,15 @@
}
.container {
width: 1
00%
;
width: 1
920px
;
display: flex;
color: #fff;
overflow: hidden;
position: relative;
flex-direction: column;
transform-origin: top left;
align-items: center;
height: 10
0%
;
height: 10
80px
;
color: white;
background: #00204c;
}
...
...
src/pages/Welcome.tsx
View file @
b50971f0
import
React
,
{
useState
,
useEffect
,
useCallback
}
from
'react'
;
import
{
useIntl
,
useModel
}
from
'umi'
;
import
{
useHistory
}
from
'react-router-dom'
;
import
{
delay
,
floor
}
from
'lodash'
;
import
styles
from
'./Welcome.less'
;
import
{
logout
as
outLogin
}
from
'@/services/mgr/api'
;
const
Welcome
:
React
.
FC
=
()
=>
{
const
intl
=
useIntl
();
const
{
initialState
,
setInitialState
}
=
useModel
(
'@@initialState'
);
const
[
kanbanList
,
setkanbanList
]
=
useState
([]);
const
[
scaleWidth
,
setScaleWidth
]
=
useState
(
1
);
const
[
scaleHeight
,
setScaleHeight
]
=
useState
(
1
);
const
resetScale
=
()
=>
{
setScaleWidth
(
floor
(
document
.
body
.
clientWidth
/
1920
,
4
));
setScaleHeight
(
floor
(
document
.
body
.
clientHeight
/
1080
,
4
));
delay
(
()
=>
{
setScaleWidth
(
floor
(
document
.
body
.
clientWidth
/
1920
,
4
));
setScaleHeight
(
floor
(
document
.
body
.
clientHeight
/
1080
,
4
));
},
1
,
20
,
);
};
useEffect
(()
=>
{
if
(
initialState
?.
menuList
)
{
console
.
log
(
'sada'
,
initialState
?.
menuList
)
const
menuList
=
initialState
?.
menuList
const
item
=
menuList
.
find
(
v
=>
v
.
name
===
'kanban'
)
if
(
item
?.
children
)
{
setkanbanList
(
item
?.
children
)
}
}
document
.
body
.
onresize
=
()
=>
resetScale
();
resetScale
()
},
[]);
const
history
=
useHistory
();
// 跳转函数
...
...
@@ -43,7 +56,9 @@ const Welcome: React.FC = () => {
}
},
[
setInitialState
]);
return
(
<
div
className=
{
styles
.
container
}
>
<
div
className=
{
styles
.
container
}
style=
{
{
transform
:
`scale(${scaleWidth},${scaleHeight})`
,
}
}
>
<
div
className=
{
styles
.
logout
}
onClick=
{
()
=>
loginOut
()
}
>
{
intl
.
formatMessage
({
id
:
'退出登录'
})
}
</
div
>
...
...
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