Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gassafety
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
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
耿迪迪
gassafety
Commits
a62ec5d2
Commit
a62ec5d2
authored
Sep 23, 2021
by
纪泽龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
主页改成了当前用户的第一级路由
parent
ac181752
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
57 additions
and
28 deletions
+57
-28
index.vue
gassafety-web/src/components/TopNav/index.vue
+2
-0
permission.js
gassafety-web/src/permission.js
+20
-12
permission.js
gassafety-web/src/store/modules/permission.js
+2
-1
gaodeMapView.js
gassafety-web/src/utils/gaodeMapView.js
+11
-10
index.vue
gassafety-web/src/views/device/map/index.vue
+8
-0
index.vue
gassafety-web/src/views/enterprise/mapView/index.vue
+10
-3
login.vue
gassafety-web/src/views/login.vue
+4
-2
No files found.
gassafety-web/src/components/TopNav/index.vue
View file @
a62ec5d2
...
@@ -154,6 +154,7 @@ export default {
...
@@ -154,6 +154,7 @@ export default {
path
=
this
.
activeRoutes
(
key
);
path
=
this
.
activeRoutes
(
key
);
// console.log("path",this.$store.state.permission.topbarRouters);
// console.log("path",this.$store.state.permission.topbarRouters);
console
.
log
(
this
.
$route
.
path
);
console
.
log
(
this
.
$route
.
path
);
if
(
this
.
$route
.
path
!=
path
[
0
].
path
)
{
if
(
this
.
$route
.
path
!=
path
[
0
].
path
)
{
if
(
path
[
0
].
path
)
{
if
(
path
[
0
].
path
)
{
this
.
$router
.
push
(
path
[
0
].
path
);
this
.
$router
.
push
(
path
[
0
].
path
);
...
@@ -162,6 +163,7 @@ export default {
...
@@ -162,6 +163,7 @@ export default {
this
.
$router
.
push
(
"/index"
);
this
.
$router
.
push
(
"/index"
);
}
}
}
}
// 当点击菜单时,如果当前页面是gis地图,就晴空dilog
// if (key == "/enterprise") {
// if (key == "/enterprise") {
// // this.$store.commit("TOGGLE_DEVICE","mobile");
// // this.$store.commit("TOGGLE_DEVICE","mobile");
...
...
gassafety-web/src/permission.js
View file @
a62ec5d2
import
router
from
"./router"
;
import
router
,
{
route
}
from
"./router"
;
import
store
from
"./store"
;
import
store
from
"./store"
;
import
{
Message
}
from
"element-ui"
;
import
{
Message
}
from
"element-ui"
;
import
NProgress
from
"nprogress"
;
import
NProgress
from
"nprogress"
;
...
@@ -25,7 +25,17 @@ router.beforeEach((to, from, next) => {
...
@@ -25,7 +25,17 @@ router.beforeEach((to, from, next) => {
store
.
dispatch
(
"GenerateRoutes"
).
then
(
accessRoutes
=>
{
store
.
dispatch
(
"GenerateRoutes"
).
then
(
accessRoutes
=>
{
// 根据roles权限生成可访问的路由表
// 根据roles权限生成可访问的路由表
router
.
addRoutes
(
accessRoutes
);
// 动态添加可访问路由表
router
.
addRoutes
(
accessRoutes
);
// 动态添加可访问路由表
next
({
...
to
,
replace
:
true
});
// hack方法 确保addRoutes已完成
// next({ ...to, replace: true }); // hack方法 确保addRoutes已完成
// 跳转去第一个路由
const
myHome
=
accessRoutes
[
0
]?.
children
.
filter
(
item
=>
!
item
.
hidden
)[
0
];
// 跳转去第一个子元素当主页
if
(
to
.
path
==
"/enterprise/mapView"
)
{
next
({
...
myHome
,
replace
:
true
});
}
else
{
next
({
...
to
,
replace
:
true
});
}
});
});
})
})
.
catch
(
err
=>
{
.
catch
(
err
=>
{
...
@@ -50,21 +60,19 @@ router.beforeEach((to, from, next) => {
...
@@ -50,21 +60,19 @@ router.beforeEach((to, from, next) => {
}
}
});
});
export
const
getRouter
=
()
=>
{};
router
.
afterEach
((
to
,
from
)
=>
{
router
.
afterEach
((
to
,
from
)
=>
{
// 查找只有一个菜单的目录
// 查找只有一个菜单的目录
const
parentPath
=
to
.
matched
[
0
].
path
;
const
parentPath
=
to
.
matched
[
0
].
path
;
let
arr
=
store
.
state
.
permission
.
topbarRouters
.
filter
(
item
=>
{
let
arr
=
store
.
state
.
permission
.
topbarRouters
return
item
.
path
==
parentPath
;
.
filter
(
item
=>
{
})[
0
].
children
.
filter
(
item
=>
{
return
item
.
path
==
parentPath
;
return
item
.
hidden
==
false
})[
0
]?.
children
.
filter
(
item
=>
{
})
return
item
.
hidden
==
false
;
});
if
(
arr
.
length
==
1
||
to
.
path
==
"/enterprise/mapView"
)
{
if
(
arr
&&
arr
.
length
==
1
||
to
.
path
==
"/enterprise/mapView"
)
{
store
.
dispatch
(
"app/toggleDevice"
,
"mobile"
);
store
.
dispatch
(
"app/toggleDevice"
,
"mobile"
);
store
.
dispatch
(
"app/closeSideBar"
,
{
withoutAnimation
:
true
});
store
.
dispatch
(
"app/closeSideBar"
,
{
withoutAnimation
:
true
});
}
else
{
}
else
{
store
.
dispatch
(
"app/toggleDevice"
,
"desktop"
);
store
.
dispatch
(
"app/toggleDevice"
,
"desktop"
);
store
.
dispatch
(
"app/closeSideBar"
,
{
withoutAnimation
:
false
});
store
.
dispatch
(
"app/closeSideBar"
,
{
withoutAnimation
:
false
});
...
...
gassafety-web/src/store/modules/permission.js
View file @
a62ec5d2
...
@@ -41,7 +41,8 @@ const permission = {
...
@@ -41,7 +41,8 @@ const permission = {
}
}
];
];
// state.topbarRouters = routes.concat(index);
// state.topbarRouters = routes.concat(index);
const
arr
=
[...
index
,
...
routes
];
// const arr = [...index, ...routes];
const
arr
=
[...
routes
];
state
.
topbarRouters
=
arr
;
state
.
topbarRouters
=
arr
;
// state.topbarRouters = routes;
// state.topbarRouters = routes;
},
},
...
...
gassafety-web/src/utils/gaodeMapView.js
View file @
a62ec5d2
...
@@ -362,18 +362,19 @@ class gaodeMap {
...
@@ -362,18 +362,19 @@ class gaodeMap {
marker
.
on
(
"mouseout"
,
infoClose
);
marker
.
on
(
"mouseout"
,
infoClose
);
marker
.
setExtData
(
data
);
marker
.
setExtData
(
data
);
that
.
deviceType
=
markerType
;
that
.
deviceType
=
markerType
;
let
editWindow
=
that
.
createInfowindow
(
"编辑"
);
editWindow
.
fileArr
=
data
.
iconUrl
!=
""
&&
data
.
iconUrl
!=
undefined
?
[{
url
:
data
.
iconUrl
}]
:
[];
editWindow
.
obj
=
marker
;
editWindow
.
gaoMap
=
that
;
editWindow
.
map
=
map
;
marker
.
on
(
"click"
,
function
(
e
)
{
marker
.
on
(
"click"
,
function
(
e
)
{
if
(
"edit"
==
that
.
mapOperateType
)
{
if
(
"edit"
==
that
.
mapOperateType
)
{
editWindow
.
form
=
e
.
target
.
getExtData
();
// let editWindow = that.createInfowindow("编辑");
editWindow
.
show
();
// editWindow.fileArr =
// data.iconUrl != "" && data.iconUrl != undefined
// ? [{ url: data.iconUrl }]
// : [];
// editWindow.obj = marker;
// editWindow.gaoMap = that;
// editWindow.map = map;
// editWindow.form = e.target.getExtData();
// editWindow.show();
}
else
if
(
"delete"
==
that
.
mapOperateType
)
{
}
else
if
(
"delete"
==
that
.
mapOperateType
)
{
let
diviceType
=
{
let
diviceType
=
{
"2"
:
"调压箱"
,
"2"
:
"调压箱"
,
...
...
gassafety-web/src/views/device/map/index.vue
View file @
a62ec5d2
...
@@ -892,7 +892,15 @@ export default {
...
@@ -892,7 +892,15 @@ export default {
console
.
log
(
"移除window事件"
);
console
.
log
(
"移除window事件"
);
window
.
removeEventListener
(
"click"
,
this
.
barClose
);
window
.
removeEventListener
(
"click"
,
this
.
barClose
);
window
.
removeEventListener
(
"resize"
,
this
.
onResize
);
window
.
removeEventListener
(
"resize"
,
this
.
onResize
);
// 离开的时候清除创建的元素
let
removeElements
=
document
.
getElementsByClassName
(
"el-dialog__wrapper"
);
const
arr
=
[...
removeElements
]
for
(
var
i
=
0
;
i
<
arr
.
length
;
i
++
){
const
item
=
arr
[
i
];
document
.
body
.
removeChild
(
item
);
}
},
},
destroyed
()
{},
};
};
</
script
>
</
script
>
...
...
gassafety-web/src/views/enterprise/mapView/index.vue
View file @
a62ec5d2
...
@@ -1015,9 +1015,9 @@ export default {
...
@@ -1015,9 +1015,9 @@ export default {
this
.
workerManInfoWindowShow
(
iten
,
lat
,
lng
);
this
.
workerManInfoWindowShow
(
iten
,
lat
,
lng
);
}
else
if
(
item
.
value
==
8
)
{
}
else
if
(
item
.
value
==
8
)
{
this
.
trouleInfoWindowShow
(
iten
,
lat
,
lng
);
this
.
trouleInfoWindowShow
(
iten
,
lat
,
lng
);
}
else
if
(
item
.
value
==
10
)
{
}
else
if
(
item
.
value
==
10
)
{
this
.
videoInfoWindowShow
(
iten
,
lat
,
lng
)
this
.
videoInfoWindowShow
(
iten
,
lat
,
lng
)
;
}
else
{
}
else
{
// 其他设备
// 其他设备
this
.
diveceInfoWindowShow
(
iten
,
lat
,
lng
);
this
.
diveceInfoWindowShow
(
iten
,
lat
,
lng
);
}
}
...
@@ -1617,6 +1617,13 @@ export default {
...
@@ -1617,6 +1617,13 @@ export default {
this
.
ws
.
close
();
this
.
ws
.
close
();
this
.
ws
=
null
;
this
.
ws
=
null
;
}
}
// 离开的时候清除创建的元素
// let removeElements = document.getElementsByClassName("el-dialog__wrapper");
// const arr = [...removeElements];
// for (var i = 0; i
<
arr
.
length
;
i
++
)
{
// const item = arr[i];
// document.body.removeChild(item);
// }
},
},
};
};
</
script
>
</
script
>
...
...
gassafety-web/src/views/login.vue
View file @
a62ec5d2
...
@@ -133,10 +133,12 @@ export default {
...
@@ -133,10 +133,12 @@ export default {
Cookies
.
set
(
"password"
,
encrypt
(
this
.
loginForm
.
password
),
{
expires
:
30
});
Cookies
.
set
(
"password"
,
encrypt
(
this
.
loginForm
.
password
),
{
expires
:
30
});
Cookies
.
set
(
'rememberMe'
,
this
.
loginForm
.
rememberMe
,
{
expires
:
30
});
Cookies
.
set
(
'rememberMe'
,
this
.
loginForm
.
rememberMe
,
{
expires
:
30
});
this
.
$store
.
dispatch
(
"Login"
,
this
.
loginForm
).
then
(()
=>
{
this
.
$store
.
dispatch
(
"Login"
,
this
.
loginForm
).
then
((
res
)
=>
{
// this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
// this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
// console.log(this.redirect)
// console.log(this.redirect)
this
.
$router
.
push
({
path
:
"/enterprise/mapView"
||
"/"
}).
catch
(()
=>
{});
// this.$router.push({ path: "/enterprise/mapView" || "/" }).catch(()=>{});
this
.
$router
.
push
({
path
:
"/"
}).
catch
(()
=>
{});
}).
catch
(()
=>
{
}).
catch
(()
=>
{
this
.
loading
=
false
;
this
.
loading
=
false
;
this
.
getCode
();
this
.
getCode
();
...
...
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