This commit is contained in:
liuye
2024-06-12 14:03:51 +08:00
parent 1a773d10fc
commit d0727f8991
3 changed files with 92 additions and 7 deletions

View File

@@ -5,11 +5,12 @@
<div class="my-content">
<div class="user-info">
<div class="user-left">
<img src="./img/header-bg.png" alt="" class="user-img">
<img :src="user.avatarUrl" alt="" class="user-img" v-if="user.avatarUrl">
<img src="https://cdn.cunwuyun.cn/dvcp/myFamily/tx.png" alt="" class="user-img" v-else>
</div>
<div class="user-right">
<p>张总</p>
<div>党委书记</div>
<p>{{user.nickName || '微信用户'}}</p>
<div>{{user.departmentName || ''}}</div>
</div>
</div>
<!-- <div class="app-list">
@@ -30,6 +31,12 @@
</div>
</div>
</div> -->
<div class="login" v-if="!token">
<button class="login-btn" open-type="getPhoneNumber" @getphonenumber="handleAdminLogin">授权手机号登录</button>
</div>
<div class="login" v-else @click="onLogout">
<div class="login-btn">退出登录</div>
</div>
</div>
</div>
</template>
@@ -55,11 +62,32 @@
},
onLoad() {
},
methods: {
...mapActions(['autoLogin']),
...mapActions(['autoLogin', 'getUserInfo']),
handleAdminLogin({detail: {code: phoneCode}}) {
if (!this.token) {
this.autoLogin({loginWay: 'admin', phoneCode}).then(() => {
this.getUserInfo()
})
} else this.$u.toast("已登录,无需重新登录!")
},
onLogout() {
uni.showModal({
title: '提示',
content: "是否要退出登录",
success: res => {
if (res.confirm) {
this.$store.commit('logout')
this.$toast('退出成功');
setTimeout(() => {
this.getAuth();
}, 500)
}
}
})
},
}
}
</script>
@@ -141,5 +169,23 @@
}
}
}
.login {
width: 100%;
height: 96px;
padding: 0 32px;
box-sizing: border-box;
line-height: 96px;
text-align: center;
position: fixed;
bottom: 120px;
left: 0;
.login-btn {
background: #4181FF;
border-radius: 16px;
font-size: 34px;
font-weight: 500;
color: #fff;
}
}
}
</style>