/*
 * 全局注入器
 */
let page = {
  data() {
    return {
		
    }
  },
  computed: {
    //ios底部安全区域
    safeAreaBottom() {
      let info = uni.getSystemInfoSync()
      let safe = 20
      if (
        info &&
        ['devtools', 'ios'].includes(info.platform) &&
        info.statusBarHeight > safe
      ) {
        return info.statusBarHeight - safe
      }
      return 0
    }
  },
  methods: {
    
  },
  onLoad(options) {
	  let currentPage=this.$util.getCurrentRoute()
	  //由于路由拦截方式出现了一些bug，就不使用路由拦截了
	  let WHiTE_LIST=['pages/login/login',
					  'pages/my-camera/my-camera',
					  'pages/auth/auth',
					  'pages/test/test',
					  'pages/guest/guest',
					  'pages/guest/records/records',
					  'pages/guest/open-door/open-door'
					] 
	  if (!WHiTE_LIST.includes(currentPage)) {
		  let loginType =uni.getStorageSync("loginType")
	  	  if (this.$isEmpty(loginType)) {
	  	  	 uni.reLaunch({
	  	  	 	url:"/pages/login/login"
	  	  	 })
	  	  }
	  }
	  
  }
}

export default page
