Merge pull request #63 from Jursin/master

添加自动进入看板选项
This commit is contained in:
Jursin 2024-12-13 20:06:34 +08:00 committed by GitHub
commit c2c87f2c99
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 31 additions and 5 deletions

View File

@ -4,7 +4,7 @@
<template #append>
<div class="ga-4">
<v-btn @click="router.push('/mainWindow')">回到主页</v-btn>
<v-btn @click="gotoHome">回到主页</v-btn>
<v-btn @click="router.push('/about')">关于</v-btn>
<v-icon icon="mdi-window-close" @click="ipcHandleExit"></v-icon>
</div>
@ -20,4 +20,8 @@ const profileStore = useProfileStore();
const router = useRouter();
const ipcHandleExit = () => window.electron.ipcRenderer.send('prog:exit');
function gotoHome() {
router.push({ path: '/mainWindow', query: { skipAutoEnter: true } });
}
</script>

View File

@ -20,6 +20,11 @@
>直接进入看板</v-btn
>
<p class="mt-2 text-center">直接进入看板将继续使用上次加载的配置</p>
<v-switch
v-model="autoEnter"
label="下次自动进入看板"
class="mt-2 auto-enter-switch"
></v-switch>
</v-card>
</v-col>
</v-row>
@ -36,13 +41,15 @@
</template>
<script setup>
import { ref, onMounted } from 'vue';
import { useRouter } from 'vue-router';
import { ref, onMounted, watch } from 'vue';
import { useRouter, useRoute } from 'vue-router';
import { useProfileStore } from '@renderer/stores/app';
const globalStore = useProfileStore();
const router = useRouter();
const route = useRoute();
const remoteUrl = ref(localStorage.getItem('remoteUrl') || '');
const autoEnter = ref(JSON.parse(localStorage.getItem('autoEnter') || 'false'));
const errorDialog = ref(false);
const errorMessage = ref('');
@ -91,6 +98,16 @@ onMounted(() => {
if (savedUrl) {
remoteUrl.value = savedUrl;
}
//
const skipAutoEnter = route.query.skipAutoEnter === 'true';
if (!skipAutoEnter && autoEnter.value) {
router.push('/infoPage');
}
});
watch(autoEnter, (newVal) => {
localStorage.setItem('autoEnter', JSON.stringify(newVal));
});
</script>
@ -115,6 +132,11 @@ onMounted(() => {
.text-center {
text-align: center;
}
.auto-enter-switch {
margin-top: 8px;
display: flex;
justify-content: center;
}
.fade-in {
animation: fadeIn 1s ease-in-out;
}