index.vue 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <template>
  2. <view style="height: 100vh;">
  3. <launch-screen v-if="pageState==0"/>
  4. <login-page v-if="pageState==1"/>
  5. <tabbar-page v-if="pageState==2"/>
  6. </view>
  7. </template>
  8. <script>
  9. import { mapState, mapMutations } from 'vuex'
  10. import LaunchScreen from './screen.vue'
  11. import TabbarPage from '../index/index.vue'
  12. import LoginPage from '../login/index.vue'
  13. import getPlatform from '../../common/platform.js'
  14. export default {
  15. components: {
  16. TabbarPage,
  17. LoginPage,
  18. LaunchScreen
  19. },
  20. data() {
  21. return {
  22. platform: '',
  23. /// 也没状态, 0: 加载启动页, 1: 登录页面, 2: 已登录, 首页
  24. pageState: 0,
  25. }
  26. },
  27. computed: {
  28. ...mapState(['userInfo'])
  29. },
  30. mounted() {
  31. setTimeout(() => {
  32. if (this.userInfo.token) {
  33. this.pageState = 2
  34. } else {
  35. this.pageState = 1
  36. }
  37. }, 0.5*1000);
  38. console.log(uni.getSystemInfoSync())
  39. console.log(uni.getSystemInfoSync().platform)
  40. console.log(getPlatform())
  41. }
  42. }
  43. </script>
  44. <style>
  45. .launch-screen {
  46. width: 100%;
  47. height: 100%;
  48. }
  49. </style>