Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
quasar-web-base
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
Nguyễn Hải Sơn
quasar-web-base
Commits
1c94c01d
Commit
1c94c01d
authored
May 12, 2021
by
Nguyễn Hải Sơn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update menu list
parent
5c00fe97
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
9 deletions
+36
-9
index.vue
src/components/menu-list/menu-item/index.vue
+2
-4
actions.ts
src/store/authentication/actions.ts
+34
-5
No files found.
src/components/menu-list/menu-item/index.vue
View file @
1c94c01d
...
@@ -3,8 +3,7 @@
...
@@ -3,8 +3,7 @@
v-if=
"item.children && item.children.length"
v-if=
"item.children && item.children.length"
:label=
"item.pageName"
:label=
"item.pageName"
:icon=
"item.pageIcon"
:icon=
"item.pageIcon"
:header-inset-level=
"item.level - 1"
:header-style=
"`padding-left: $
{item.level * 1.8}rem`"
:header-style=
"`margin-left: -$
{(item.level - 1) * 1.8}rem`"
:model-value="isActive"
:model-value="isActive"
>
>
<MenuItemComponent
<MenuItemComponent
...
@@ -18,8 +17,7 @@
...
@@ -18,8 +17,7 @@
expand-icon-class=
"hidden"
expand-icon-class=
"hidden"
:label=
"item.pageName"
:label=
"item.pageName"
:icon=
"item.pageIcon"
:icon=
"item.pageIcon"
:header-inset-level=
"item.level - 1"
:header-style=
"`padding-left: $
{item.level * 1.8}rem`"
:header-style=
"`margin-left: -$
{(item.level - 1) * 1.8}rem`"
:to="item.pageUrl || '/'"
:to="item.pageUrl || '/'"
exact
exact
active-class="bg-primary text-white"
active-class="bg-primary text-white"
...
...
src/store/authentication/actions.ts
View file @
1c94c01d
...
@@ -7,7 +7,33 @@ import { Router } from 'src/router';
...
@@ -7,7 +7,33 @@ import { Router } from 'src/router';
import
{
Pages
}
from
'src/router/routes'
;
import
{
Pages
}
from
'src/router/routes'
;
import
{
ActionTree
}
from
'vuex'
;
import
{
ActionTree
}
from
'vuex'
;
import
{
StateInterface
}
from
'../index'
;
import
{
StateInterface
}
from
'../index'
;
import
{
AuthenticationState
,
MenuItem
,
Page
,
PageRole
}
from
'./state'
;
import
{
AuthenticationState
,
MenuItem
,
Page
,
PageRole
,
RoleInfo
,
}
from
'./state'
;
const
constructMenuItem
=
(
menuItem
:
MenuItem
,
pageRoles
:
RoleInfo
[],
parentRole
:
RoleInfo
)
=>
{
if
(
!
menuItem
.
pageUrl
)
{
menuItem
.
children
=
[];
menuItem
.
children
.
push
(
...
pageRoles
.
filter
((
r
)
=>
r
.
parentId
===
parentRole
.
id
)
);
menuItem
.
children
.
forEach
((
child
)
=>
{
if
(
!
child
.
pageUrl
)
{
constructMenuItem
(
child
,
pageRoles
,
menuItem
);
}
});
}
};
const
actions
:
ActionTree
<
AuthenticationState
,
StateInterface
>
=
{
const
actions
:
ActionTree
<
AuthenticationState
,
StateInterface
>
=
{
async
callAPILogin
(
context
,
payload
:
{
userName
:
string
;
password
:
string
})
{
async
callAPILogin
(
context
,
payload
:
{
userName
:
string
;
password
:
string
})
{
...
@@ -29,11 +55,14 @@ const actions: ActionTree<AuthenticationState, StateInterface> = {
...
@@ -29,11 +55,14 @@ const actions: ActionTree<AuthenticationState, StateInterface> = {
...
role
,
...
role
,
};
};
menuItem
.
children
=
[];
constructMenuItem
(
menuItem
,
res
.
data
.
data
.
pageRoles
,
role
);
// menuItem.children = [];
// menuItem.children.push(
// ...res.data.data.pageRoles.filter((r) => r.parentId === role.id)
// );
menuItem
.
children
.
push
(
...
res
.
data
.
data
.
pageRoles
.
filter
((
r
)
=>
r
.
parentId
===
role
.
id
)
);
acc
.
push
(
menuItem
);
acc
.
push
(
menuItem
);
}
}
return
acc
;
return
acc
;
...
...
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