用户端 退出登录清楚缓存

This commit is contained in:
小朱 2025-04-21 17:50:57 +08:00
parent 9ced4484e0
commit 3a8ae57959

View File

@ -3,7 +3,7 @@
<!-- 用户信息区域 --> <!-- 用户信息区域 -->
<view class="user-info padding"> <view class="user-info padding">
<view class="user-avatar"> <view class="user-avatar">
<image :src="`${imgPath}static/userui/tx.png`" mode="aspectFill"></image><!-- 头像 --> <image :src="`${imgPath}static/userui/tx.png`" mode="aspectFill"></image><!-- 头像 -->
</view> </view>
<view class="user-details"> <view class="user-details">
<view class="nickname">昵称</view> <view class="nickname">昵称</view>
@ -22,7 +22,8 @@
</view> </view>
</view> </view>
<view class=" flex flex-direction"> <view class=" flex flex-direction">
<button style="height: 45px;" class="cu-btn bg-white margin-tb-sm lg text-red text-bold">退出登录</button> <button @click="logout" style="height: 45px;"
class="cu-btn bg-white margin-tb-sm lg text-red text-bold">退出登录</button>
</view> </view>
</view> </view>
</view> </view>
@ -78,6 +79,32 @@
link: '/pages/user/login/userLogout' link: '/pages/user/login/userLogout'
} }
]); ]);
// 退
const logout = () => {
uni.showModal({
title: '退出登录',
content: '是否确认退出并清除缓存?',
success: function(res) {
if (res.confirm) {
//
uni.clearStorage("wechat_user");
//
uni.showToast({
title: '退出成功', //
icon: 'success', //
duration: 2000 //
});
} else if (res.cancel) {
// 退
console.log('用户取消退出');
}
}
});
}
const navigateTo = (link) => { const navigateTo = (link) => {