微信

App.vue 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 logo from '../../common/icon/indexlogo.jpg'
  9. import wxsdk from '../../util/share'
  10. import { mapState, createNamespacedHelpers } from 'vuex'
  11. const { mapActions: actions } = createNamespacedHelpers('userCenter')
  12. export default {
  13. name: 'app',
  14. data () {
  15. return {
  16. showPage: false,
  17. logo
  18. }
  19. },
  20. components: {},
  21. computed: {
  22. ...mapState({
  23. userInfo: x => x.userCenter.userInfo,
  24. org: x => x.app.orgId
  25. })
  26. },
  27. created () {
  28. if (location.search && this.toolClass.UrlSearch(location.search).code) {
  29. this.code = this.toolClass.UrlSearch(location.search).code
  30. } else {
  31. this.code = null
  32. }
  33. this.getUserInfo({ org: this.org, code: this.code }).then(() => {
  34. this.showPage = true
  35. })
  36. wxsdk({ url: encodeURIComponent(window.location.href.split('#')[0]) }, {
  37. title: '城的空间',
  38. desc: '城的空间',
  39. link: `${window.location.origin}${window.location.pathname}/user.html#/mainPage/indexPage`,
  40. thu_image: `${window.location.origin}${window.location.pathname}${logo}`
  41. })
  42. // 计算距离方法
  43. console.log(this.toolClass.getGreatCircleDistance(117.225495, 39.133713, 117.225962, 39.132573))
  44. },
  45. methods: {
  46. ...actions(['getUserInfo'])
  47. }
  48. }
  49. </script>
  50. <style>
  51. #app {
  52. width: 100%;
  53. height: 100%;
  54. position: relative;
  55. }
  56. </style>