Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dcxy-manage-shell
Project
Overview
Details
Activity
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
姜雷
dcxy-manage-shell
Commits
1db2d66b
Commit
1db2d66b
authored
May 10, 2019
by
姜雷
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'test' into 'master'
Test See merge request
!105
parents
b18e2558
2804be47
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
196 additions
and
173 deletions
+196
-173
.env
.env
+1
-0
index.html
public/index.html
+10
-10
App.vue
src/App.vue
+14
-1
fetch.js
src/api/fetch.js
+4
-99
CampusRankChart.vue
src/containers/Dashboard/CampusRank/CampusRankChart.vue
+1
-13
CustomerRegister.vue
...ontainers/Dashboard/CustomerRegister/CustomerRegister.vue
+13
-1
Dashboard.vue
src/containers/Dashboard/Dashboard.vue
+1
-10
SeviceRatioChart.vue
src/containers/Dashboard/SeviceRatio/SeviceRatioChart.vue
+16
-4
Home.vue
src/containers/HomePage/Home.vue
+9
-1
IconMenu.vue
src/containers/layout/IconMenu/IconMenu.vue
+17
-1
index.vue
src/containers/login/index.vue
+4
-6
develop.js
src/dev-local/develop.js
+6
-1
Api.js
src/lib/Api.js
+17
-1
main.js
src/lib/main.js
+1
-1
permission.js
src/lib/permission.js
+6
-0
main.js
src/main.js
+8
-2
asyncRoutes.js
src/router/asyncRoutes.js
+27
-0
index.js
src/router/index.js
+0
-21
route.js
src/utils/route.js
+41
-1
No files found.
.env
View file @
1db2d66b
VUE_APP_BASE_URL=/
VUE_APP_BASE_URL=/
VUE_APP_DEV_LIB_URL=
VUE_APP_CUSTOMER_MENU_CODE=0001
VUE_APP_CUSTOMER_MENU_CODE=0001
VUE_APP_BASE_MENU_CODE=0002
VUE_APP_BASE_MENU_CODE=0002
VUE_APP_SYSTEM_MENU_CODE=0003
VUE_APP_SYSTEM_MENU_CODE=0003
...
...
public/index.html
View file @
1db2d66b
...
@@ -9,16 +9,7 @@
...
@@ -9,16 +9,7 @@
<script
src=
"https://unpkg.com/vue@2.6.10/dist/vue.js"
></script>
<script
src=
"https://unpkg.com/vue@2.6.10/dist/vue.js"
></script>
<script
src=
"https://unpkg.com/vuex@3.1.0/dist/vuex.js"
></script>
<script
src=
"https://unpkg.com/vuex@3.1.0/dist/vuex.js"
></script>
<script
src=
"https://unpkg.com/vue-router@3.0.1/dist/vue-router.js"
></script>
<script
src=
"https://unpkg.com/vue-router@3.0.1/dist/vue-router.js"
></script>
<script
src=
"/lib/manageShell.umd.min.js"
></script>
<link
rel=
"stylesheet"
href=
"<%= VUE_APP_DEV_LIB_URL %>/lib/manageShell.css"
/>
<script
src=
"<%= VUE_APP_SUBSYSTEM %>/customerManage/lib/customerManage.umd.min.js"
></script>
<script
src=
"<%= VUE_APP_SUBSYSTEM %>/baseManage/lib/baseManage.umd.min.js"
></script>
<script
src=
"<%= VUE_APP_SUBSYSTEM %>/systemManage/lib/systemManage.umd.min.js"
></script>
<script
src=
"<%= VUE_APP_SUBSYSTEM %>/operateManage/lib/operateManage.umd.min.js"
></script>
<script
src=
"<%= VUE_APP_SUBSYSTEM %>/statisticsManage/lib/statisticsManage.umd.min.js"
></script>
<script
src=
"<%= VUE_APP_SUBSYSTEM %>/deviceManage/lib/deviceManage.umd.min.js"
></script>
<script
src=
"<%= VUE_APP_SUBSYSTEM %>/smaproManage/lib/smaproManage.umd.min.js"
></script>
<link
rel=
"stylesheet"
href=
"/lib/manageShell.css"
/>
<title>
多彩综合管理系统
</title>
<title>
多彩综合管理系统
</title>
</head>
</head>
...
@@ -30,6 +21,15 @@
...
@@ -30,6 +21,15 @@
<div
id=
"app"
></div>
<div
id=
"app"
></div>
<script
src=
"https://webapi.amap.com/maps?v=1.4.12&key=dd6103c90f2f17310a8711f2d330a0a6"
></script>
<script
src=
"https://webapi.amap.com/maps?v=1.4.12&key=dd6103c90f2f17310a8711f2d330a0a6"
></script>
<script
src=
"https://webapi.amap.com/ui/1.0/main.js?v=1.0.11"
></script>
<script
src=
"https://webapi.amap.com/ui/1.0/main.js?v=1.0.11"
></script>
<script
src=
"<%= VUE_APP_DEV_LIB_URL %>/lib/manageShell.umd.min.js"
></script>
<script
src=
"<%= VUE_APP_SUBSYSTEM %>/customerManage/lib/customerManage.umd.min.js"
></script>
<script
src=
"<%= VUE_APP_SUBSYSTEM %>/baseManage/lib/baseManage.umd.min.js"
></script>
<script
src=
"<%= VUE_APP_SUBSYSTEM %>/systemManage/lib/systemManage.umd.min.js"
></script>
<script
src=
"<%= VUE_APP_SUBSYSTEM %>/operateManage/lib/operateManage.umd.min.js"
></script>
<script
src=
"<%= VUE_APP_SUBSYSTEM %>/statisticsManage/lib/statisticsManage.umd.min.js"
></script>
<script
src=
"<%= VUE_APP_SUBSYSTEM %>/deviceManage/lib/deviceManage.umd.min.js"
></script>
<script
src=
"<%= VUE_APP_SUBSYSTEM %>/smaproManage/lib/smaproManage.umd.min.js"
></script>
<!-- built files will be auto injected -->
<!-- built files will be auto injected -->
</body>
</body>
...
...
src/App.vue
View file @
1db2d66b
...
@@ -96,6 +96,19 @@ export default {
...
@@ -96,6 +96,19 @@ export default {
dashboardVisiable
()
{
dashboardVisiable
()
{
return
this
.
$route
.
name
===
'dashboard'
;
return
this
.
$route
.
name
===
'dashboard'
;
},
},
// defaultRoute() {
// if (this.route && this.route.length) {
// let item = this.route.find(
// item => item.children && item.children.length
// );
// if (item) {
// return [this.route[0], item];
// } else {
// return [this.route[0]];
// }
// }
// return [];
// },
},
},
mounted
()
{
mounted
()
{
if
(
this
.
$route
.
meta
&&
this
.
$route
.
meta
.
store
)
{
if
(
this
.
$route
.
meta
&&
this
.
$route
.
meta
.
store
)
{
...
@@ -145,7 +158,7 @@ export default {
...
@@ -145,7 +158,7 @@ export default {
this
.
saveRouteState
();
this
.
saveRouteState
();
},
},
selectRouteMenu
(
routes
)
{
selectRouteMenu
(
routes
)
{
this
.
selectedRoute
=
routes
;
this
.
selectedRoute
=
[
this
.
route
[
0
],
...
routes
]
;
this
.
showSelected
=
true
;
this
.
showSelected
=
true
;
this
.
showFastLink
=
false
;
this
.
showFastLink
=
false
;
this
.
saveRouteState
();
this
.
saveRouteState
();
...
...
src/api/fetch.js
View file @
1db2d66b
import
axios
from
'axios'
;
import
createBaseFetch
from
'../lib/Api'
;
import
{
Message
,
MessageBox
}
from
'element-ui'
;
import
store
from
'../store'
;
import
{
SUCCESS_CODE
,
LOGOUT_CODE
}
from
'@/config'
;
import
{
errorHandle
}
from
'./validate'
;
import
{
getYourIP
}
from
'@/utils/getIp.js'
;
let
ip
=
'127.0.0.1'
;
const
fetch
=
createBaseFetch
({
getYourIP
(
ipVal
=>
{
baseURL
:
process
.
env
.
VUE_APP_SYSTEM_SERVER_URL
,
ip
=
ipVal
;
});
// 创建axios实例
const
service
=
axios
.
create
({
baseURL
:
process
.
env
.
VUE_APP_SYSTEM_SERVER_URL
,
// api的base_url
timeout
:
10000
,
timeout
:
10000
,
});
});
let
logout
=
false
;
// request拦截器
service
.
interceptors
.
request
.
use
(
conf
=>
{
const
{
notLoading
}
=
conf
;
store
.
dispatch
(
'fetchStart'
,
notLoading
);
if
(
store
.
getters
.
token
)
{
conf
.
headers
=
{
...
conf
.
headers
,
reqSource
:
'pc'
,
token
:
store
.
getters
.
token
,
ip
:
ip
,
};
}
else
{
conf
.
headers
=
{
...
conf
.
headers
,
reqSource
:
'pc'
,
ip
:
ip
,
};
}
return
conf
;
},
error
=>
{
// Do something with request error
console
.
error
(
error
);
// for debug
Promise
.
reject
(
error
);
}
);
// respone拦截器
service
.
interceptors
.
response
.
use
(
response
=>
{
const
res
=
response
.
data
;
/**
* code为非'0'是抛错
*/
setTimeout
(()
=>
{
const
{
notLoading
}
=
response
.
config
;
store
.
dispatch
(
'fetchDone'
,
notLoading
);
},
500
);
if
(
res
.
code
!==
SUCCESS_CODE
)
{
if
(
response
.
headers
&&
response
.
headers
[
'content-type'
]
&&
/application
\/
octet-stream/
.
test
(
response
.
headers
[
'content-type'
].
toLowerCase
()
)
)
{
return
response
;
}
Message
({
message
:
res
.
msg
||
'网络错误!'
,
type
:
'error'
,
duration
:
5
*
1000
,
});
// -2:其他客户端登录了;Token 过期了;
if
(
res
.
code
===
LOGOUT_CODE
)
{
if
(
logout
)
return
;
logout
=
true
;
MessageBox
.
confirm
(
'你已被登出,可以取消继续留在该页面,或者重新登录'
,
'确定登出'
,
{
confirmButtonText
:
'重新登录'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
,
}
)
.
then
(()
=>
{
store
.
dispatch
(
'FedLogOut'
).
then
(()
=>
{
location
.
reload
();
// 为了重新实例化vue-router对象 避免bug
});
})
.
catch
(
err
=>
{
console
.
error
(
err
);
logout
=
false
;
});
}
return
Promise
.
reject
(
response
.
data
);
}
else
{
return
response
.
data
;
}
},
errorHandle
);
export
default
service
;
export
default
fetch
;
src/containers/Dashboard/CampusRank/CampusRankChart.vue
View file @
1db2d66b
...
@@ -38,7 +38,7 @@ export default {
...
@@ -38,7 +38,7 @@ export default {
container
:
'CampusRank'
,
container
:
'CampusRank'
,
forceFit
:
true
,
forceFit
:
true
,
height
:
this
.
height
-
30
,
height
:
this
.
height
-
30
,
padding
:
[
20
,
249
,
2
0
,
0
],
padding
:
[
0
,
249
,
0
,
0
],
});
});
this
.
chart
.
source
(
this
.
data
);
this
.
chart
.
source
(
this
.
data
);
this
.
chart
.
coord
(
'theta'
,
{
this
.
chart
.
coord
(
'theta'
,
{
...
@@ -81,18 +81,10 @@ export default {
...
@@ -81,18 +81,10 @@ export default {
width
:
'244px'
,
width
:
'244px'
,
'max-width'
:
'244px'
,
'max-width'
:
'244px'
,
'max-height'
:
this
.
height
-
30
+
'px'
,
'max-height'
:
this
.
height
-
30
+
'px'
,
right
:
0
,
},
},
'g2-legend-list-item'
:
{
'g2-legend-list-item'
:
{
color
:
'#333'
,
color
:
'#333'
,
},
},
'g2-legend-text'
:
{
display
:
'inline-block'
,
width
:
'100px'
,
overflow
:
'hidden'
,
'text-overflow'
:
'ellipsis'
,
'white-space'
:
'nowrap'
,
},
'g2-legend-marker'
:
{
'g2-legend-marker'
:
{
width
:
'10px'
,
width
:
'10px'
,
height
:
'5px'
,
height
:
'5px'
,
...
@@ -198,10 +190,6 @@ export default {
...
@@ -198,10 +190,6 @@ export default {
top
:
50%
;
top
:
50%
;
right
:
0
;
right
:
0
;
}
}
.g2-legend
{
max-height
:
270px
;
overflow-y
:
auto
;
}
.g2-legend-text
{
.g2-legend-text
{
display
:
inline-block
;
display
:
inline-block
;
width
:
100px
;
width
:
100px
;
...
...
src/containers/Dashboard/CustomerRegister/CustomerRegister.vue
View file @
1db2d66b
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
<area-select
<area-select
v-model
.
trim=
"campusFilters.areaId"
v-model
.
trim=
"campusFilters.areaId"
@
input=
"changeReportAreaHandle"
@
input=
"changeReportAreaHandle"
type=
"user
"
:accessType=
"isAdmin?0:1
"
/>
/>
</search-item>
</search-item>
</div>
</div>
...
@@ -57,6 +57,9 @@ export default {
...
@@ -57,6 +57,9 @@ export default {
RegisterByDay
,
RegisterByDay
,
ActiveUserByMonth
,
ActiveUserByMonth
,
},
},
props
:
{
isAdmin
:
Boolean
,
},
data
()
{
data
()
{
return
{
return
{
campusFilters
:
{
campusFilters
:
{
...
@@ -81,6 +84,7 @@ export default {
...
@@ -81,6 +84,7 @@ export default {
if
(
val
)
{
if
(
val
)
{
let
areaId
=
this
.
campusFilters
.
areaId
;
let
areaId
=
this
.
campusFilters
.
areaId
;
this
.
fetchReportList
({
this
.
fetchReportList
({
isAdmin
:
this
.
isAdmin
?
1
:
0
,
year
:
val
,
year
:
val
,
areaId
:
areaId
?
areaId
:
null
,
areaId
:
areaId
?
areaId
:
null
,
});
});
...
@@ -90,6 +94,7 @@ export default {
...
@@ -90,6 +94,7 @@ export default {
if
(
val
)
{
if
(
val
)
{
let
year
=
this
.
campusFilters
.
year
;
let
year
=
this
.
campusFilters
.
year
;
this
.
fetchReportList
({
this
.
fetchReportList
({
isAdmin
:
this
.
isAdmin
?
1
:
0
,
year
:
year
?
year
:
null
,
year
:
year
?
year
:
null
,
areaId
:
val
,
areaId
:
val
,
});
});
...
@@ -100,6 +105,7 @@ export default {
...
@@ -100,6 +105,7 @@ export default {
let
year
=
this
.
campusFilters
.
year
;
let
year
=
this
.
campusFilters
.
year
;
let
areaId
=
this
.
campusFilters
.
areaId
;
let
areaId
=
this
.
campusFilters
.
areaId
;
this
.
fetchReportList
({
this
.
fetchReportList
({
isAdmin
:
this
.
isAdmin
?
1
:
0
,
year
:
year
?
year
:
null
,
year
:
year
?
year
:
null
,
areaId
:
areaId
?
areaId
:
null
,
areaId
:
areaId
?
areaId
:
null
,
month
:
month
,
month
:
month
,
...
@@ -122,6 +128,12 @@ export default {
...
@@ -122,6 +128,12 @@ export default {
.Dashboard-SearchBar
{
.Dashboard-SearchBar
{
display
:
flex
;
display
:
flex
;
padding
:
10px
0
20px
;
padding
:
10px
0
20px
;
.filter-item-input
{
width
:
200px
;
.el-input
{
width
:
100%
;
}
}
}
}
.Dashboard-CampusData
{
.Dashboard-CampusData
{
display
:
flex
;
display
:
flex
;
...
...
src/containers/Dashboard/Dashboard.vue
View file @
1db2d66b
...
@@ -9,14 +9,12 @@
...
@@ -9,14 +9,12 @@
<CampusCustomerData
class=
"Dashboard-DataCard"
/>
<CampusCustomerData
class=
"Dashboard-DataCard"
/>
<EquipmentList
class=
"Dashboard-DataCard"
/>
<EquipmentList
class=
"Dashboard-DataCard"
/>
</div>
</div>
<!--
<CustomerRegister
class=
"Dashboard-Row Dashboard-DataCard"
/>
-->
</div>
</div>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
import
{
mapActions
,
mapGetters
}
from
'vuex'
;
import
{
mapActions
,
mapGetters
}
from
'vuex'
;
// import CustomerRegister from './CustomerRegister/CustomerRegister';
import
EquipmentList
from
'./EquipmentList/EquipmentList'
;
import
EquipmentList
from
'./EquipmentList/EquipmentList'
;
import
CustomerFeedback
from
'./CustomerFeedback/CustomerFeedback'
;
import
CustomerFeedback
from
'./CustomerFeedback/CustomerFeedback'
;
import
CustomerData
from
'./CustomerData/CustomerData'
;
import
CustomerData
from
'./CustomerData/CustomerData'
;
...
@@ -25,7 +23,6 @@ import CampusCustomerData from './CampusCustomerData/CampusCustomerData';
...
@@ -25,7 +23,6 @@ import CampusCustomerData from './CampusCustomerData/CampusCustomerData';
export
default
{
export
default
{
name
:
'Dashboard'
,
name
:
'Dashboard'
,
components
:
{
components
:
{
// CustomerRegister,
CustomerData
,
CustomerData
,
CustomerFeedback
,
CustomerFeedback
,
EquipmentList
,
EquipmentList
,
...
@@ -40,14 +37,9 @@ export default {
...
@@ -40,14 +37,9 @@ export default {
this
.
initData
();
this
.
initData
();
},
},
methods
:
{
methods
:
{
...
mapActions
(
'Dashboard'
,
[
...
mapActions
(
'Dashboard'
,
[
'fetchConsumeList'
,
'fetchTitleList'
]),
'fetchReportList'
,
'fetchConsumeList'
,
'fetchTitleList'
,
]),
...
mapActions
([
'updateBackPage'
]),
...
mapActions
([
'updateBackPage'
]),
initData
()
{
initData
()
{
this
.
fetchReportList
();
this
.
fetchConsumeList
();
this
.
fetchConsumeList
();
this
.
fetchTitleList
();
this
.
fetchTitleList
();
},
},
...
@@ -163,7 +155,6 @@ export default {
...
@@ -163,7 +155,6 @@ export default {
width
:
36px
;
width
:
36px
;
height
:
20px
;
height
:
20px
;
margin-right
:
12px
;
margin-right
:
12px
;
margin-left
:
15px
;
}
}
.Dashboard-title-text
{
.Dashboard-title-text
{
flex
:
1
;
flex
:
1
;
...
...
src/containers/Dashboard/SeviceRatio/SeviceRatioChart.vue
View file @
1db2d66b
...
@@ -33,7 +33,7 @@ export default {
...
@@ -33,7 +33,7 @@ export default {
container
:
'SeviceRatio'
,
container
:
'SeviceRatio'
,
forceFit
:
true
,
forceFit
:
true
,
height
:
this
.
height
-
30
,
height
:
this
.
height
-
30
,
padding
:
[
0
,
2
05
,
0
,
0
],
padding
:
[
0
,
2
20
,
0
,
0
],
});
});
this
.
chart
.
source
(
this
.
data
);
this
.
chart
.
source
(
this
.
data
);
this
.
chart
.
coord
(
'theta'
,
{
this
.
chart
.
coord
(
'theta'
,
{
...
@@ -73,7 +73,8 @@ export default {
...
@@ -73,7 +73,8 @@ export default {
`
;
`
;
},
},
'g2-legend'
:
{
'g2-legend'
:
{
width
:
'200px'
,
width
:
'215px'
,
'max-width'
:
'215px'
,
// left: '-20px',
// left: '-20px',
},
},
'g2-legend-list-item'
:
{
'g2-legend-list-item'
:
{
...
@@ -89,7 +90,18 @@ export default {
...
@@ -89,7 +90,18 @@ export default {
this
.
chartGeom
=
this
.
chart
this
.
chartGeom
=
this
.
chart
.
intervalStack
()
.
intervalStack
()
.
position
(
'count'
)
.
position
(
'count'
)
.
color
(
'serviceName'
,
[
'#4e82fb'
,
'#fb774e'
,
'#ffc934'
,
'#41bf52'
]);
.
color
(
'serviceName'
,
[
'#4e82fb'
,
'#fb774e'
,
'#ffc934'
,
'#41bf52'
,
'#9b50ff'
,
'#94de70'
,
'#b5593d'
,
'#fe8787'
,
'#254eae'
,
'#2f4554'
,
]);
// 辅助元素
// 辅助元素
this
.
chart
.
guide
().
html
({
this
.
chart
.
guide
().
html
({
...
@@ -162,7 +174,7 @@ export default {
...
@@ -162,7 +174,7 @@ export default {
}
}
.g2-legend-price
{
.g2-legend-price
{
display
:
inline-block
;
display
:
inline-block
;
width
:
72
px
;
width
:
86
px
;
text-align
:
right
;
text-align
:
right
;
}
}
}
}
...
...
src/containers/HomePage/Home.vue
View file @
1db2d66b
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
<CustomerRegister
<CustomerRegister
v-if=
"show"
v-if=
"show"
class=
"Dashboard-Row Dashboard-DataCard"
class=
"Dashboard-Row Dashboard-DataCard"
:isAdmin=
"isAdmin"
/>
/>
</div>
</div>
</
template
>
</
template
>
...
@@ -23,13 +24,20 @@ export default {
...
@@ -23,13 +24,20 @@ export default {
},
},
computed
:
{
computed
:
{
...
mapGetters
([
'asyncRoutes'
]),
...
mapGetters
([
'asyncRoutes'
]),
isAdmin
()
{
return
this
.
$route
.
meta
.
btns
&&
this
.
$route
.
meta
.
btns
[
'0001'
]
?
true
:
false
;
},
},
},
mounted
()
{
mounted
()
{
let
item
=
this
.
asyncRoutes
.
find
(
let
item
=
this
.
asyncRoutes
.
find
(
item
=>
item
.
menuCode
===
process
.
env
.
VUE_APP_REGISTER_DASHBOARD_CODE
item
=>
item
.
menuCode
===
process
.
env
.
VUE_APP_REGISTER_DASHBOARD_CODE
);
);
if
(
item
)
{
if
(
item
)
{
this
.
fetchReportList
();
this
.
fetchReportList
({
isAdmin
:
this
.
isAdmin
?
1
:
0
,
});
this
.
show
=
true
;
this
.
show
=
true
;
}
}
},
},
...
...
src/containers/layout/IconMenu/IconMenu.vue
View file @
1db2d66b
...
@@ -102,7 +102,12 @@ export default {
...
@@ -102,7 +102,12 @@ export default {
menu
.
menuCode
!==
process
.
env
.
VUE_APP_DASHBOARD_CODE
&&
menu
.
menuCode
!==
process
.
env
.
VUE_APP_DASHBOARD_CODE
&&
menu
.
menuCode
!==
process
.
env
.
VUE_APP_REGISTER_DASHBOARD_CODE
menu
.
menuCode
!==
process
.
env
.
VUE_APP_REGISTER_DASHBOARD_CODE
);
);
return
formatRouteLink
(
routeList
);
let
list
=
formatRouteLink
(
routeList
);
// if (list && list.length) {
// if (list[0].children && list[0].children.length)
// this.selectRouteMenu(list[0].children);
// }
return
list
;
},
},
dashboardButtonVisiable
()
{
dashboardButtonVisiable
()
{
let
item
=
this
.
routers
.
find
(
let
item
=
this
.
routers
.
find
(
...
@@ -112,14 +117,25 @@ export default {
...
@@ -112,14 +117,25 @@ export default {
},
},
},
},
watch
:
{
watch
:
{
routers
(
val
)
{
this
.
getInitMemu
();
},
collectList
(
val
)
{
collectList
(
val
)
{
this
.
getCollectList
(
val
);
this
.
getCollectList
(
val
);
},
},
},
},
mounted
()
{
mounted
()
{
this
.
getInitMemu
();
this
.
getCollectList
(
this
.
collectList
);
this
.
getCollectList
(
this
.
collectList
);
},
},
methods
:
{
methods
:
{
getInitMemu
()
{
if
(
this
.
routers
&&
this
.
routers
.
length
)
{
let
list
=
formatRouteLink
([
this
.
routers
[
0
]]);
if
(
list
[
0
].
children
&&
list
[
0
].
children
.
length
)
this
.
selectRouteMenu
(
list
[
0
].
children
);
}
},
getCollectList
(
val
)
{
getCollectList
(
val
)
{
let
routers
=
formatRouteLink
(
this
.
routers
);
let
routers
=
formatRouteLink
(
this
.
routers
);
let
list
=
val
.
map
(
item
=>
{
let
list
=
val
.
map
(
item
=>
{
...
...
src/containers/login/index.vue
View file @
1db2d66b
...
@@ -148,12 +148,10 @@ export default {
...
@@ -148,12 +148,10 @@ export default {
console
.
log
(
'login done'
);
console
.
log
(
'login done'
);
this
.
loading
=
false
;
this
.
loading
=
false
;
if
(
let
dashboardPage
=
userRoles
.
find
(
userRoles
.
find
(
item
=>
item
.
menuCode
===
process
.
env
.
VUE_APP_DASHBOARD_CODE
item
=>
item
.
menuCode
===
process
.
env
.
VUE_APP_DASHBOARD_CODE
);
)
&&
if
(
dashboardPage
&&
this
.
$router
.
options
.
base
===
'/'
)
{
this
.
$router
.
options
.
base
===
'/'
)
{
this
.
$router
.
push
({
name
:
'dashboard'
});
this
.
$router
.
push
({
name
:
'dashboard'
});
}
else
{
}
else
{
this
.
$router
.
push
({
path
:
'/'
});
this
.
$router
.
push
({
path
:
'/'
});
...
...
src/dev-local/develop.js
View file @
1db2d66b
import
System
from
'../lib/main'
;
import
System
from
'../lib/main'
;
import
asyncRouterMap
from
'../router/asyncRoutes'
;
window
.
manageShell
=
{
default
:
System
};
window
.
manageShell
=
{
default
:
System
};
setTimeout
(()
=>
{
setTimeout
(()
=>
{
let
allAasyncRouterMap
=
[];
let
allAasyncRouterMap
=
[
...
asyncRouterMap
];
let
routeNameList
=
[
let
routeNameList
=
[
'customerManage'
,
'customerManage'
,
'baseManage'
,
'baseManage'
,
...
@@ -44,6 +45,10 @@ setTimeout(() => {
...
@@ -44,6 +45,10 @@ setTimeout(() => {
const
element
=
addRoute
[
index
];
const
element
=
addRoute
[
index
];
if
(
element
.
children
)
{
if
(
element
.
children
)
{
routes
=
routes
.
concat
(
element
.
children
);
routes
=
routes
.
concat
(
element
.
children
);
}
else
if
(
element
.
menuCode
===
process
.
env
.
VUE_APP_REGISTER_DASHBOARD_CODE
)
{
routes
.
unshift
(
element
);
}
}
}
}
}
}
...
...
src/lib/Api.js
View file @
1db2d66b
...
@@ -102,5 +102,21 @@ const createBaseFetch = config => {
...
@@ -102,5 +102,21 @@ const createBaseFetch = config => {
},
errorHandle
);
},
errorHandle
);
return
service
;
return
service
;
};
};
class
ApiCreator
{
constructor
()
{
return
ApiCreator
.
getInstance
();
}
static
getInstance
()
{
if
(
ApiCreator
.
instance
)
{
}
else
if
(
window
.
ApiCreator
)
{
ApiCreator
.
instance
=
window
.
ApiCreator
;
}
else
{
ApiCreator
.
instance
=
createBaseFetch
;
window
.
ApiCreator
=
ApiCreator
.
instance
;
}
return
ApiCreator
.
instance
;
}
}
export
default
createBaseFetch
;
export
default
new
ApiCreator
()
;
src/lib/main.js
View file @
1db2d66b
...
@@ -23,6 +23,7 @@ class SystemShell {
...
@@ -23,6 +23,7 @@ class SystemShell {
this
.
storeModule
=
storeModule
;
this
.
storeModule
=
storeModule
;
this
.
mixinModule
=
mixinModule
;
this
.
mixinModule
=
mixinModule
;
this
.
utils
=
utilsModule
;
this
.
utils
=
utilsModule
;
this
.
createBaseFetch
=
createBaseFetch
;
}
}
createSystem
=
({
createSystem
=
({
basePath
=
'/'
,
basePath
=
'/'
,
...
@@ -71,6 +72,5 @@ class SystemShell {
...
@@ -71,6 +72,5 @@ class SystemShell {
});
});
return
app
;
return
app
;
};
};
createBaseFetch
=
createBaseFetch
;
}
}
export
default
new
SystemShell
();
export
default
new
SystemShell
();
src/lib/permission.js
View file @
1db2d66b
import
{
asyncRouterMap
}
from
'../router'
;
import
{
asyncRouterMap
}
from
'../router'
;
import
asyncRoutes
from
'../router/asyncRoutes'
;
import
NProgress
from
'nprogress'
;
// Progress 进度条
import
NProgress
from
'nprogress'
;
// Progress 进度条
import
'nprogress/nprogress.css'
;
// Progress 进度条样式
import
'nprogress/nprogress.css'
;
// Progress 进度条样式
import
{
getToken
}
from
'@/utils/auth'
;
// 验权
import
{
getToken
}
from
'@/utils/auth'
;
// 验权
...
@@ -15,6 +16,11 @@ const configRoutePermission = (
...
@@ -15,6 +16,11 @@ const configRoutePermission = (
const
getRouteAdd
=
()
=>
{
const
getRouteAdd
=
()
=>
{
let
allRoute
=
store
.
getters
.
asyncRoutes
;
let
allRoute
=
store
.
getters
.
asyncRoutes
;
let
asyncRouters
=
getAuthRoute
(
allAasyncRouterMap
,
allRoute
);
let
asyncRouters
=
getAuthRoute
(
allAasyncRouterMap
,
allRoute
);
let
indexPage
=
asyncRouters
.
find
(
item
=>
item
.
path
===
'/'
);
if
(
!
indexPage
)
{
router
.
addRoutes
([
asyncRoutes
[
0
]]);
// 添加首页
}
router
.
addRoutes
(
asyncRouters
);
// 动态添加可访问路由表
router
.
addRoutes
(
asyncRouters
);
// 动态添加可访问路由表
router
.
addRoutes
(
asyncRouterMap
);
router
.
addRoutes
(
asyncRouterMap
);
};
};
...
...
src/main.js
View file @
1db2d66b
let
allAasyncRouterMap
=
[];
import
asyncRouterMap
from
'./router/asyncRoutes'
;
let
allAasyncRouterMap
=
[...
asyncRouterMap
];
let
routeNameList
=
[
let
routeNameList
=
[
'customerManage'
,
'customerManage'
,
'baseManage'
,
'baseManage'
,
...
@@ -19,7 +21,7 @@ routeNameList.map(name => {
...
@@ -19,7 +21,7 @@ routeNameList.map(name => {
const
System
=
manageShell
.
default
;
const
System
=
manageShell
.
default
;
System
.
createSystem
({
export
default
System
.
createSystem
({
basePath
:
process
.
env
.
VUE_APP_BASE_URL
,
basePath
:
process
.
env
.
VUE_APP_BASE_URL
,
routers
:
allAasyncRouterMap
,
routers
:
allAasyncRouterMap
,
routeFilter
:
(
routes
,
allRoute
)
=>
{
routeFilter
:
(
routes
,
allRoute
)
=>
{
...
@@ -29,6 +31,10 @@ System.createSystem({
...
@@ -29,6 +31,10 @@ System.createSystem({
const
element
=
addRoute
[
index
];
const
element
=
addRoute
[
index
];
if
(
element
.
children
)
{
if
(
element
.
children
)
{
routes
=
routes
.
concat
(
element
.
children
);
routes
=
routes
.
concat
(
element
.
children
);
}
else
if
(
element
.
menuCode
===
process
.
env
.
VUE_APP_REGISTER_DASHBOARD_CODE
)
{
routes
.
unshift
(
element
);
}
}
}
}
}
}
...
...
src/router/asyncRoutes.js
0 → 100644
View file @
1db2d66b
import
_import
from
'./_import'
;
import
HomeIcon
from
'@/assets/images/menu/home.png'
;
export
default
[
{
path
:
'/'
,
name
:
'home'
,
code
:
'0083'
,
meta
:
{
title
:
'首页'
,
icon
:
HomeIcon
,
store
:
require
(
'@/containers/Dashboard/store'
).
default
,
},
component
:
_import
(
'HomePage/Home'
),
},
{
path
:
'/dashboard'
,
name
:
'dashboard'
,
code
:
'0079'
,
meta
:
{
title
:
'数据首页'
,
store
:
require
(
'@/containers/Dashboard/store'
).
default
,
},
component
:
_import
(
'Dashboard/Dashboard'
),
hidden
:
true
,
},
];
src/router/index.js
View file @
1db2d66b
...
@@ -3,7 +3,6 @@ import routeStore from './store';
...
@@ -3,7 +3,6 @@ import routeStore from './store';
import
Login
from
'@/containers/login/index'
;
import
Login
from
'@/containers/login/index'
;
import
errorPage404
from
'@/containers/errorPage/404'
;
import
errorPage404
from
'@/containers/errorPage/404'
;
import
errorPage401
from
'@/containers/errorPage/401'
;
import
errorPage401
from
'@/containers/errorPage/401'
;
import
HomeIcon
from
'@/assets/images/menu/home.png'
;
Vue
.
use
(
VueRouter
);
Vue
.
use
(
VueRouter
);
...
@@ -11,26 +10,6 @@ const constantRouterMap = [
...
@@ -11,26 +10,6 @@ const constantRouterMap = [
{
path
:
'/login'
,
component
:
Login
,
hidden
:
true
},
{
path
:
'/login'
,
component
:
Login
,
hidden
:
true
},
{
path
:
'/404'
,
component
:
errorPage404
,
hidden
:
true
},
{
path
:
'/404'
,
component
:
errorPage404
,
hidden
:
true
},
{
path
:
'/401'
,
component
:
errorPage401
,
hidden
:
true
},
{
path
:
'/401'
,
component
:
errorPage401
,
hidden
:
true
},
{
path
:
'/'
,
name
:
'home'
,
meta
:
{
title
:
'首页'
,
icon
:
HomeIcon
,
store
:
require
(
'@/containers/Dashboard/store'
).
default
,
},
component
:
_import
(
'HomePage/Home'
),
},
{
path
:
'/dashboard'
,
component
:
_import
(
'Dashboard/Dashboard'
),
name
:
'dashboard'
,
meta
:
{
title
:
'数据首页'
,
store
:
require
(
'@/containers/Dashboard/store'
).
default
,
},
hidden
:
true
,
},
];
];
const
asyncRouterMap
=
[{
path
:
'*'
,
redirect
:
'/404'
,
hidden
:
true
}];
const
asyncRouterMap
=
[{
path
:
'*'
,
redirect
:
'/404'
,
hidden
:
true
}];
...
...
src/utils/route.js
View file @
1db2d66b
...
@@ -12,6 +12,18 @@ export const formatRouteLink = (addRoute, path = '/') => {
...
@@ -12,6 +12,18 @@ export const formatRouteLink = (addRoute, path = '/') => {
children
:
formatRouteLink
(
route
.
childs
,
path
+
route
.
menuLink
+
'/'
),
children
:
formatRouteLink
(
route
.
childs
,
path
+
route
.
menuLink
+
'/'
),
};
};
}
else
{
}
else
{
if
(
route
.
menuCode
==
process
.
env
.
VUE_APP_REGISTER_DASHBOARD_CODE
)
{
return
{
path
:
'/'
,
name
:
route
.
id
.
toString
(),
menuCode
:
route
.
menuCode
,
meta
:
{
title
:
'首页'
,
icon
:
route
.
menuPicSmall
,
bicon
:
route
.
menuPicBig
,
},
};
}
return
{
return
{
path
:
path
+
route
.
menuLink
,
path
:
path
+
route
.
menuLink
,
name
:
route
.
id
.
toString
(),
name
:
route
.
id
.
toString
(),
...
@@ -33,7 +45,11 @@ export const getAuthRoute = (asyncRouterMap, addRoute, path = '/') => {
...
@@ -33,7 +45,11 @@ export const getAuthRoute = (asyncRouterMap, addRoute, path = '/') => {
path
:
path
+
route
.
menuLink
,
path
:
path
+
route
.
menuLink
,
component
:
{
render
:
h
=>
<
router
-
view
/>
},
component
:
{
render
:
h
=>
<
router
-
view
/>
},
name
:
route
.
id
,
name
:
route
.
id
,
meta
:
{
title
:
route
.
menuName
,
icon
:
route
.
menuPicSmall
},
meta
:
{
title
:
route
.
menuName
,
icon
:
route
.
menuPicSmall
,
bicon
:
route
.
menuPicBig
,
},
children
:
getAuthRoute
(
children
:
getAuthRoute
(
asyncRouterMap
,
asyncRouterMap
,
route
.
childs
,
route
.
childs
,
...
@@ -45,6 +61,29 @@ export const getAuthRoute = (asyncRouterMap, addRoute, path = '/') => {
...
@@ -45,6 +61,29 @@ export const getAuthRoute = (asyncRouterMap, addRoute, path = '/') => {
item
=>
item
.
code
===
route
.
menuCode
item
=>
item
.
code
===
route
.
menuCode
);
);
if
(
localcomponent
)
{
if
(
localcomponent
)
{
if
(
route
.
menuCode
==
process
.
env
.
VUE_APP_DASHBOARD_CODE
||
route
.
menuCode
==
process
.
env
.
VUE_APP_REGISTER_DASHBOARD_CODE
)
{
return
{
path
:
localcomponent
.
path
,
component
:
localcomponent
.
component
,
name
:
localcomponent
.
name
,
menuCode
:
route
.
menuCode
,
meta
:
{
...
localcomponent
.
meta
,
icon
:
route
.
menuPicSmall
,
bicon
:
route
.
menuPicBig
,
btns
:
route
.
listMenuButtonVo
.
reduce
(
(
btns
,
val
)
=>
val
.
buttonCode
?
{
...
btns
,
[
val
.
buttonCode
]:
val
.
state
===
'1'
}
:
btns
,
{}
),
},
};
}
return
{
return
{
path
:
path
+
route
.
menuLink
,
path
:
path
+
route
.
menuLink
,
component
:
localcomponent
.
component
,
component
:
localcomponent
.
component
,
...
@@ -54,6 +93,7 @@ export const getAuthRoute = (asyncRouterMap, addRoute, path = '/') => {
...
@@ -54,6 +93,7 @@ export const getAuthRoute = (asyncRouterMap, addRoute, path = '/') => {
...
localcomponent
.
meta
,
...
localcomponent
.
meta
,
title
:
route
.
menuName
,
title
:
route
.
menuName
,
icon
:
route
.
menuPicSmall
,
icon
:
route
.
menuPicSmall
,
bicon
:
route
.
menuPicBig
,
btns
:
route
.
listMenuButtonVo
.
reduce
(
btns
:
route
.
listMenuButtonVo
.
reduce
(
(
btns
,
val
)
=>
(
btns
,
val
)
=>
val
.
buttonCode
val
.
buttonCode
...
...
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