用户端 退出登录清楚缓存

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

View File

@ -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) => {