App.vue 785 B

1234567891011121314151617181920212223242526272829303132333435
  1. <script>
  2. import Cache from './utils/cache'
  3. export default {
  4. globalData: {
  5. },
  6. async onLaunch(options) {
  7. console.log('App Launch')
  8. const path = options.path ? '/' + options.path : '/pages/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. Cache.set('path', path)
  15. uni.reLaunch({
  16. url: '/pages/index'
  17. })
  18. }
  19. },
  20. onShow() {
  21. console.log('App Show')
  22. },
  23. onHide() {
  24. console.log('App Hide')
  25. }
  26. }
  27. </script>
  28. <style lang="scss">
  29. /*每个页面公共css */
  30. @import "@/uni_modules/uview-ui/index.scss";
  31. @import '@/static/css/flex.scss';
  32. @import '@/static/css/common.scss';
  33. @import '@/static/css/iconfont.css';
  34. </style>