building-sign/pages/pagehome/pagehome.vue

39 lines
683 B
Vue
Raw Normal View History

2023-01-16 15:10:35 +08:00
<template>
2022-11-15 18:03:13 +08:00
</template>
<script>
export default {
data() {
return {
}
},
2023-01-16 15:10:35 +08:00
onLoad() {
2023-01-14 12:28:31 +08:00
// 获取用户信息
this.getUserInfo();
2022-11-15 18:03:13 +08:00
},
2023-01-14 11:15:59 +08:00
methods: {
2023-01-14 12:28:31 +08:00
// 获取用户信息
getUserInfo(){
this.$requst.post('/api/v1/user/info').then(res=>{
if(res.code==0){
console.log(res,'用户信息');
2023-01-14 16:13:24 +08:00
uni.setStorageSync('worker_role',res.data.role);
2023-01-14 12:28:31 +08:00
if(res.data.role==2){
uni.reLaunch({
url:'/pages/worker/sign/sign?userType=director'
})
}else{
uni.reLaunch({
url:'/pages/worker/sign/sign?userType=worker'
})
}
}
})
},
2022-11-15 18:03:13 +08:00
}
}
</script>
<style>
</style>