增加退出登录

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>
@@ -31,7 +40,7 @@
<script>
import moment from 'moment'; // 引入moment
import {getPath} from "@/utils/ruoyi";
export default {
name: 'Header',
props: {
@@ -100,6 +109,18 @@ export default {
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');
})
},
/**
* 计算时间范围(时间戳格式)
* 固定为月维度当月1日00:00:00 → 当月最后一天23:59:59
@@ -297,6 +318,7 @@ export default {
margin-top: 12px;
margin-right: 10px;
gap: 21px;
height: 35px;
}
.screen-btn {
@@ -305,6 +327,7 @@ export default {
color: #00fff0;
font-size: 26px;
padding: 0;
margin: 0;
}
.home-btn {
@@ -322,6 +345,14 @@ export default {
font-size: 26px;
padding: 0;
}
.logout-btn {
width: 28px;
height: 28px;
font-size: 28px;
padding: 0;
}
}
/* 日期选择器自定义样式 */