feat: 登录后是否自动跳转至首页的配置项

This commit is contained in:
xiaozzzi 2024-02-06 22:43:22 +08:00
parent e071100dd5
commit cbd0343dd5
4 changed files with 15 additions and 2 deletions

View File

@ -30,6 +30,8 @@ export interface ViewStyle {
isShowTryuseBtn: boolean
// 只展开一项子菜单
isMenuUniqueOpened: boolean
// 点击登录后自动进入首页
isLoginToHomePage: boolean
}
/**
@ -109,7 +111,8 @@ export const useConfigStore = defineStore('configStore', {
isWebCollectCard: true,
isGlobalShadow: false,
isShowTryuseBtn: true,
isMenuUniqueOpened: true
isMenuUniqueOpened: true,
isLoginToHomePage: false
},
...Local.get(VIEW_STYLE_KEY)
},

View File

@ -78,6 +78,12 @@
<el-form label-position="right" label-width="130px" style="max-width: 800px">
<bl-row just="flex-start" class="config-module-titile"><span class="iconbl bl-apps-line"></span>其他</bl-row>
<el-form-item label="登录后进入首页">
<bl-row>
<el-switch v-model="configViewStyleForm.isLoginToHomePage" size="default" style="margin-right: 10px" @change="changeViewStyle" />
</bl-row>
<div class="conf-tip">点击登录按钮后是否自动跳转至首页</div>
</el-form-item>
<el-form-item label="开发者工具">
<bl-row>
<el-button @click="openDevTools"><span class="iconbl bl-bug-line" @click="openDevTools"></span></el-button>

View File

@ -78,6 +78,7 @@
</template>
<script setup lang="ts">
import router from '@renderer/router'
import { computed, nextTick, onMounted, ref } from 'vue'
import { storeToRefs } from 'pinia'
import { useDark } from '@vueuse/core'
@ -116,6 +117,9 @@ const login = async () => {
}
logingIn.value = true
await userStore.loginByPassword(formLogin.value.username, formLogin.value.password)
if (configStore.viewStyle.isLoginToHomePage) {
router.push('/home')
}
logingIn.value = false
}

View File

@ -11,7 +11,7 @@
.el-form {
max-width: 800px;
margin-bottom: 100px;
margin-bottom: 50px;
:deep(.el-form-item__label) {
padding-top: 5px;
}