作者 xuqiang

提交

... ... @@ -206,18 +206,36 @@
},
onLoad(option) {
this.companyid = option.companyid
uni.request({
url:this.apiUrl + 'getLoginUser',
data:{},
method:'get',
header:{
Authorization:'Bearer '+uni.getStorageSync('token')
},
success: (res) => {
console.log('获取当前登录用户信息',res)
this.userInfo = res.data.data
}
})
if(uni.getStorageSync('token')){
uni.request({
url:this.apiUrl + 'getLoginUser',
data:{},
method:'get',
header:{
Authorization:'Bearer '+uni.getStorageSync('token')
},
success: (res) => {
console.log('获取当前登录用户信息',res)
if(res.data.code == 200){
this.userInfo = res.data.data
}else{
setTimeout(()=>{
uni.showToast({
title:'登录超时,请重新登录',
icon:'none'
})
},500)
uni.reLaunch({
url:'../../login/login'
})
}
}
})
}else{
uni.reLaunch({
url:'../../login/login'
})
}
uni.setNavigationBarTitle({
title: option.factoryName //这是修改后的导航栏文字
})
... ...
... ... @@ -57,6 +57,7 @@
},
methods: {
logout(){
uni.setStorageSync('token','')
uni.reLaunch({
url:'../login/login'
})
... ...