微信

App.vue 990B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <template>
  2. <div id="app" v-if="showPage">
  3. <router-view></router-view>
  4. </div>
  5. </template>
  6. <script>
  7. import '../../common/css/reset.css'
  8. import { mapState, createNamespacedHelpers } from 'vuex'
  9. const { mapActions: actions } = createNamespacedHelpers('userCenter')
  10. export default {
  11. name: 'app',
  12. data () {
  13. return {
  14. showPage: false
  15. }
  16. },
  17. components: {},
  18. computed: {
  19. ...mapState({
  20. userInfo: x => x.userCenter.userInfo,
  21. org: x => x.app.orgId
  22. })
  23. },
  24. created () {
  25. if (location.search && this.toolClass.UrlSearch(location.search).code) {
  26. this.code = this.toolClass.UrlSearch(location.search).code
  27. } else {
  28. this.code = null
  29. }
  30. this.getUserInfo({ org: this.org, code: this.code }).then(() => {
  31. this.showPage = true
  32. })
  33. },
  34. methods: {
  35. ...actions(['getUserInfo'])
  36. }
  37. }
  38. </script>
  39. <style>
  40. #app {
  41. width: 100%;
  42. height: 100%;
  43. position: relative;
  44. }
  45. </style>