building-sign/pages/pagehome/pagehome.vue

47 lines
877 B
Vue
Raw Normal View History

2022-11-15 10:03:13 +00:00
<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){
2022-11-23 08:46:52 +00:00
console.log(res,'用户信息');
// 缓存工人状态
uni.setStorageSync('worker_role',res.data.role);
// 判断进入路面
2022-11-15 10:03:13 +00:00
if(res.data.role==0 || res.data.role==1){
uni.reLaunch({
url:'/pages/worker/sign/sign?userType=worker'
2022-11-15 10:03:13 +00:00
})
2022-11-21 09:22:31 +00:00
}else if(res.data.role==2){
2022-11-15 10:03:13 +00:00
uni.reLaunch({
url:'/pages/worker/sign/sign?userType=director'
2022-11-15 10:03:13 +00:00
})
2022-11-21 09:22:31 +00:00
}else{
uni.reLaunch({
url:'/pages/worker/sign/sign?userType=worker'
2022-11-21 09:22:31 +00:00
})
2022-11-15 10:03:13 +00:00
}
}
})
}
}
}
</script>
<style>
</style>