App.vue 751 B

1234567891011121314151617181920212223242526272829303132333435
  1. <script>
  2. import config from './config'
  3. import store from '@/store'
  4. import { getToken } from '@/utils/auth'
  5. import "@/static/iconfont.css";
  6. export default {
  7. onLaunch: function() {
  8. this.initApp()
  9. },
  10. methods: {
  11. // 初始化应用
  12. initApp() {
  13. // 初始化应用配置
  14. this.initConfig()
  15. // 检查用户登录状态
  16. //#ifdef H5
  17. this.checkLogin()
  18. //#endif
  19. },
  20. initConfig() {
  21. this.globalData.config = config
  22. },
  23. checkLogin() {
  24. if (!getToken()) {
  25. this.$tab.reLaunch('/pages/login')
  26. }
  27. }
  28. }
  29. }
  30. </script>
  31. <style lang="scss">
  32. @import '@/static/scss/index.scss'
  33. </style>