增加退出登录

This commit is contained in:
2026-03-05 16:09:07 +08:00
parent 2f3586e2f2
commit 9f2f7036fd
6 changed files with 112 additions and 7 deletions

View File

@@ -7,6 +7,15 @@
<!-- 右侧区域全屏按钮 -->
<div class="right-content">
<el-dropdown trigger="click">
<el-button type="text" class="logout-btn" :title="'退出'">
<svg-icon style="color: #0B58FF;" icon-class="logout" />
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native='logout'>退出登录</el-dropdown-item>
<el-dropdown-item @click.native='handleToggle'>切换账号</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-button type="text" class="return-btn" :title="'返回'" @click="handleReturn">
<svg-icon style="color: #0B58FF;" icon-class="returnIcon" />
</el-button>
@@ -35,7 +44,7 @@
<script>
import moment from 'moment'; // 引入moment
import {getPath} from "@/utils/ruoyi";
export default {
name: 'Header',
props: {
@@ -75,6 +84,18 @@ export default {
handleReturn() {
this.$router.go(-1);
},
async logout() {
this.$modal.confirm('确定注销并退出系统吗?', '提示').then(() => {
this.$store.dispatch('LogOut').then(() => {
location.href = getPath('/index');
})
}).catch(() => {});
},
handleToggle() {
this.$store.dispatch('LogOut').then(() => {
location.href = getPath('/index');
})
},
exportPDF() {
this.$emit('exportPDF');
},
@@ -300,6 +321,7 @@ export default {
margin-top: 12px;
margin-right: 10px;
gap: 21px;
height: 35px;
}
// .current-time {
@@ -326,6 +348,7 @@ export default {
color: #00fff0;
font-size: 26px;
padding: 0;
margin: 0;
}
.return-btn {
@@ -336,6 +359,13 @@ export default {
font-size: 26px;
padding: 0;
}
.logout-btn {
width: 28px;
height: 28px;
font-size: 28px;
padding: 0;
}
}
/* 自定义下拉框样式(替换原有日期选择器样式) */