|
|
|
@ -49,8 +49,31 @@ |
|
|
|
<el-icon style="bottom: -3px; "><SwitchButton /></el-icon> |
|
|
|
退出登录 |
|
|
|
</div> |
|
|
|
<div class="sidebar-set" @click="handleSet"> |
|
|
|
<el-icon style="bottom: -3px; "><Setting /></el-icon> |
|
|
|
设置 |
|
|
|
</div> |
|
|
|
</el-aside> |
|
|
|
|
|
|
|
<!-- 首页刷新时间弹窗 --> |
|
|
|
<el-dialog v-model="setValue" title="首页刷新时间" width="500"> |
|
|
|
<div class="refresh-time-container"> |
|
|
|
<el-form-item label="刷新时间" style="margin-top: 50px;"> |
|
|
|
<el-input-number v-model="refreshTime" :step="1" placeholder="请输入刷新时间" style="width: 200px"> |
|
|
|
<template #suffix> |
|
|
|
<span>s</span> |
|
|
|
</template> |
|
|
|
</el-input-number> |
|
|
|
</el-form-item> |
|
|
|
</div> |
|
|
|
<template #footer> |
|
|
|
<div class="dialog-footer"> |
|
|
|
<el-button @click="setValue = false">取消</el-button> |
|
|
|
<el-button type="danger" @click="setEnv">确认修改</el-button> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
<!-- 主页面 --> |
|
|
|
<el-main class="main-content"> |
|
|
|
<router-view /> |
|
|
|
@ -62,6 +85,7 @@ |
|
|
|
import { computed, ref, watch } from 'vue' |
|
|
|
import { useRouter, useRoute } from 'vue-router' |
|
|
|
import { ElMessage } from 'element-plus'; |
|
|
|
import { getEnvApi, setEnvApi} from '../api/userPermissions' |
|
|
|
|
|
|
|
const router = useRouter() |
|
|
|
const route = useRoute() |
|
|
|
@ -130,6 +154,42 @@ const handleLogout = () => { |
|
|
|
ElMessage.error('退出登录失败,请重试'); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
// token |
|
|
|
const token = localStorage.getItem('token') |
|
|
|
|
|
|
|
// 设置弹窗开关 |
|
|
|
const setValue = ref(false) |
|
|
|
|
|
|
|
// 首页刷新时间 |
|
|
|
const refreshTime = ref('') |
|
|
|
|
|
|
|
// 设置按钮 |
|
|
|
const handleSet = async() => { |
|
|
|
const data = await getEnvApi({ |
|
|
|
token: token, |
|
|
|
key: 'SYNC_INTERVAL' |
|
|
|
}) |
|
|
|
refreshTime.value = data; |
|
|
|
|
|
|
|
setValue.value = true; |
|
|
|
}; |
|
|
|
|
|
|
|
// 修改刷新时间 |
|
|
|
const setEnv = async() => { |
|
|
|
try{ |
|
|
|
await setEnvApi({ |
|
|
|
token: token, |
|
|
|
key: 'SYNC_INTERVAL', |
|
|
|
value: refreshTime.value |
|
|
|
}) |
|
|
|
ElMessage.success('修改成功'); |
|
|
|
setValue.value = false; |
|
|
|
} catch (error) { |
|
|
|
ElMessage.error('修改失败'); |
|
|
|
setValue.value = false; |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
|
<style scoped> |
|
|
|
@ -277,7 +337,7 @@ const handleLogout = () => { |
|
|
|
.sidebar-logout { |
|
|
|
position: absolute; |
|
|
|
bottom: 30px; |
|
|
|
left: 30%; |
|
|
|
left: 10%; |
|
|
|
|
|
|
|
color: #1f0303; |
|
|
|
font-family: "PingFang SC", sans-serif; |
|
|
|
@ -295,4 +355,27 @@ const handleLogout = () => { |
|
|
|
.sidebar-logout:hover { |
|
|
|
color: #FF0000; |
|
|
|
} |
|
|
|
|
|
|
|
/* 设置 */ |
|
|
|
.sidebar-set { |
|
|
|
position: absolute; |
|
|
|
bottom: 30px; |
|
|
|
left: 60%; |
|
|
|
|
|
|
|
color: #1f0303; |
|
|
|
font-family: "PingFang SC", sans-serif; |
|
|
|
font-size: 21.06px; |
|
|
|
font-style: normal; |
|
|
|
font-weight: 700; |
|
|
|
line-height: 33.1px; |
|
|
|
|
|
|
|
cursor: pointer; |
|
|
|
user-select: none; |
|
|
|
transition: color 0.2s ease; |
|
|
|
} |
|
|
|
|
|
|
|
/* 设置hover效果 */ |
|
|
|
.sidebar-set:hover { |
|
|
|
color: #FF0000; |
|
|
|
} |
|
|
|
</style> |