<template> <div id="app" v-if="showPage"> <router-view ></router-view> </div> </template> <script> import '../../common/css/reset.css' import logo from '../../common/icon/indexlogo.jpg' import wxsdk from '../../util/share' import { mapState, createNamespacedHelpers } from 'vuex' const { mapActions: actions } = createNamespacedHelpers('userCenter') export default { name: 'app', data () { return { showPage: false, logo } }, components: {}, computed: { ...mapState({ userInfo: x => x.userCenter.userInfo, org: x => x.app.orgId }) }, created () { if (location.search && this.toolClass.UrlSearch(location.search).code) { this.code = this.toolClass.UrlSearch(location.search).code } else { this.code = null } this.getUserInfo({ org: this.org, code: this.code }).then(() => { this.showPage = true }) wxsdk({ url: encodeURIComponent(window.location.href.split('#')[0]) }, { title: '城的空间', desc: '城的空间', link: `${window.location.origin}${window.location.pathname}/user.html#/mainPage/indexPage`, thu_image: `${window.location.origin}${window.location.pathname}${logo}` }) // 计算距离方法 console.log(this.toolClass.getGreatCircleDistance(117.225495, 39.133713, 117.225962, 39.132573)) }, methods: { ...actions(['getUserInfo']) } } </script> <style> #app { width: 100%; height: 100%; position: relative; } </style>