| | |
| | | // const { $i18n } = useI18n(); // 获取 i18n 实例 |
| | | const router = useRouter() |
| | | const userStore = useUserInfoStore() |
| | | const user = userStore.user.userName |
| | | // const user = userStore.user.userName |
| | | |
| | | let userInfoStr = window.localStorage.getItem('userInfo') |
| | | console.log(userInfoStr); |
| | |
| | | let token = userInfo; // 提取 token |
| | | // 退出登录方法 |
| | | function quit() { |
| | | // removeToken() |
| | | // localStorage.removeItem('token'); |
| | | store.$patch({ |
| | | user: null, |
| | | }) |
| | | router.push('/login') |
| | | } |
| | | // const quit = async () => { |
| | | // try { |
| | | |
| | | // const response = await request.get('/loadGlass/sys/user/logout', { |
| | | // token: token, |
| | | // user: null, |
| | | // }) |
| | | // store.$patch({user: null}) |
| | | // const response = await request.post('/loadGlass/sys/user/logout') |
| | | // if (response.code === 200) { |
| | | // // 登出成功,清除本地存储的 userInfo |
| | | // localStorage.removeItem('userInfo'); |
| | | // // 可以在这里重置应用状态,如导航到登录页等 |
| | | // console.log('登出成功'); |
| | | // } else { |
| | | // // 处理错误情况 |
| | |
| | | <img src="../assets/northGlass.ico" |
| | | alt="" |
| | | style="max-width: 100%;max-height: 100%"> |
| | | <h3 style="margin: 1rem ;font-weight: bold;width: 33vw;"> {{ $t('main.titleFirst') }}{{ user }}{{ $t('main.titleLast') }}</h3> |
| | | <h3 style="margin: 1rem ;font-weight: bold;width: 33vw;"> {{ $t('main.titleFirst') }}{{ userName }}{{ $t('main.titleLast') }}</h3> |
| | | <!-- <div class="header-left"> |
| | | <el-button :icon="isCollapse ? 'el-icon-s-unfold' : 'el-icon-s-fold'" @click="toggleCollapse" |
| | | style="height:30px;"></el-button> |
| | | </div> --> |
| | | <span style="height: 70%;width: 78vw;margin-top: 1rem;"> |
| | | <!-- <el-button class="sys-quit" |
| | | @click="quit" |