1
0
mirror of https://github.com/zclzone/vue-naive-admin.git synced 2025-05-01 14:49:00 +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 { useAuthStore } from '@/store'
import api from '@/api' import api from '@/api'
const WHITE_LIST = ['/login', '/404', '/role-select'] const WHITE_LIST = ['/login', '/404']
export function createPermissionGuard(router) { export function createPermissionGuard(router) {
router.beforeEach(async (to) => { router.beforeEach(async (to) => {
const authStore = useAuthStore() const authStore = useAuthStore()

View File

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

View File

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