index.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <template>
  2. <view><tui-skeleton v-if="true" :loadingType="3" :isLoading="true"></tui-skeleton></view>
  3. </template>
  4. <script>
  5. import { mapActions } from 'vuex'
  6. import shareEntry from './mixins/share-entry.js'
  7. // 页面初始化
  8. export default {
  9. mixins: [shareEntry],
  10. data() {
  11. return {
  12. scene: '',
  13. state_str: ''
  14. }
  15. },
  16. onLoad(options) {
  17. this.scene = options.scene
  18. this.state_str = options.state_str
  19. },
  20. onShow() {
  21. this.init()
  22. },
  23. methods: {
  24. ...mapActions('user', ['wxAutoLogin']),
  25. // 初始化页面数据
  26. async init() {
  27. try {
  28. await this.wxAutoLogin()
  29. } catch (e) {
  30. console.log('初始化用户信息时出现了错误')
  31. } finally {
  32. this.redirectToEntry()
  33. }
  34. },
  35. // 跳转入口页面
  36. redirectToEntry() {
  37. if (this.scene) {
  38. // 处理分享信息 二维码
  39. this.shareHandle(this.scene, 'scene')
  40. } else if (this.state_str) {
  41. this.shareHandle(this.state_str, 'state_str')
  42. } else {
  43. // 默认跳转首页
  44. this.$router.switchTab('home')
  45. }
  46. }
  47. }
  48. }
  49. </script>