唯一码图形对接以及退出登录

This commit is contained in:
zx
2026-03-24 11:38:41 +08:00
parent b648176e82
commit dde27ed688
12 changed files with 310 additions and 41 deletions

View File

@@ -5,8 +5,7 @@
<uv-image src="../../static/avatar.png" width="120rpx" height="120rpx" shape="circle" />
<view class="right">
<h3 class="nickName">{{ userInfo?.nickName }}</h3>
<!-- todo 这里仓库信息暂时没有 所以写死 -->
<p class="tag">电网仓储公司</p>
<p class="tag">{{ userInfo?.dept.deptName }}</p>
</view>
</view>
@@ -17,13 +16,26 @@
thumb-size="sm" link @click="item.click" clickable />
</uni-list>
</view>
<uni-popup ref="popupRef" type="center" background-color="#fff" borderRadius="8px">
<view class="popup-wrap" style="width: 400rpx; ">
<view class="popup-body">
<p>确定退出登录吗</p>
<view class="popup-btn">
<uv-button type="primary" @click="toLogout" text="确定"></uv-button>
<uv-button @click="close" type="info " text="取消"></uv-button>
</view>
</view>
</view>
</uni-popup>
</view>
</template>
<script setup>
import { ref } from "vue";
import { logout } from "@/api/login"
const userInfo = ref(null)
const popupRef = ref()
const menuList = [
{
id: 1,
@@ -47,10 +59,25 @@ const menuList = [
thumb: '../../static/exit.svg',
click: () => {
console.log('退出登录')
popupRef.value.open()
}
}
]
// 退出登录
const toLogout = () => {
logout().then((res) => {
uni.removeStorage('app_user')
uni.removeStorage('app_roles')
uni.removeStorage('app_permissions')
uni.navigateTo({
url: '/pages/login/login'
});
})
}
// 弹窗:关闭登录二次确认弹窗
const close = () => {
popupRef.value.close()
}
// 获取缓存内的用户信息
const getUserInfo = () => {
uni.getStorage({
@@ -85,4 +112,25 @@ getUserInfo();
background-color: #4682B4;
}
}
.popup-wrap {
padding: 24rpx;
border-radius: 8px;
}
.popup-body{
p{
font-size: 14px;
font-weight: 500;
}
}
.popup-btn {
margin-top: 20px;
display: flex;
justify-content: space-between;
.uv-button-wrapper{
width: 48%;
margin-left: 8rpx;
}
}
</style>