building-sign/pages/pagehome/pagehome.vue

40 lines
644 B
Vue

<template>
<view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
onShow() {
// 获取用户信息
this.getUserInfo();
},
methods: {
// 获取用户信息
getUserInfo(){
this.$requst.post('/api/v1/user/info').then(res=>{
if(res.code==0){
console.log(res,'用户信息');
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>