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 @@
...
@@ -16,6 +16,8 @@
import
Dashboard
from
'@/views/Dashboard'
;
import
Dashboard
from
'@/views/Dashboard'
;
import
Login
from
'@/views/Login'
;
import
Login
from
'@/views/Login'
;
import
Loading
from
'components/Loading/Loading'
;
import
Loading
from
'components/Loading/Loading'
;
import
microAppStart
from
"./micro/auth"
import
{
onCreated
,
onMounted
,
computed
,
reactive
,
toRefs
}
from
'vue'
;
import
{
onCreated
,
onMounted
,
computed
,
reactive
,
toRefs
}
from
'vue'
;
import
{
useStore
}
from
'vuex'
;
import
{
useStore
}
from
'vuex'
;
...
@@ -32,7 +34,13 @@ export default {
...
@@ -32,7 +34,13 @@ export default {
const
store
=
useStore
();
const
store
=
useStore
();
let
hasToken
=
computed
(()
=>
{
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
(()
=>
{
let
showLoading
=
computed
(()
=>
{
...
...
src/components/DesktopLeftSider/Sub/Menu.vue
View file @
5aeec5c
...
@@ -164,10 +164,7 @@ export default {
...
@@ -164,10 +164,7 @@ export default {
if
(
path
===
'/noData'
)
{
if
(
path
===
'/noData'
)
{
showEmpty
=
true
;
showEmpty
=
true
;
}
}
getMenuAuth
(
cItem
.
id
,
cOrigin
.
menuName
);
let
breadcrumb
=
[
store
.
dispatch
(
'app/setCommonData'
,
{
showEmpty
});
history
.
pushState
({
breadcrumb
:
[
{
{
name
:
pOrigin
.
menuName
,
name
:
pOrigin
.
menuName
,
path
:
pOrigin
.
frontRoute
path
:
pOrigin
.
frontRoute
...
@@ -176,8 +173,11 @@ export default {
...
@@ -176,8 +173,11 @@ export default {
name
:
cOrigin
.
menuName
,
name
:
cOrigin
.
menuName
,
path
:
cOrigin
.
frontRoute
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 {
...
@@ -257,6 +257,7 @@ export default {
firstList
.
children
[
0
].
subItemActive
=
true
;
firstList
.
children
[
0
].
subItemActive
=
true
;
cOrigin
.
menuName
&&
getMenuAuth
(
firstList
.
children
[
0
].
id
,
cOrigin
.
menuName
);
cOrigin
.
menuName
&&
getMenuAuth
(
firstList
.
children
[
0
].
id
,
cOrigin
.
menuName
);
history
.
pushState
({
breadcrumb
},
cOrigin
.
frontRoute
,
cOrigin
.
frontRoute
);
history
.
pushState
({
breadcrumb
},
cOrigin
.
frontRoute
,
cOrigin
.
frontRoute
);
store
.
dispatch
(
'menu/setBreadCrumb'
,
breadcrumb
);
store
.
dispatch
(
'app/setCommonData'
,
{
showEmpty
});
store
.
dispatch
(
'app/setCommonData'
,
{
showEmpty
});
}
}
}
}
...
@@ -274,8 +275,8 @@ export default {
...
@@ -274,8 +275,8 @@ export default {
const
{
state
}
=
e
;
const
{
state
}
=
e
;
if
(
state
)
{
if
(
state
)
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
const
{
breadcrumb
}
=
state
;
const
{
breadcrumb
,
pushState
}
=
state
;
if
(
breadcrumb
)
{
if
(
breadcrumb
&&
pushState
)
{
store
.
dispatch
(
'menu/setBreadCrumb'
,
breadcrumb
);
store
.
dispatch
(
'menu/setBreadCrumb'
,
breadcrumb
);
}
}
},
200
)
},
200
)
...
...
src/main.js
View file @
5aeec5c
...
@@ -4,13 +4,10 @@ import router from './router'
...
@@ -4,13 +4,10 @@ import router from './router'
import
store
from
'./store'
import
store
from
'./store'
import
elementUI
from
'@/utils/globalUI/element'
import
elementUI
from
'@/utils/globalUI/element'
import
microAppStart
from
"./micro/auth"
import
'element-plus/lib/theme-chalk/index.css'
;
import
'element-plus/lib/theme-chalk/index.css'
;
// import './assets/css/resets.css'
// import './assets/css/resets.css'
microAppStart
();
const
app
=
createApp
(
App
);
const
app
=
createApp
(
App
);
app
.
use
(
store
)
app
.
use
(
store
)
...
...
src/store/modules/menu.js
View file @
5aeec5c
...
@@ -18,12 +18,14 @@ try {
...
@@ -18,12 +18,14 @@ try {
const
checkRepeatedData
=
(
data
,
type
)
=>
{
const
checkRepeatedData
=
(
data
,
type
)
=>
{
let
arr
=
[];
let
arr
=
[];
let
newArr
=
[];
data
.
forEach
(
item
=>
{
data
.
forEach
(
item
=>
{
if
(
arr
.
indexOf
(
item
[
type
])
<
0
)
{
if
(
arr
.
indexOf
(
item
[
type
])
<
0
)
{
arr
.
push
(
item
);
arr
.
push
(
item
[
type
]);
newArr
.
push
(
item
);
}
}
});
});
return
a
rr
;
return
newA
rr
;
}
}
export
default
{
export
default
{
...
@@ -40,11 +42,9 @@ export default {
...
@@ -40,11 +42,9 @@ export default {
},
},
// 设置面包屑
// 设置面包屑
SET_BREAD_CRUMB
(
state
,
data
)
{
SET_BREAD_CRUMB
(
state
,
data
)
{
if
(
!
init
)
{
state
.
curBreadCrumb
=
checkRepeatedData
(
data
,
'name'
);
state
.
curBreadCrumb
=
checkRepeatedData
(
data
,
'name'
);
state
.
curBreadCrumb
=
JSON
.
parse
(
JSON
.
stringify
(
state
.
curBreadCrumb
));
localStorage
.
setItem
(
'breadcrumb'
,
JSON
.
stringify
(
data
));
localStorage
.
setItem
(
'breadcrumb'
,
JSON
.
stringify
(
state
.
curBreadCrumb
));
}
init
=
false
;
},
},
ADD_BREAD_CRUMB
(
state
,
data
)
{
ADD_BREAD_CRUMB
(
state
,
data
)
{
if
(
!
init
)
{
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