forked from JunManYuanLong/Tcloud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.vue
56 lines (53 loc) · 1.23 KB
/
App.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<template>
<div id="app">
<!-- <img src="./assets/img/logo.png"> -->
<router-view/>
</div>
</template>
<script>
import userApi from '@/api/user.js'
export default {
name: 'App',
computed:{
userId(){
return this.$store.state.login.userid
},
projects(){
return this.$store.state.project.projects
},
},
methods:{
getUserRights(){
if(this.userId){
userApi.getUserRoleAndProject({user_id:this.userId}).then(res=>{
let data = res.data.data
this.$store.commit('SET_ROLE',data.role)
this.$store.commit('CLEAR_PROJECT_INFOS')
// if(data.project.toString()!=this.projects){
// }
// this.$store.commit('USER_PROJECTS',data.project.toString())
})
}
}
},
created(){
this.getUserRights()
},
mounted(){
//不同标签的用户变化监测刷新
let _this = this
window.addEventListener("storage",function(event){
_this.$store.commit('FLASH_TOKEN')
},false);
}
}
</script>
<style>
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
}
</style>