@ -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')
@ -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;
@ -55,9 +55,9 @@
"urlCheck" : false
"usingComponents" : true,
"permission": {
"scope.userLocation": {
"desc": "需要获取您的定位"
"permission" : {
"scope.userLocation" : {
"desc" : "需要获取您的定位"
"requiredPrivateInfos" : [ "getLocation" ],
@ -64,6 +64,9 @@
v-for="item in links"
:key="item.text"
bg-color="transparent"
@click="$u.throttle($u.route({
url: item.to
}))"
>
<image class="icon" :src="item.icon" mode="aspectFit"></image>
<view class="text">{{ item.text }}</view>
@ -193,6 +196,7 @@ export default {
{
text: "陪诊服务",
icon: "/static/index/peizhenfuwu.png",
to: "/package_sub/pages/ServiceList/ServiceList"
text: "就医服务",
@ -6,8 +6,8 @@
<image class="avatar" mode="aspectFit" src="http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2119_s.jpg"></image>
<view class="info">
<view class="info-name">我的</view>
<view class="info-mobile">手机号:18888888888</view>
<view class="info-name">{{ vuex_user.nickname || '微信用户' }}</view>
<view class="info-mobile">手机号:{{ vuex_user.mobile || '' }}</view>
</view>
<tabbar />