Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
ems3.3
Project
Project
Details
Activity
Releases
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
wuhao
ems3.3
Commits
7fa62c3f
Commit
7fa62c3f
authored
Dec 15, 2022
by
wuhao
🎯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
asder
parent
c7729c19
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
83 additions
and
87 deletions
+83
-87
app.jsx
src/app.jsx
+35
-65
index.jsx
src/components/DrawerPro/index.jsx
+0
-1
index.jsx
src/components/InitForm/index.jsx
+21
-18
index.jsx
src/components/SiderMenu/index.jsx
+3
-3
global.less
src/global.less
+18
-0
index.jsx
src/pages/device/account/index.jsx
+6
-0
No files found.
src/app.jsx
View file @
7fa62c3f
...
...
@@ -8,12 +8,9 @@ import TagView from '@/components/TagView';
import
SiderMenu
from
'@/components/SiderMenu'
;
import
*
as
Ant4Icons
from
'@ant-design/icons'
;
import
{
createElement
}
from
'react'
;
import
routes
from
'../config/authRoutes'
;
const
{
LinkOutlined
}
=
Ant4Icons
;
// const isDev = process.env.NODE_ENV === 'development';
const
isDev
=
false
;
//console.log(isDev);
const
isDev
=
process
.
env
.
NODE_ENV
===
'development'
;
const
loginPath
=
'/user/login'
;
/**
...
...
@@ -35,7 +32,7 @@ export async function getInitialState() {
const
msg
=
await
queryCurrentUser
();
return
msg
.
data
;
}
catch
(
error
)
{
//
history.push(loginPath);
history
.
push
(
loginPath
);
}
return
undefined
;
};
// 如果是登录页面,不执行
...
...
@@ -48,23 +45,14 @@ export async function getInitialState() {
message
.
error
(
res
.
msg
);
}
return
undefined
;
};
// 如果是登录页面,不执行
};
// 如果是登录页面,不执行
if
(
history
.
location
.
pathname
!==
loginPath
&&
token
)
{
const
currentUserData
=
await
fetchUserInfo
();
let
menuData
;
if
(
currentUserData
?.
data
?.
username
)
{
menuData
=
await
getmenuData
();
}
/* isdev */
if
(
isDev
)
{
menuData
=
{
recentUsePermList
:
[],
collectPerm
:
[],
userHavePermList
:
routes
,
};
}
return
{
fetchUserInfo
,
currentUser
:
currentUserData
?.
data
,
...
...
@@ -74,23 +62,12 @@ export async function getInitialState() {
collapsed
:
false
,
};
}
let
menuData
=
{};
if
(
isDev
)
{
menuData
=
{
recentUsePermList
:
[],
collectPerm
:
[],
userHavePermList
:
routes
,
};
}
return
{
fetchUserInfo
,
settings
:
defaultSettings
,
getmenuData
,
collapsed
:
false
,
tagList
:
[],
newMenu
:
menuData
,
};
}
...
...
@@ -98,18 +75,6 @@ export async function getInitialState() {
export
const
layout
=
({
initialState
,
setInitialState
})
=>
{
let
token
=
localStorage
.
getItem
(
'TOKENES'
);
let
menurender
=
isDev
?
{}
:
{
menuRender
:
(
props
,
defaultDom
)
=>
{
if
(
props
.
isMobile
)
{
return
defaultDom
;
}
else
{
return
<
SiderMenu
{
...
props
}
/>;
}
},
};
return
{
disableContentMargin
:
false
,
waterMarkProps
:
{
...
...
@@ -123,16 +88,16 @@ export const layout = ({ initialState, setInitialState }) => {
onPageChange
:
()
=>
{
const
{
location
}
=
history
;
// 如果没有登录,重定向到 login
//
if (!initialState?.currentUser && location.pathname !== loginPath) {
//
history.push(loginPath);
//
}
if
(
!
initialState
?.
currentUser
&&
location
.
pathname
!==
loginPath
)
{
history
.
push
(
loginPath
);
}
},
links
:
isDev
?
[
//
<Link key="openapi" to="/umi/plugin/openapi" target="_blank">
//
<LinkOutlined />
//
<span>OpenAPI 文档</span>
//
</Link>,
<
Link
key=
"openapi"
to=
"/umi/plugin/openapi"
target=
"_blank"
>
<
LinkOutlined
/>
<
span
>
OpenAPI 文档
</
span
>
</
Link
>,
]
:
[],
//接口获取菜单数据
...
...
@@ -142,26 +107,25 @@ export const layout = ({ initialState, setInitialState }) => {
userId
:
initialState
?.
currentUser
?.
id
,
},
request
:
(
params
,
defaultMenuData
)
=>
{
//console.log(initialState);
let
lastArr
=
initialState
?.
newMenu
?.
userHavePermList
?
JSON
.
parse
(
JSON
.
stringify
(
initialState
?.
newMenu
?.
userHavePermList
))
:
[];
//
newArr = [
// //
{
// //
path: '/welcome',
// //
name: '首页',
// //
icon: 'smile',
// //
component: './Welcome',
// //
haveChildren: false,
// //
key: '000000',
// //
parentKey: '0',
// //
routes: [],
// //
children: null,
// //
title: null,
// //
},
//
].concat(lastArr);
:
[],
newArr
=
[
{
path
:
'/welcome'
,
name
:
'首页'
,
icon
:
'smile'
,
component
:
'./Welcome'
,
haveChildren
:
false
,
key
:
'000000'
,
parentKey
:
'0'
,
routes
:
[],
children
:
null
,
title
:
null
,
},
].
concat
(
lastArr
);
return
last
Arr
.
map
((
item
,
index
)
=>
{
return
new
Arr
.
map
((
item
,
index
)
=>
{
if
(
item
.
icon
)
{
const
icon
=
strToHump
(
item
.
icon
),
ItemIcon
=
Ant4Icons
[
icon
];
...
...
@@ -172,7 +136,13 @@ export const layout = ({ initialState, setInitialState }) => {
},
locale
:
false
,
},
...
menurender
,
menuRender
:
(
props
,
defaultDom
)
=>
{
if
(
props
.
isMobile
)
{
return
defaultDom
;
}
else
{
return
<
SiderMenu
{
...
props
}
/>;
}
},
// 自定义 403 页面
unAccessible
:
<
div
>
unAccessible
</
div
>,
noFound
:
<
div
>
noFound
</
div
>,
...
...
src/components/DrawerPro/index.jsx
View file @
7fa62c3f
...
...
@@ -13,7 +13,6 @@ function DrawerPro(props) {
fields
:
props
.
fields
,
detailData
:
props
.
detailData
,
};
return
(
<
Drawer
maskClosable=
{
false
}
...
...
src/components/InitForm/index.jsx
View file @
7fa62c3f
...
...
@@ -83,7 +83,8 @@ let FormRender = memo(({ fields = [], colProps, proformRef }) => {
);
});
function
InitForm
({
function
InitForm
(
props
)
{
let
{
formRef
,
onFinish
=
(
vals
)
=>
{
//console.log(vals);
...
...
@@ -100,7 +101,9 @@ function InitForm({
onValuesChange
=
(
changedValues
,
allValues
)
=>
{
//console.log(changedValues, allValues);
},
})
{
}
=
props
;
console
.
log
(
props
);
let
proformRef
=
useRef
();
proformRef
=
formRef
??
proformRef
;
return
(
...
...
src/components/SiderMenu/index.jsx
View file @
7fa62c3f
...
...
@@ -141,7 +141,7 @@ function SiderMenu({ logo, collapsed, onCollapse, fixSiderbar, theme, isMobile,
const
collectList
=
useMemo
(()
=>
{
return
collectPerm
.
map
((
item
,
i
)
=>
{
const
icon
=
item
.
icon
?
?
strToHump
(
item
.
icon
)
,
const
icon
=
item
.
icon
?
strToHump
(
item
.
icon
)
:
'ToolOutlined'
,
ItemIcon
=
icon
?
Ant4Icons
[
icon
]
:
Ant4Icons
.
ToolOutlined
;
return
{
key
:
item
.
path
,
...
...
@@ -316,7 +316,7 @@ function SiderMenu({ logo, collapsed, onCollapse, fixSiderbar, theme, isMobile,
<
div
className=
{
styles
.
column
}
>
{
getMenuData
&&
filterMenu
(
getMenuData
,
search
).
map
((
item
,
i
)
=>
{
const
icon
=
item
.
icon
?
?
strToHump
(
item
.
icon
)
,
const
icon
=
item
.
icon
?
strToHump
(
item
.
icon
)
:
'ToolOutlined'
,
ItemIcon
=
icon
?
Ant4Icons
[
icon
]
:
Ant4Icons
[
'ToolOutlined'
];
return
(
<
div
className=
{
styles
.
item
}
key=
{
i
}
>
...
...
@@ -341,7 +341,7 @@ function SiderMenu({ logo, collapsed, onCollapse, fixSiderbar, theme, isMobile,
<
div
className=
{
styles
.
rt
}
>
{
getMenuData
&&
getMenuData
.
map
((
item
,
i
)
=>
{
const
icon
=
item
.
icon
?
?
strToHump
(
item
.
icon
)
,
const
icon
=
item
.
icon
?
strToHump
(
item
.
icon
)
:
'ToolOutlined'
,
ItemIcon
=
icon
?
Ant4Icons
[
icon
]
:
Ant4Icons
[
'ToolOutlined'
];
return
(
<
p
...
...
src/global.less
View file @
7fa62c3f
...
...
@@ -444,5 +444,23 @@ ol {
overflow: hidden !important;
> div {
height: 100%;
min-height: calc(100vh - 96px);
> div {
height: 100%;
}
}
.ant-drawer-content {
height: 100% !important;
}
}
// 横向滚动条
.scrollHoriz {
> div {
display: flex !important;
flex-wrap: nowrap !important;
align-items: center !important;
> div {
flex-shrink: 0 !important;
}
}
}
src/pages/device/account/index.jsx
View file @
7fa62c3f
...
...
@@ -2178,6 +2178,9 @@ function Model(props) {
}));
}
}
{
...
drawer
}
colProps=
{
{
span
:
8
,
}
}
>
{
selectMoreDrawerType
(
drawer
?.
type
)
}
</
DrawerPro
>
...
...
@@ -2192,6 +2195,9 @@ function Model(props) {
}));
}
}
{
...
currDrawer
}
colProps=
{
{
span
:
8
,
}
}
>
<
ProDescriptions
title=
"设备信息"
...
...
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