<script>
  import {login} from '@/api/api.js'
	export default {
		onLaunch: function() {
      let query = uni.getStorageSync('query');
      if(query){
        login(JSON.parse(query)).then(res=>{
          console.log('登录成功');
          this.$store.commit('SET_USERINFO', res.member);
          this.$store.commit('SET_TOKEN', {
            token: res.tokenList.tokenType ? res.tokenList.tokenType + ' ' + res.tokenList.accessToken : res.tokenList.accessToken,
            token_time: res.tokenList.accessTokenExp
          });
        }).catch(err=>{
          console.log('登录失败');
          uni.redirectTo({
            url: '/pages/login/login'
          })
        })
      }else uni.redirectTo({
            url: '/pages/login/login'
          })
			console.log('App Launch')
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style>
	/*每个页面公共css */
</style>
