增加退出登录

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

@@ -8,6 +8,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="screen-btn" @click="changeHomeSider">
<svg-icon style="color: #0B58FF;" v-if="openSider" icon-class="closeSider" />
<svg-icon style="color: #0B58FF;" v-else icon-class="openSider" />
@@ -36,6 +45,7 @@
<script>
import moment from 'moment'
import {getPath} from "@/utils/ruoyi";
export default {
name: 'Header',
props: {
@@ -139,6 +149,19 @@ export default {
const timeRange = this.calculateTimeRange();
this.$emit('timeRangeChange', timeRange);
console.log('触发时间范围变化:', timeRange);
},
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');
})
}
},
watch: {
@@ -325,10 +348,11 @@ export default {
.right-content {
display: flex;
margin-bottom: 60px;
margin-top: 12px;
margin-right: 16px;
justify-content: flex-end;
gap: 10px;
gap: 21px;
height: 35px;
}
.current-time {
@@ -345,6 +369,15 @@ export default {
color: #00fff0;
font-size: 26px;
padding: 0;
margin: 0;
}
.logout-btn {
width: 30px;
height: 30px;
font-size: 30px;
padding: 0;
margin-top: 2px;
}
}

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;
}
}
/* 自定义下拉框样式(替换原有日期选择器样式) */

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;
}
}
/* 日期选择器自定义样式 */