index.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <template>
  2. <view class="app-page"></view>
  3. </template>
  4. <script>
  5. export default {
  6. computed: {
  7. configs() {
  8. return this.$tm.vx.getters().getConfigs;
  9. }
  10. },
  11. onLoad() {
  12. uni.$tm.vx.actions('config/fetchConfigs').then((res) => {
  13. console.log('正常:', res)
  14. // #ifdef MP-WEIXIN
  15. uni.$tm.vx.commit('setWxShare', res.shareConfig);
  16. // #endif
  17. this.fnCheckShowStarted();
  18. }).catch((err) => {
  19. console.log('异常:', err)
  20. uni.switchTab({
  21. url: '/pages/tabbar/home/home'
  22. });
  23. })
  24. },
  25. methods: {
  26. fnCheckShowStarted() {
  27. if (!this.configs.startConfig.enabled) {
  28. uni.switchTab({
  29. url: '/pages/tabbar/home/home'
  30. });
  31. return;
  32. }
  33. if (uni.getStorageSync('APP_HAS_STARTED')) {
  34. uni.switchTab({
  35. url: '/pages/tabbar/home/home'
  36. });
  37. } else {
  38. uni.redirectTo({
  39. url: '/pagesA/start/start'
  40. });
  41. }
  42. }
  43. }
  44. };
  45. </script>