App.vue 760 B

1234567891011121314151617181920212223242526272829303132333435
  1. <script>
  2. export default {
  3. globalData: {
  4. isLogin: false
  5. },
  6. async onLaunch(options) {
  7. console.log('App Launch')
  8. const path = options.path ? '/' + options.path : '/pages/index/index'
  9. if (this.$api.user.isLogin()) {
  10. await this.$api.user.info().then(res => {
  11. this.$store.dispatch('user/info', res.data)
  12. })
  13. } else {
  14. uni.reLaunch({
  15. url: '/pages/login?path=' + path
  16. })
  17. }
  18. },
  19. onShow() {
  20. console.log('App Show')
  21. },
  22. onHide() {
  23. console.log('App Hide')
  24. }
  25. }
  26. </script>
  27. <style lang="scss">
  28. /*每个页面公共css */
  29. @import "@/uni_modules/uview-ui/index.scss";
  30. @import '@/static/css/flex.scss';
  31. @import '@/static/css/common.scss';
  32. @import '@/static/css/iconfont.css';
  33. </style>