退出登录

This commit is contained in:
liuye
2023-05-08 09:55:03 +08:00
parent d83143a783
commit 7df86b8163

View File

@@ -35,6 +35,9 @@
</div> </div>
</div> </div>
</div> </div>
<div class="logout" v-if="token">
<b class="login-out" @click="onLogout">退出登录</b>
</div>
<AiLogin ref="login" @success="getAuth()"/> <AiLogin ref="login" @success="getAuth()"/>
</div> </div>
</template> </template>
@@ -149,7 +152,22 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
this.token && this.getUserInfo() this.token && this.getUserInfo()
}) })
} },
onLogout() {
uni.showModal({
title: '提示',
content: "是否要退出登录",
success: res => {
if (res.confirm) {
this.$store.commit('logout')
this.$toast('退出成功');
setTimeout(() => {
this.getAuth();
}, 500)
}
}
})
},
}, },
onShow() { onShow() {
this.getAuth() this.getAuth()
@@ -357,6 +375,21 @@ export default {
margin-bottom: 0!important; margin-bottom: 0!important;
} }
} }
.logout {
width: 100%;
height: 96px;
padding: 0 32px;
box-sizing: border-box;
line-height: 96px;
text-align: center;
.login-out {
background: #FFF;
border-radius: 16px;
font-size: 34px;
font-weight: 500;
color: #4181FF;
}
}
} }
</style> </style>