Commit 73056721 by 潘建波

解决刷新页面不在当前页问题

1 parent 2fe2818e
...@@ -10,6 +10,16 @@ export default { ...@@ -10,6 +10,16 @@ export default {
} }
}, },
created(){
let menus = JSON.parse(localStorage.getItem('menu'))
if(menus) {
this.$store.dispatch('GetMenuRole',menus).then(res => {})
}
},
mounted(){
}
} }
</script> </script>
<style lang="scss"> <style lang="scss">
......
...@@ -55,7 +55,8 @@ export const asyncRouterMap = [ ...@@ -55,7 +55,8 @@ export const asyncRouterMap = [
meta: { meta: {
icon: "el-icon-location" icon: "el-icon-location"
}, },
component: resolve => require(["../views/sceneManage/index.vue"], resolve) component: resolve =>
require(["../views/sceneManage/index.vue"], resolve)
}, },
{ {
path: "/task/taskSet", path: "/task/taskSet",
...@@ -63,10 +64,12 @@ export const asyncRouterMap = [ ...@@ -63,10 +64,12 @@ export const asyncRouterMap = [
meta: { meta: {
icon: "el-icon-location" icon: "el-icon-location"
}, },
component: resolve => require(["../views/taskManage/index.vue"], resolve) component: resolve =>
require(["../views/taskManage/index.vue"], resolve)
} }
] ]
},{ },
{
path: "/search", path: "/search",
name: "智能检索", name: "智能检索",
component: resolve => require(["../views/Layout/index.vue"], resolve), component: resolve => require(["../views/Layout/index.vue"], resolve),
...@@ -97,7 +100,8 @@ export const asyncRouterMap = [ ...@@ -97,7 +100,8 @@ export const asyncRouterMap = [
meta: { meta: {
icon: "el-icon-location" icon: "el-icon-location"
}, },
component: resolve => require(["../views/search/pedestrian.vue"], resolve) component: resolve =>
require(["../views/search/pedestrian.vue"], resolve)
}, },
{ {
path: "/search/event", path: "/search/event",
...@@ -118,29 +122,31 @@ export const asyncRouterMap = [ ...@@ -118,29 +122,31 @@ export const asyncRouterMap = [
{ {
path: "/search/traficflow", path: "/search/traficflow",
name: "交通流量", name: "交通流量",
meta: { meta: {
icon: "el-icon-location" icon: "el-icon-location"
}, },
component: resolve => require(['../views/search/traficflow.vue'], resolve), component: resolve =>
},{ require(["../views/search/traficflow.vue"], resolve)
path: "/search/publicFlow", },
{
path: "/search/flow",
name: "公共客流", name: "公共客流",
meta: { meta: {
icon: "el-icon-location" icon: "el-icon-location"
}, },
component: resolve => require(['../views/search/publicFlow.vue'], resolve), component: resolve =>
require(["../views/search/publicFlow.vue"], resolve)
} }
] ]
},{ },
{
path: "/resource", path: "/resource",
name: "资源管理", name: "资源管理",
component: resolve => require(["../views/Layout/index.vue"], resolve), component: resolve => require(["../views/Layout/index.vue"], resolve),
meta: { meta: {
icon: "el-icon-location" icon: "el-icon-location"
}, },
children: [ children: []
]
} }
]; ];
const router = new VueRouter({ const router = new VueRouter({
......
<<<<<<< HEAD
<template> <template>
<div class="home" @keyup.esc="KeyUpF11"> <div>
<el-container class="home-box">
<el-header class="headers"> </div>
<img class="logoImg" src="../assets/img/home/logo.png" alt="">
<div class="headRight">
<span>2019-11-15 16:50 星期一</span>
<img src="../assets/img/home/user.png" alt="">
<span class="exit">退出<i class="el-icon-arrow-down"></i></span>
</div>
</el-header>
<el-container style="min-height:calc(100vh - 64px);">
<el-aside :width="menuwidth">
<el-menu default-active="/trficcshow" class="el-menu-vertical-demo" :collapse="isCollapse" @select="handleSelect">
<el-submenu index="1">
<template slot="title">
<i class="el-icon-location"></i>
<span slot="title">首页</span>
</template>
<el-menu-item index="/trficcshow"> <i class="el-icon-location"></i>交通展示</el-menu-item>
<el-menu-item index="/behaviorshow"> <i class="el-icon-location"></i>综治展示</el-menu-item>
</el-submenu>
<el-submenu index="2">
<template slot="title">
<i class="el-icon-location"></i>
<span slot="title">任务管理</span>
</template>
<el-menu-item index="/task/sceneSet"> <i class="el-icon-location"></i>场景配置</el-menu-item>
<el-menu-item index="/task/taskSet"> <i class="el-icon-location"></i>任务配置</el-menu-item>
</el-submenu>
<el-submenu index="3">
<template slot="title">
<i class="el-icon-document"></i>
<span slot="title">智能检索</span>
</template>
<el-menu-item index="/search/vehicleSearch"> <i class="el-icon-location"></i>过车记录检索</el-menu-item>
<el-menu-item index="/search/xcycle"> <i class="el-icon-location"></i>非机动车检索</el-menu-item>
<el-menu-item index="/search/pedestrian"> <i class="el-icon-location"></i>行人检索</el-menu-item>
<el-menu-item index="/search/event"> <i class="el-icon-location"></i>事件查询</el-menu-item>
<el-menu-item index="/search/illegal"> <i class="el-icon-location"></i>违法记录查询</el-menu-item>
<el-menu-item index="/search/publicFlow"> <i class="el-icon-location"></i>公共客流</el-menu-item>
<el-menu-item index="/search/traficflow"> <i class="el-icon-location"></i>交通流量</el-menu-item>
</el-submenu>
<el-submenu index="4">
<template slot="title">
<i class="el-icon-document"></i>
<span slot="title">资源管理</span>
</template>
<el-menu-item index="/resource/videoEquipment"> <i class="el-icon-location"></i>视频设备</el-menu-item>
</el-submenu>
</el-menu>
</el-aside>
<el-main>
<div class="nav"></div>
<router-view></router-view>
</el-main>
</el-container>
</el-container>
</div>
</template> </template>
<script> <script>
// import HelloWorld from "@/components/HelloWorld.vue";
export default { export default {
name: "home", data() {
data(){ return {
return{
isCollapse: false,
conHeight:0,
menuwidth:"254px",
full:false
};
},
created(){
this.$router.push('/trficcshow')
},
mounted(){
this.conHeight=window.innerHeight-65;
console.log(this.conHeight)
document.addEventListener("keydown", (event)=>{
var e = event || window.event || arguments.callee.caller.arguments[0];
if(e && e.keyCode==122 ){ // 按 Esc
if(this.full) {
this.menuwidth = "254px";
this.full = false
return
}
this.menuwidth = 0
this.full = true
}
});
},
components: {
// HelloWorld
},
methods:{
handleSelect(key, keyPath) {
this.$router.push(key)
console.log(key, keyPath);
} }
} },
}; created(){
alert(1)
}
}
</script> </script>
<style lang="stylus" scoped>
</style>
\ No newline at end of file \ No newline at end of file
<style>
</style>>
\ No newline at end of file \ No newline at end of file
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
// import HelloWorld from "@/components/HelloWorld.vue"; // import HelloWorld from "@/components/HelloWorld.vue";
import menus from './menu' import menus from './menu'
export default { export default {
name: "home", name: "x",
data(){ data(){
return{ return{
isCollapse: false, isCollapse: false,
...@@ -36,8 +36,6 @@ export default { ...@@ -36,8 +36,6 @@ export default {
}; };
}, },
created(){ created(){
}, },
components:{ components:{
menus menus
......
...@@ -39,7 +39,7 @@ export default { ...@@ -39,7 +39,7 @@ export default {
return { return {
full: false, full: false,
isCollapse: false, isCollapse: false,
activemenu: "/search/vehicleSearch" activemenu: "/"
}; };
}, },
methods: { methods: {
...@@ -54,15 +54,12 @@ export default { ...@@ -54,15 +54,12 @@ export default {
}, },
created() { created() {
let activemenu = localStorage.getItem("curmenu"); let activemenu = localStorage.getItem("curmenu");
let menus = JSON.parse(localStorage.getItem('menu')) if (activemenu) {
if(menus) { this.activemenu = activemenu;
this.$store.dispatch('GetMenuRole',menus).then(res => { this.$router.push(activemenu);
if (activemenu) { } else {
this.activemenu = activemenu; this.$router.push('/');
} else { this.activemenu = '/';
this.$router.push("/");
}
})
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!