退出 #81

Merged
lyc merged 1 commits from lyc-dev into main 2024-07-29 16:06:43 +08:00
2 changed files with 17 additions and 2 deletions

View File

@ -9,6 +9,10 @@
<script setup> <script setup>
import { ref } from 'vue' import { ref } from 'vue'
import { ElMessageBox } from 'element-plus'
import useUserStore from '@/store/modules/user'
const userStore = useUserStore()
const { ipcRenderer } = window.electron || {} const { ipcRenderer } = window.electron || {}
const props = defineProps({ const props = defineProps({
@ -30,7 +34,18 @@ const maximizeWindow = () => {
} }
// //
const closeWindow = () => { const closeWindow = () => {
ipcRenderer?.send('close-window') ElMessageBox.confirm('确认退出系统吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
userStore.logOut().then(() => {
ipcRenderer && ipcRenderer.send('close-window')
}).catch(()=>{
ipcRenderer && ipcRenderer.send('close-window')
})
}).catch(() => { });
} }
</script> </script>

View File

@ -95,7 +95,7 @@ function handleCommand(command) {
} }
function logout() { function logout() {
ElMessageBox.confirm('确认退出系统', '提示', { ElMessageBox.confirm('确认退出系统吗?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'