building-sign/pages/pagehome/pagehome.vue

47 lines
877 B
Vue

<template>
<view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
onLoad() {
// 获取用户信息
this.getUserInfo();
},
methods: {
// 获取用户信息
getUserInfo(){
this.$requst.post('/api/v1/user/info').then(res=>{
if(res.code==0){
console.log(res,'用户信息');
// 缓存工人状态
uni.setStorageSync('worker_role',res.data.role);
// 判断进入路径
if(res.data.role==0 || res.data.role==1){
uni.reLaunch({
url:'/pages/worker/sign/sign?userType=worker'
})
}else if(res.data.role==2){
uni.reLaunch({
url:'/pages/worker/sign/sign?userType=director'
})
}else{
uni.reLaunch({
url:'/pages/worker/sign/sign?userType=worker'
})
}
}
})
}
}
}
</script>
<style>
</style>