|
@@ -118,15 +118,28 @@ export default {
|
|
|
computed: {
|
|
|
...mapGetters("user", ["typeList", "userInfo"])
|
|
|
},
|
|
|
- beforeMount(){
|
|
|
- if( this.userInfo && this.userInfo.token){
|
|
|
- this.loginOk = true
|
|
|
- }else{
|
|
|
- this.loginOk = false
|
|
|
- }
|
|
|
- },
|
|
|
+ // beforeMount(){
|
|
|
+ // if( this.userInfo && this.userInfo.token){
|
|
|
+ // this.loginOk = true
|
|
|
+ // }else{
|
|
|
+ // this.loginOk = false
|
|
|
+ // }
|
|
|
+ // },
|
|
|
created(){
|
|
|
this.getPostList()
|
|
|
+ this.loginOk = false
|
|
|
+ if( this.userInfo && this.userInfo.token && this.userInfo.uid){
|
|
|
+ this.loadBaseInfo().then(res=>{
|
|
|
+ if( !res || !res.uid ){
|
|
|
+ this.loginOk = false
|
|
|
+ this.doLogout().then( res=>{
|
|
|
+ this.$router.push('/')
|
|
|
+ } )
|
|
|
+ }else{
|
|
|
+ this.loginOk = true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
...mapActions("user", ["loadBaseInfo", "doLogout", "doLogin"]),
|