You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
690 B

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