index.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <view class="app-page"></view>
  3. </template>
  4. <script>
  5. const homePagePath = '/pages/tabbar/home/home'
  6. const startPagePath = '/pagesA/start/start'
  7. export default {
  8. computed: {
  9. configs() {
  10. return this.$tm.vx.getters().getConfigs;
  11. }
  12. },
  13. onLoad() {
  14. uni.$tm.vx.actions('config/fetchConfigs').then((res) => {
  15. // #ifdef MP-WEIXIN
  16. // uni.$tm.vx.commit('setWxShare', res.shareConfig);
  17. // #endif
  18. this.fnCheckShowStarted();
  19. }).catch((err) => {
  20. uni.switchTab({
  21. url: homePagePath
  22. });
  23. })
  24. },
  25. methods: {
  26. fnCheckShowStarted() {
  27. if (!this.configs.appConfig.startConfig.enabled) {
  28. uni.switchTab({
  29. url: homePagePath
  30. });
  31. return;
  32. }
  33. // 是否每次都显示启动页
  34. if (this.configs.appConfig.startConfig.alwaysShow) {
  35. uni.removeStorageSync('APP_HAS_STARTED')
  36. uni.redirectTo({
  37. url: startPagePath
  38. });
  39. return;
  40. }
  41. // 只显示一次启动页
  42. if (uni.getStorageSync('APP_HAS_STARTED')) {
  43. uni.switchTab({
  44. url: homePagePath
  45. });
  46. } else {
  47. uni.redirectTo({
  48. url: startPagePath
  49. });
  50. }
  51. }
  52. }
  53. };
  54. </script>