Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mobi
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
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
wbx-PCAndMobi
mobi
Commits
03eca4ba
Commit
03eca4ba
authored
May 08, 2021
by
程卓
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化子项目注册, 修复mounted只加载一次
parent
2f109bec
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
78 additions
and
31 deletions
+78
-31
index.vue
src/components/Layout/index.vue
+1
-1
index.js
src/router/index.js
+0
-1
micSystemsList.js
src/router/micSystemsList.js
+23
-29
micSystemsList.json
src/router/micSystemsList.json
+54
-0
No files found.
src/components/Layout/index.vue
View file @
03eca4ba
...
@@ -39,7 +39,7 @@
...
@@ -39,7 +39,7 @@
<!-- 传统子项目在iframe中渲染 -->
<!-- 传统子项目在iframe中渲染 -->
<iframe
v-if=
"webviewSrc"
:src=
"webviewSrc"
frameborder=
"0"
style=
"width:100%;height:96%;overflow:hidden;"
/>
<iframe
v-if=
"webviewSrc"
:src=
"webviewSrc"
frameborder=
"0"
style=
"width:100%;height:96%;overflow:hidden;"
/>
<!-- 本项目的子页面在此渲染 -->
<!-- 本项目的子页面在此渲染 -->
<router-view
v-else
/>
<router-view
v-else
:key=
"$route.path"
/>
</
template
>
</
template
>
<ChangePassword
@
on-close=
'closeChangePwdModal'
:resetPwdShow=
'isShowChangePwd'
></ChangePassword>
<ChangePassword
@
on-close=
'closeChangePwdModal'
:resetPwdShow=
'isShowChangePwd'
></ChangePassword>
...
...
src/router/index.js
View file @
03eca4ba
...
@@ -14,7 +14,6 @@ const router = new Router({
...
@@ -14,7 +14,6 @@ const router = new Router({
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
// TODO
// TODO
// console.log(to.path)
store
.
commit
(
'setWebviewSrc'
,
to
.
meta
&&
to
.
meta
.
src
)
// 判断有src的话为需要嵌入iframe的子项目
store
.
commit
(
'setWebviewSrc'
,
to
.
meta
&&
to
.
meta
.
src
)
// 判断有src的话为需要嵌入iframe的子项目
const
token
=
Cookie
.
get
(
'token'
)
const
token
=
Cookie
.
get
(
'token'
)
...
...
src/router/micSystemsList.js
View file @
03eca4ba
import
micSystemsList
from
'@/router/micSystemsList.json'
function
GetSystemList
()
{
function
GetSystemList
()
{
console
.
log
(
window
.
location
.
origin
,
'子项目的 entry 前缀'
)
/**
let
system
=
[]
//子项目列表
*
let
prodSystemList
=
micSystemsList
.
prod
// 生产环境的子项目
* 所有新增的子项目需要再此注册
let
districtName
//区局名称
*
let
env
=
process
.
env
.
NODE_ENV
//打包命令
* */
let
url
=
window
.
location
.
origin
//当前访问的浏览器地址
const
url
=
window
.
location
.
origin
let
system
=
[
// 1. 当打生产包的时候,
{
if
(
env
.
indexOf
(
'-prod'
)
!=
-
1
)
{
'name'
:
'pudong'
,
// 2. 获取区局名称
'entry'
:
url
+
'/elvweb'
,
districtName
=
env
.
split
(
'-'
)[
0
]
'activeRule'
:
'/pudong'
// 3. 在生产环境的子项目list
},
prodSystemList
.
forEach
((
item
,
index
)
=>
{
{
if
(
item
.
districtName
==
districtName
||
item
.
districtName
==
'common'
)
{
'name'
:
'danger'
,
prodSystemList
[
index
].
entry
=
url
+
item
.
entry
'entry'
:
url
+
'/dangerweb'
,
system
.
push
(
item
)
'activeRule'
:
'/danger'
}
},
})
{
return
system
'name'
:
'order'
,
}
else
{
'entry'
:
url
+
'/order'
,
system
=
micSystemsList
.
sit
'activeRule'
:
'/order'
}
},
{
'name'
:
'documents'
,
'entry'
:
url
+
'/documents'
,
'activeRule'
:
'/documents'
}
]
return
system
return
system
}
}
...
...
src/router/micSystemsList.json
0 → 100644
View file @
03eca4ba
{
"prod"
:[
{
"districtName"
:
"pudong"
,
"name"
:
"pudong"
,
"entry"
:
"http://10.220.105.137:81/elvweb"
,
"activeRule"
:
"/pudong"
},
{
"districtName"
:
"pudong"
,
"name"
:
"danger"
,
"entry"
:
"http://10.220.105.137:81/dangerweb"
,
"activeRule"
:
"/danger"
},
{
"districtName"
:
"xuhui"
,
"name"
:
"order"
,
"entry"
:
"http://31.0.161.39/order"
,
"activeRule"
:
"/order"
},
{
"districtName"
:
"common"
,
"name"
:
"documents"
,
"entry"
:
"http://10.216.118.142/documents"
,
"activeRule"
:
"/documents"
}
],
"sit"
:[
{
"districtName"
:
"pudong"
,
"name"
:
"pudong"
,
"entry"
:
"http://pudong.hm.omniview.pro/elvweb"
,
"activeRule"
:
"/pudong"
},
{
"districtName"
:
"pudong"
,
"name"
:
"danger"
,
"entry"
:
"http://pudong.hm.omniview.pro/dangerweb"
,
"activeRule"
:
"/danger"
},
{
"districtName"
:
"xuhui"
,
"name"
:
"order"
,
"entry"
:
"http://xuhui.hm.omniview.pro/order"
,
"activeRule"
:
"/order"
},
{
"districtName"
:
"common"
,
"name"
:
"documents"
,
"entry"
:
"http://yangpu-hm.omniview.pro/documents"
,
"activeRule"
:
"/documents"
}
]
}
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