Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
micro-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
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 15d4ef77
authored
Oct 29, 2020
by
冒粤蓉
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
improve
1 parent
97e300b3
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
60 additions
and
37 deletions
src/components/DesktopLeftSider/Sub/Menu.vue
src/components/DesktopRightSider/DesktopRightSider.vue
src/components/DesktopTopSider/DesktopTopSider.vue
src/components/DesktopTopSider/Sub/UserButton.vue
src/components/HomeContent/Sub/LoginForm.vue
src/micro/app-store.js
src/micro/auth.js
src/micro/index.js
src/utils/globalAnt/ant.js
src/components/DesktopLeftSider/Sub/Menu.vue
View file @
15d4ef7
<
template
>
<
template
>
<div>
<div>
<!-- ant-menu-inline-collapsed -->
<ul
class=
"menu ant-menu-dark ant-menu-root ant-menu ant-menu-inline"
>
<ul
class=
"menu ant-menu-dark ant-menu-root ant-menu ant-menu-inline"
>
<!-- ant-menu-submenu-active ant-menu-submenu-open ant-menu-submenu-selected -->
<!-- ant-menu-submenu-active ant-menu-submenu-open ant-menu-submenu-selected -->
<li
class=
"ant-menu-submenu ant-menu-submenu-inline"
<li
class=
"ant-menu-submenu ant-menu-submenu-inline"
...
@@ -147,10 +148,10 @@ export default {
...
@@ -147,10 +148,10 @@ export default {
firstParent
=
getNewTree
[
0
].
origin
,
firstParent
=
getNewTree
[
0
].
origin
,
firstChildren
=
getNewTree
[
0
].
children
[
0
].
origin
;
firstChildren
=
getNewTree
[
0
].
children
[
0
].
origin
;
getNewTree
.
forEach
(
item
=>
{
getNewTree
.
forEach
(
(
item
,
index
)
=>
{
item
.
showSubList
=
false
;
item
.
showSubList
=
index
==
0
?
true
:
false
;
item
.
children
.
forEach
(
cItem
=>
{
item
.
children
.
forEach
(
(
cItem
,
cIndex
)
=>
{
cItem
.
subItemActive
=
false
;
cItem
.
subItemActive
=
cIndex
==
0
&&
index
==
0
?
true
:
false
;
})
})
});
});
...
...
src/components/DesktopRightSider/DesktopRightSider.vue
View file @
15d4ef7
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
{{
item
.
name
}}
{{
item
.
name
}}
</a-breadcrumb-item>
</a-breadcrumb-item>
</a-breadcrumb>
</a-breadcrumb>
<!--
<a-empty
/>
-->
<div
id=
"sub-system-frame"
></div>
<div
id=
"sub-system-frame"
></div>
</a-layout-content>
</a-layout-content>
</
template
>
</
template
>
...
...
src/components/DesktopTopSider/DesktopTopSider.vue
View file @
15d4ef7
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
<button
@
click=
"add"
>
点击逐加React
</button>
-->
<button
@
click=
"add"
>
点击逐加React
</button>
-->
<div
class=
"right-btn"
>
<div
class=
"right-btn"
>
<!-- 设置按钮 -->
<!-- 设置按钮 -->
<
setting-button></setting-button
>
<
!--
<setting-button></setting-button>
--
>
<!-- 用户按钮 -->
<!-- 用户按钮 -->
<user-button></user-button>
<user-button></user-button>
</div>
</div>
...
@@ -111,9 +111,6 @@ export default {
...
@@ -111,9 +111,6 @@ export default {
//
margin-right
:
30px
;
//
margin-right
:
30px
;
//
}
//
}
}
}
}
}
</
style
>
</
style
>
\ No newline at end of file
\ No newline at end of file
src/components/DesktopTopSider/Sub/UserButton.vue
View file @
15d4ef7
<
template
>
<
template
>
<a-
avatar
class=
"top-nav-right-btn avatar-btn"
:size=
"35
"
>
<a-
popover
title=
"我的"
trigger=
"click
"
>
<template
v-slot:icon
>
<template
slot=
"content"
>
<
UserOutlined
/
>
<
p>
登出
</p
>
</
template
>
</
template
>
</a-avatar>
<a-avatar
class=
"top-nav-right-btn avatar-btn"
:size=
"35"
>
<
template
v-slot:icon
>
<UserOutlined
/>
</
template
>
</a-avatar>
</a-popover>
</template>
</template>
<
script
>
<
script
>
...
@@ -22,6 +27,9 @@ export default {
...
@@ -22,6 +27,9 @@ export default {
<
style
lang=
"less"
scoped
>
<
style
lang=
"less"
scoped
>
@import
'styles/common.less'
;
@import
'styles/common.less'
;
@import
'styles/variables.less'
;
@import
'styles/variables.less'
;
/
deep
/
.ant-popover-arrow
{
display
:
none
!important
;
}
.avatar-btn
{
.avatar-btn
{
opacity
:
.8
;
opacity
:
.8
;
...
...
src/components/HomeContent/Sub/LoginForm.vue
View file @
15d4ef7
...
@@ -121,7 +121,7 @@ export default {
...
@@ -121,7 +121,7 @@ export default {
localStorage
.
setItem
(
'token'
,
token
);
localStorage
.
setItem
(
'token'
,
token
);
store
.
dispatch
(
'app/setUserInfo'
,
user
);
store
.
dispatch
(
'app/setUserInfo'
,
user
);
store
.
dispatch
(
'app/setToken'
,
token
);
store
.
dispatch
(
'app/setToken'
,
token
);
console
.
log
(
'save
user info'
,
store
.
getters
.
userInfo
);
console
.
log
(
'save
token'
,
token
);
}
else
{
}
else
{
const
{
message
}
=
res
;
const
{
message
}
=
res
;
state
.
alertArr
.
push
(
message
);
state
.
alertArr
.
push
(
message
);
...
...
src/micro/app-store.js
View file @
15d4ef7
import
{
initGlobalState
,
MicroAppStateActions
}
from
"qiankun"
;
import
{
initGlobalState
,
MicroAppStateActions
}
from
"qiankun"
;
import
store
from
"@/store"
;
import
store
from
"@/store"
;
import
{
useMessage
}
from
'@/utils/globalAnt/antMsg'
;
const
{
createMessage
}
=
useMessage
();
const
error
=
createMessage
.
error
;
const
initialState
=
{
const
initialState
=
{
reactNum
:
0
token
:
localStorage
.
getItem
(
'token'
)
||
''
,
// token: localStorage.token,
showLoading
:
false
,
errorMsg
:
''
};
};
// 初始化 state
// 初始化 state
const
actions
=
initGlobalState
(
initialState
);
const
actions
=
initGlobalState
(
initialState
);
actions
.
onGlobalStateChange
((
state
,
prev
)
=>
{
actions
.
onGlobalStateChange
((
state
,
prev
)
=>
{
console
.
log
(
"主应用: 变更前"
);
// 同步token、全局Loading和报错提示
console
.
log
(
prev
);
// console.log("主应用: 变更前");
console
.
log
(
"主应用: 变更后"
);
// console.log(prev);
console
.
log
(
state
);
// console.log("主应用: 变更后");
// console.log(state);
const
{
token
,
showLoading
,
errorMsg
}
=
state
;
if
(
errorMsg
)
{
error
(
errorMsg
);
}
if
(
token
===
'removeToken'
)
{
store
.
dispatch
(
'app/setToken'
,
''
);
setTimeout
(()
=>
{
window
.
location
.
reload
();
},
300
)
}
// store.dispatch('app/showLoading', showLoading);
});
});
export
default
actions
;
export
default
actions
;
\ No newline at end of file
\ No newline at end of file
src/micro/auth.js
View file @
15d4ef7
...
@@ -13,12 +13,7 @@ const microAppStart = () => {
...
@@ -13,12 +13,7 @@ const microAppStart = () => {
if
(
token
)
{
if
(
token
)
{
// 处理token状态共享
// 处理token状态共享
store
.
dispatch
(
'app/setToken'
,
token
);
store
.
dispatch
(
'app/setToken'
,
token
);
// getAppConfigs();
// return;
}
}
/**
* @name 默认加载未登录时无需服务端获取的微应用
*/
qianKunStart
();
qianKunStart
();
}
}
...
...
src/micro/index.js
View file @
15d4ef7
import
{
registerMicroApps
,
start
,
addGlobalUncaughtErrorHandler
,
setDefaultMountApp
,
initGlobalState
}
from
'qiankun'
;
import
{
registerMicroApps
,
start
,
addGlobalUncaughtErrorHandler
,
setDefaultMountApp
,
initGlobalState
}
from
'qiankun'
;
import
store
from
'@/store'
;
import
apps
from
'./apps'
;
import
apps
from
'./apps'
;
const
showLoading
=
status
=>
{
store
.
dispatch
(
'app/showLoading'
,
status
);
}
registerMicroApps
(
apps
,
{
registerMicroApps
(
apps
,
{
// qiankun 生命周期钩子 - 加载前
// qiankun 生命周期钩子 - 加载前
beforeLoad
:
(
app
)
=>
{
beforeLoad
:
(
app
)
=>
{
// 加载子应用前,加载进度条
showLoading
(
true
);
// NProgress.start();
console
.
log
(
"before load"
,
app
.
name
);
return
Promise
.
resolve
();
return
Promise
.
resolve
();
},
},
// qiankun 生命周期钩子 - 挂载后
// qiankun 生命周期钩子 - 挂载后
afterMount
:
(
app
)
=>
{
afterMount
:
(
app
)
=>
{
// 加载子应用前,进度条加载完成
showLoading
(
false
);
// NProgress.done();
console
.
log
(
"after mount"
,
app
.
name
);
return
Promise
.
resolve
();
return
Promise
.
resolve
();
},
},
});
});
...
@@ -22,12 +23,11 @@ registerMicroApps(apps, {
...
@@ -22,12 +23,11 @@ registerMicroApps(apps, {
* 添加全局的未捕获异常处理器
* 添加全局的未捕获异常处理器
*/
*/
addGlobalUncaughtErrorHandler
((
event
)
=>
{
addGlobalUncaughtErrorHandler
((
event
)
=>
{
console
.
error
(
event
);
const
{
message
:
msg
}
=
event
;
// const { message: msg } = event;
// 加载失败时提示
// // 加载失败时提示
if
(
msg
&&
msg
.
includes
(
"died in status LOADING_SOURCE_CODE"
))
{
// if (msg && msg.includes("died in status LOADING_SOURCE_CODE")) {
console
.
error
(
"子应用加载失败,请检查应用是否可运行"
);
// message.error("子应用加载失败,请检查应用是否可运行");
}
// }
});
});
setDefaultMountApp
(
'/system'
);
setDefaultMountApp
(
'/system'
);
...
...
src/utils/globalAnt/ant.js
View file @
15d4ef7
...
@@ -11,7 +11,8 @@ import {
...
@@ -11,7 +11,8 @@ import {
Popover
,
Popover
,
Dropdown
,
Dropdown
,
Spin
,
Spin
,
Breadcrumb
Breadcrumb
,
Empty
}
from
"ant-design-vue"
;
}
from
"ant-design-vue"
;
const
ant
=
{
const
ant
=
{
...
@@ -34,6 +35,7 @@ const ant = {
...
@@ -34,6 +35,7 @@ const ant = {
Vue
.
component
(
Dropdown
.
name
,
Dropdown
);
Vue
.
component
(
Dropdown
.
name
,
Dropdown
);
Vue
.
component
(
Spin
.
name
,
Spin
);
Vue
.
component
(
Spin
.
name
,
Spin
);
Vue
.
component
(
Breadcrumb
.
name
,
Breadcrumb
);
Vue
.
component
(
Breadcrumb
.
name
,
Breadcrumb
);
Vue
.
component
(
Empty
.
name
,
Empty
);
},
},
};
};
...
...
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