loading.vue 671 Bytes
<template>
</template>

<script type='text/ecmascript-6'>
export default {
  name: '',
  data () {
    return {
    }
  },
  mounted () {
    uni.showLoading({
      mask: true
    })
    let userInfo = uni.$storage.get('userInfo')
    if (userInfo) {
      // 先隐藏 loading 再跳转,避免生产环境下 loading 无法自动关闭
      uni.hideLoading()
      uni.reLaunch({
        url: '/pages/equity/index'
      })
    } else this.toLogin()
  },
  methods: {
    toLogin () {
      uni.hideLoading()
      uni.$storage.rm("userInfo")
      uni.reLaunch({
        url: '/pages/common/login'
      })
    }
  }
}
</script>

<style scoped lang='scss'>
</style>