Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
micro-customization-system
/
micro-portal
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 5aeec5c0
authored
Jun 05, 2021
by
冒粤蓉
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix
1 parent
c7da60a5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
19 deletions
src/App.vue
src/components/DesktopLeftSider/Sub/Menu.vue
src/main.js
src/store/modules/menu.js
src/App.vue
View file @
5aeec5c
...
...
@@ -16,6 +16,8 @@
import
Dashboard
from
'@/views/Dashboard'
;
import
Login
from
'@/views/Login'
;
import
Loading
from
'components/Loading/Loading'
;
import
microAppStart
from
"./micro/auth"
import
{
onCreated
,
onMounted
,
computed
,
reactive
,
toRefs
}
from
'vue'
;
import
{
useStore
}
from
'vuex'
;
...
...
@@ -32,7 +34,13 @@ export default {
const
store
=
useStore
();
let
hasToken
=
computed
(()
=>
{
return
!!
store
.
getters
.
token
;
let
tokenStatus
=
!!
store
.
getters
.
token
;
let
flag
=
true
;
if
(
tokenStatus
&&
flag
)
{
microAppStart
();
flag
=
false
;
}
return
tokenStatus
;
})
let
showLoading
=
computed
(()
=>
{
...
...
src/components/DesktopLeftSider/Sub/Menu.vue
View file @
5aeec5c
...
...
@@ -164,10 +164,7 @@ export default {
if
(
path
===
'/noData'
)
{
showEmpty
=
true
;
}
getMenuAuth
(
cItem
.
id
,
cOrigin
.
menuName
);
store
.
dispatch
(
'app/setCommonData'
,
{
showEmpty
});
history
.
pushState
({
breadcrumb
:
[
let
breadcrumb
=
[
{
name
:
pOrigin
.
menuName
,
path
:
pOrigin
.
frontRoute
...
...
@@ -176,8 +173,11 @@ export default {
name
:
cOrigin
.
menuName
,
path
:
cOrigin
.
frontRoute
}
]
},
path
,
path
);
];
getMenuAuth
(
cItem
.
id
,
cOrigin
.
menuName
);
store
.
dispatch
(
'app/setCommonData'
,
{
showEmpty
});
store
.
dispatch
(
'menu/setBreadCrumb'
,
breadcrumb
);
history
.
pushState
({
breadcrumb
},
path
,
path
);
}
// 获取权限菜单(假数据)
...
...
@@ -257,6 +257,7 @@ export default {
firstList
.
children
[
0
].
subItemActive
=
true
;
cOrigin
.
menuName
&&
getMenuAuth
(
firstList
.
children
[
0
].
id
,
cOrigin
.
menuName
);
history
.
pushState
({
breadcrumb
},
cOrigin
.
frontRoute
,
cOrigin
.
frontRoute
);
store
.
dispatch
(
'menu/setBreadCrumb'
,
breadcrumb
);
store
.
dispatch
(
'app/setCommonData'
,
{
showEmpty
});
}
}
...
...
@@ -274,8 +275,8 @@ export default {
const
{
state
}
=
e
;
if
(
state
)
{
setTimeout
(()
=>
{
const
{
breadcrumb
}
=
state
;
if
(
breadcrumb
)
{
const
{
breadcrumb
,
pushState
}
=
state
;
if
(
breadcrumb
&&
pushState
)
{
store
.
dispatch
(
'menu/setBreadCrumb'
,
breadcrumb
);
}
},
200
)
...
...
src/main.js
View file @
5aeec5c
...
...
@@ -4,13 +4,10 @@ import router from './router'
import
store
from
'./store'
import
elementUI
from
'@/utils/globalUI/element'
import
microAppStart
from
"./micro/auth"
import
'element-plus/lib/theme-chalk/index.css'
;
// import './assets/css/resets.css'
microAppStart
();
const
app
=
createApp
(
App
);
app
.
use
(
store
)
...
...
src/store/modules/menu.js
View file @
5aeec5c
...
...
@@ -18,12 +18,14 @@ try {
const
checkRepeatedData
=
(
data
,
type
)
=>
{
let
arr
=
[];
let
newArr
=
[];
data
.
forEach
(
item
=>
{
if
(
arr
.
indexOf
(
item
[
type
])
<
0
)
{
arr
.
push
(
item
);
arr
.
push
(
item
[
type
]);
newArr
.
push
(
item
);
}
});
return
a
rr
;
return
newA
rr
;
}
export
default
{
...
...
@@ -40,11 +42,9 @@ export default {
},
// 设置面包屑
SET_BREAD_CRUMB
(
state
,
data
)
{
if
(
!
init
)
{
state
.
curBreadCrumb
=
checkRepeatedData
(
data
,
'name'
);
localStorage
.
setItem
(
'breadcrumb'
,
JSON
.
stringify
(
data
));
}
init
=
false
;
state
.
curBreadCrumb
=
checkRepeatedData
(
data
,
'name'
);
state
.
curBreadCrumb
=
JSON
.
parse
(
JSON
.
stringify
(
state
.
curBreadCrumb
));
localStorage
.
setItem
(
'breadcrumb'
,
JSON
.
stringify
(
state
.
curBreadCrumb
));
},
ADD_BREAD_CRUMB
(
state
,
data
)
{
if
(
!
init
)
{
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment