feat(mobile-h5): add logout on workbench for login demo loop
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
4420fb570e
commit
c7794f714b
2 files changed
+30
-2
No files matched your search
@@ -1,7 +1,10 @@
|
||||
<template>
|
||||
<view class="page-shell">
|
||||
<view class="home-header">
|
||||
<view class="brand">中科兴皖 · 移动工作台</view>
|
||||
<view class="home-header__top">
|
||||
<view class="brand">中科兴皖 · 移动工作台</view>
|
||||
<text class="home-logout" @click="onLogout">退出</text>
|
||||
</view>
|
||||
<view class="hello">你好,{{ userName }}</view>
|
||||
<view class="meta">
|
||||
<text>{{ roleName }}</text>
|
||||
@@ -42,6 +45,7 @@
|
||||
filterMenusByPermission,
|
||||
DEFAULT_GRANTED_IDS
|
||||
} from '../../utils/menu-mock.js'
|
||||
import { clearSession, getUser } from '../../utils/auth-mock.js'
|
||||
|
||||
export default {
|
||||
components: { MenuGrid, TodoPanel },
|
||||
@@ -86,6 +90,12 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
const user = getUser()
|
||||
if (user && user.displayName) {
|
||||
this.userName = user.displayName
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onMenuSelect(m) {
|
||||
if (m.path) {
|
||||
@@ -94,6 +104,10 @@
|
||||
},
|
||||
goList() {
|
||||
uni.navigateTo({ url: '/pages/demo/list' })
|
||||
},
|
||||
onLogout() {
|
||||
clearSession()
|
||||
uni.reLaunch({ url: '/pages/login/index' })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,11 +47,25 @@
|
||||
padding: 108rpx 32rpx 56rpx;
|
||||
}
|
||||
|
||||
.home-header__top {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16rpx;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.home-header .brand {
|
||||
font-size: 24rpx;
|
||||
opacity: 0.88;
|
||||
letter-spacing: 0.04em;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.home-logout {
|
||||
font-size: 26rpx;
|
||||
color: rgba(255, 255, 255, 0.92);
|
||||
padding: 8rpx 4rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.home-header .hello {
|
||||
|
||||
Reference in new issue
Block a user