diff --git a/App.vue b/App.vue index 3d847b7..1d20fc6 100644 --- a/App.vue +++ b/App.vue @@ -3,9 +3,16 @@ globalData: { navbarHeight: 44, }, - onLaunch: function() { + onLaunch: async function() { console.log('App Launch') this.globalData.navbarHeight = uni.getSystemInfoSync().safeArea.top + + try { + const { user } = await this.$u.api.getUserInfo() + this.$u.vuex('vuex_user', user) + } catch (err) { + console.error(err) + } }, onShow: function() { console.log('App Show') diff --git a/common/http.interceptor.js b/common/http.interceptor.js index d71ba26..2f1fcce 100644 --- a/common/http.interceptor.js +++ b/common/http.interceptor.js @@ -22,8 +22,9 @@ const install = (Vue, vm) => { Vue.prototype.$u.http.interceptor.request = (config) => { console.log('config-http', config) // 引用token - if (vm.vuex_token) { - config.header['Authorization'] = `Bearer ${vm.vuex_token}`; + let token = vm.vuex_token ? vm.vuex_token : uni.getStorageSync('lifeData')?.vuex_token; + if (token) { + config.header['Authorization'] = `Bearer ${token}`; } return config; } diff --git a/manifest.json b/manifest.json index e95184e..cbd1c15 100644 --- a/manifest.json +++ b/manifest.json @@ -55,9 +55,9 @@ "urlCheck" : false }, "usingComponents" : true, - "permission": { - "scope.userLocation": { - "desc": "需要获取您的定位" + "permission" : { + "scope.userLocation" : { + "desc" : "需要获取您的定位" } }, "requiredPrivateInfos" : [ "getLocation" ], diff --git a/pages/index/index.vue b/pages/index/index.vue index 41bd0ac..ad3609a 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -64,6 +64,9 @@ v-for="item in links" :key="item.text" bg-color="transparent" + @click="$u.throttle($u.route({ + url: item.to + }))" > {{ item.text }} @@ -193,6 +196,7 @@ export default { { text: "陪诊服务", icon: "/static/index/peizhenfuwu.png", + to: "/package_sub/pages/ServiceList/ServiceList" }, { text: "就医服务", diff --git a/pages/me/me.vue b/pages/me/me.vue index 8c9ef22..1c43018 100644 --- a/pages/me/me.vue +++ b/pages/me/me.vue @@ -6,8 +6,8 @@ - 我的 - 手机号:18888888888 + {{ vuex_user.nickname || '微信用户' }} + 手机号:{{ vuex_user.mobile || '' }}