用户端 退出登录清楚缓存
This commit is contained in:
parent
9ced4484e0
commit
3a8ae57959
@ -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>
|
||||||
@ -34,7 +35,7 @@
|
|||||||
} from 'vue';
|
} from 'vue';
|
||||||
import config from '@/utils/config';
|
import config from '@/utils/config';
|
||||||
const imgPath = config.imgPath;
|
const imgPath = config.imgPath;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const menuItems = ref([{
|
const menuItems = ref([{
|
||||||
@ -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) => {
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user