Commit 73056721 by 潘建波

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

1 parent 2fe2818e
......@@ -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>
<style lang="scss">
......
......@@ -55,7 +55,8 @@ export const asyncRouterMap = [
meta: {
icon: "el-icon-location"
},
component: resolve => require(["../views/sceneManage/index.vue"], resolve)
component: resolve =>
require(["../views/sceneManage/index.vue"], resolve)
},
{
path: "/task/taskSet",
......@@ -63,10 +64,12 @@ export const asyncRouterMap = [
meta: {
icon: "el-icon-location"
},
component: resolve => require(["../views/taskManage/index.vue"], resolve)
component: resolve =>
require(["../views/taskManage/index.vue"], resolve)
}
]
},{
},
{
path: "/search",
name: "智能检索",
component: resolve => require(["../views/Layout/index.vue"], resolve),
......@@ -97,7 +100,8 @@ export const asyncRouterMap = [
meta: {
icon: "el-icon-location"
},
component: resolve => require(["../views/search/pedestrian.vue"], resolve)
component: resolve =>
require(["../views/search/pedestrian.vue"], resolve)
},
{
path: "/search/event",
......@@ -121,26 +125,28 @@ export const asyncRouterMap = [
meta: {
icon: "el-icon-location"
},
component: resolve => require(['../views/search/traficflow.vue'], resolve),
},{
path: "/search/publicFlow",
component: resolve =>
require(["../views/search/traficflow.vue"], resolve)
},
{
path: "/search/flow",
name: "公共客流",
meta: {
icon: "el-icon-location"
},
component: resolve => require(['../views/search/publicFlow.vue'], resolve),
component: resolve =>
require(["../views/search/publicFlow.vue"], resolve)
}
]
},{
},
{
path: "/resource",
name: "资源管理",
component: resolve => require(["../views/Layout/index.vue"], resolve),
meta: {
icon: "el-icon-location"
},
children: [
]
children: []
}
];
const router = new VueRouter({
......
<<<<<<< HEAD
<template>
<div class="home" @keyup.esc="KeyUpF11">
<el-container class="home-box">
<el-header class="headers">
<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>
</div>
</template>
<script>
// import HelloWorld from "@/components/HelloWorld.vue";
export default {
name: "home",
data(){
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
}
});
data() {
return {
},
components: {
// HelloWorld
},
methods:{
handleSelect(key, keyPath) {
this.$router.push(key)
console.log(key, keyPath);
}
},
created(){
alert(1)
}
};
}
</script>
<style lang="stylus" scoped>
</style>
\ No newline at end of file
<style>
</style>>
\ No newline at end of file
......@@ -26,7 +26,7 @@
// import HelloWorld from "@/components/HelloWorld.vue";
import menus from './menu'
export default {
name: "home",
name: "x",
data(){
return{
isCollapse: false,
......@@ -36,8 +36,6 @@ export default {
};
},
created(){
},
components:{
menus
......
......@@ -39,7 +39,7 @@ export default {
return {
full: false,
isCollapse: false,
activemenu: "/search/vehicleSearch"
activemenu: "/"
};
},
methods: {
......@@ -54,15 +54,12 @@ export default {
},
created() {
let activemenu = localStorage.getItem("curmenu");
let menus = JSON.parse(localStorage.getItem('menu'))
if(menus) {
this.$store.dispatch('GetMenuRole',menus).then(res => {
if (activemenu) {
this.activemenu = activemenu;
this.$router.push(activemenu);
} else {
this.$router.push("/");
}
})
this.$router.push('/');
this.activemenu = '/';
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!