访客页面 退出登录

This commit is contained in:
2025-08-23 18:08:54 +08:00
parent 8d6c55007e
commit f259275adb
3 changed files with 891 additions and 814 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -46,6 +46,9 @@
</u-cell-group>
</view>
</view>
<view class="button-wrapper">
<button class="logout-btn" @click="logout">退出登录</button>
</view>
</view>
</template>
<script>
@@ -74,17 +77,23 @@ export default {
});
},
logout() {
this.$u.api.logout().then(res => {
this.$u.toast(res.msg);
if (res.code == '200' || res.code == '401') {
let self = this;
setTimeout(() => {
uni.reLaunch({
url: '/pages/sys/login/index'
});
}, 500);
}
// 清除用户信息并返回登录页
this.$u.vuex('vuex_user', {});
this.$u.vuex('vuex_token', '');
uni.reLaunch({
url: '/pages/sys/login/index'
});
// this.$u.api.logout().then(res => {
// this.$u.toast(res.msg);
// if (res.code == '200' || res.code == '401') {
// let self = this;
// setTimeout(() => {
// uni.reLaunch({
// url: '/pages/sys/login/index'
// });
// }, 500);
// }
// });
},
upgrade(){
// #ifdef APP-PLUS
@@ -117,8 +126,12 @@ export default {
page {
background-color: #f5f5f5;
}
.button-wrapper {
padding: 80rpx 0;
}
.wrap .u-cell-box .u-cell_title{
color:#202328;
margin-bottom: 80rpx;
}
.sign-in-images{
width: 125rpx;
@@ -131,4 +144,18 @@ page {
height:50rpx;
}
}
.logout-btn {
width: 80vw;
height: 80rpx;
background: #0090FF;
color: #fff;
font-size: 32rpx;
border: none;
border-radius: 40rpx;
display: block;
box-shadow: 0 18rpx 24rpx rgba(0, 0, 0, 0.18);
font-weight: bold;
margin: 0 auto;
}
</style>