|
|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <div ref="layouts" :class="{'app-container': !$route.meta.hideTabBar} ">
|
|
|
+ <div ref="layouts" :class="{ 'app-container': !$route.meta.hideTabBar }">
|
|
|
<div class="layout-content">
|
|
|
<keep-alive :include="include">
|
|
|
<router-view v-if="$route.meta.keepAlive"></router-view>
|
|
|
@@ -7,14 +7,14 @@
|
|
|
<router-view v-if="!$route.meta.keepAlive"></router-view>
|
|
|
</div>
|
|
|
<div v-if="!$route.meta.hideTabBar" class="layout-footer">
|
|
|
- <TabBar :data="tabTars" @change="handleChange" />
|
|
|
+ <TabBar :data="tabTars" @change="handleChange" />
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import TabBar from '@/components/TabBar'
|
|
|
-import {userInfo} from "@/api/public";
|
|
|
+import { userInfo } from '@/api/public'
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
@@ -56,41 +56,47 @@ export default {
|
|
|
TabBar
|
|
|
},
|
|
|
created() {
|
|
|
- this.getUserInfo();
|
|
|
+ this.getUserInfo()
|
|
|
},
|
|
|
watch: {
|
|
|
$route(to, from) {
|
|
|
-
|
|
|
//如果 要 to(进入) 的页面是需要 keepAlive 缓存的,把 name push 进 include数组
|
|
|
if (to.meta.keepAlive) {
|
|
|
- !this.include.includes(to.name) && this.include.push(to.name);
|
|
|
- console.log(this.include,'缓存列表')
|
|
|
+ !this.include.includes(to.name) && this.include.push(to.name)
|
|
|
+ console.log(this.include, '缓存列表')
|
|
|
}
|
|
|
- /**
|
|
|
- * 如果要form(离开)的页面是keepAlive缓存的,
|
|
|
- * 再根据deep来判断是前进还是后退
|
|
|
- */
|
|
|
- //后退
|
|
|
- console.log(from.meta.keepAlive , to.meta.deep , from.meta.deep,'ppppppppp')
|
|
|
+ /**
|
|
|
+ * 如果要form(离开)的页面是keepAlive缓存的,
|
|
|
+ * 再根据deep来判断是前进还是后退
|
|
|
+ */
|
|
|
+ //后退
|
|
|
+ console.log(from.meta.keepAlive, to.meta.deep, from.meta.deep, 'ppppppppp')
|
|
|
if (from.meta.keepAlive && to.meta.deep < from.meta.deep) {
|
|
|
- let index = this.include.indexOf(from.name);
|
|
|
- index !== -1 && this.include.splice(index, 1);
|
|
|
- console.log(this.include,'缓存列表2')
|
|
|
+ let index = this.include.indexOf(from.name)
|
|
|
+ index !== -1 && this.include.splice(index, 1)
|
|
|
+ console.log(this.include, '缓存列表2')
|
|
|
}
|
|
|
- console.log(this.include,'缓存列表3')
|
|
|
+ console.log(this.include, '缓存列表3')
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- getUserInfo(){
|
|
|
- userInfo().then(info=>{
|
|
|
- console.log(info,'info')
|
|
|
- this.$store.commit('SET_USER_NAME',info.user.name);
|
|
|
- this.$store.commit('SET_USER_ROLELIST',info.roleList);
|
|
|
- this.$store.commit('SET_USER_ID',info.user.id);
|
|
|
- this.$store.commit('SET_USER_ORGID',info.user.orgId);
|
|
|
- this.$store.commit('SET_USER_ORGNAME',info.user.orgName);
|
|
|
- this.$store.commit('SET_USER_ORGTYPE',info.user.orgType);
|
|
|
+ getUserInfo() {
|
|
|
+ userInfo().then(info => {
|
|
|
+ console.log(info, 'info')
|
|
|
+ this.$store.commit('SET_USER_NAME', info.user.name)
|
|
|
+ this.$store.commit('SET_USER_ROLELIST', info.roleList)
|
|
|
+ this.$store.commit('SET_USER_ID', info.user.id)
|
|
|
+ this.$store.commit('SET_USER_ORGID', info.user.orgId)
|
|
|
+ this.$store.commit('SET_USER_ORGNAME', info.user.orgName)
|
|
|
+ this.$store.commit('SET_USER_ORGTYPE', info.user.orgType)
|
|
|
+ //登陆之后手动触发一次水印数据刷新
|
|
|
+
|
|
|
+
|
|
|
+ this.$parent.$refs.watercom.getWater(1)
|
|
|
+
|
|
|
+
|
|
|
})
|
|
|
+
|
|
|
this.$store.dispatch('getOrgTree')
|
|
|
},
|
|
|
handleChange(v) {
|