添加登出

This commit is contained in:
dong 2023-07-25 15:50:02 +08:00
parent 9bc7f9870d
commit c7f5bf8871

View File

@ -31,6 +31,26 @@
v-if="$q.screen.gt.sm"
>
</q-btn>
<q-btn-dropdown
flat
stretch
icon="person"
v-show="!route.path.includes('line/monitor/')"
>
<q-list>
<!-- <q-item clickable v-close-popup @click="showUserInfo">
<q-item-section>
<q-item-label>用户信息</q-item-label>
</q-item-section>
</q-item> -->
<q-item clickable v-close-popup @click="logOut">
<q-item-section>
<q-item-label>登出</q-item-label>
</q-item-section>
</q-item>
</q-list>
</q-btn-dropdown>
</div>
</q-toolbar>
</q-header>
@ -52,6 +72,8 @@
import { ref, reactive } from 'vue';
import SysMenu from 'src/components/SysMenu.vue';
import { useRouter, useRoute } from 'vue-router';
import { Dialog } from 'quasar';
import { clearJwtToken } from 'src/configs/TokenManage';
const leftDrawerOpen = ref(false);
const router = useRouter();
@ -81,4 +103,16 @@ function onLeftResize(size: { width: number; height: number }) {
leftDrawerSize.width = size.width;
leftDrawerSize.height = size.height;
}
function logOut() {
Dialog.create({
title: '登出确认',
message: '确认是否登出?',
cancel: true,
persistent: true,
}).onOk(() => {
clearJwtToken();
router.push({ name: 'login' });
});
}
</script>