1
0
mirror of https://github.com/zclzone/vue-naive-admin.git synced 2025-05-01 06:39:01 +08:00

fix: 移除跳转role-select页面逻辑

This commit is contained in:
zclzone 2024-01-25 15:53:35 +08:00
parent 2c9604a829
commit f888c2fbfd
3 changed files with 8 additions and 20 deletions

View File

@ -9,7 +9,7 @@
import { useAuthStore } from '@/store'
import api from '@/api'
const WHITE_LIST = ['/login', '/404', '/role-select']
const WHITE_LIST = ['/login', '/404']
export function createPermissionGuard(router) {
router.beforeEach(async (to) => {
const authStore = useAuthStore()

View File

@ -8,7 +8,7 @@
import { useTabStore } from '@/store'
export const EXCLUDE_TAB = ['/404', '/403', '/login', '/role-select']
export const EXCLUDE_TAB = ['/404', '/403', '/login']
export function createTabGuard(router) {
router.afterEach((to) => {

View File

@ -104,42 +104,30 @@
import { throttle, lStorage } from '@/utils'
import { useStorage } from '@vueuse/core'
import api from './api'
import { useUserStore, useAuthStore } from '@/store'
import { useAuthStore } from '@/store'
import { initUserAndPermissions } from '@/router'
const userStore = useUserStore()
const authStore = useAuthStore()
const router = useRouter()
const route = useRoute()
const title = import.meta.env.VITE_TITLE
const isLogined = computed(() => {
return authStore.accessToken && userStore.roles
})
const loginInfo = ref({
username: '',
password: '',
})
function initLoginInfo() {
const localLoginInfo = lStorage.get('loginInfo')
if (localLoginInfo) {
loginInfo.value.username = localLoginInfo.username || ''
loginInfo.value.password = localLoginInfo.password || ''
}
}
const captchaUrl = ref('')
const initCaptcha = throttle(() => {
captchaUrl.value = '/api/auth/captcha?' + Date.now()
}, 500)
if (isLogined.value) {
router.push({ path: '/role-select', query: route.query })
} else {
initLoginInfo()
initCaptcha()
const localLoginInfo = lStorage.get('loginInfo')
if (localLoginInfo) {
loginInfo.value.username = localLoginInfo.username || ''
loginInfo.value.password = localLoginInfo.password || ''
}
initCaptcha()
function quickLogin() {
loginInfo.value.username = 'admin'