12345678910111213141516171819202122232425262728293031323334353637
  1. <script>
  2. import config from './config'
  3. import store from '@/store'
  4. import { getToken } from '@/utils/auth'
  5. export default {
  6. globalData:{
  7. requestUrl:'http://121.40.189.20:9001',
  8. },
  9. onLaunch: function() {
  10. this.initApp()
  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/login')
  28. }
  29. }
  30. }
  31. }
  32. </script>
  33. <style lang="scss">
  34. @import '@/static/scss/index.scss'
  35. </style>