Merge branch 'main' of http://114.215.207.150:3000/qiushanhe/ss-manage-web into dev-cl
This commit is contained in:
@@ -218,7 +218,7 @@ service.interceptors.response.use(
|
|||||||
resetRouter() // 重置静态路由表
|
resetRouter() // 重置静态路由表
|
||||||
cache.local.clear()
|
cache.local.clear()
|
||||||
removeToken()
|
removeToken()
|
||||||
window.location.href = `/login`
|
window.location.href = `/ss/login`
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -266,7 +266,7 @@ const handleAuthorized = () => {
|
|||||||
isRelogin.show = false
|
isRelogin.show = false
|
||||||
// 干掉token后再走一次路由让它过router.beforeEach的校验
|
// 干掉token后再走一次路由让它过router.beforeEach的校验
|
||||||
// window.location.href = window.location.href
|
// window.location.href = window.location.href
|
||||||
window.location.href = `/login`
|
window.location.href = `/ss/login`
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return Promise.reject(t('sys.api.timeoutMessage'))
|
return Promise.reject(t('sys.api.timeoutMessage'))
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
import router from './router'
|
import router from './router'
|
||||||
import { isRelogin } from '@/config/axios/service'
|
import { isRelogin } from '@/config/axios/service'
|
||||||
import { getAccessToken, removeToken } from '@/utils/auth'
|
import { getAccessToken } from '@/utils/auth'
|
||||||
import { useTitle } from '@/hooks/web/useTitle'
|
import { useTitle } from '@/hooks/web/useTitle'
|
||||||
import { useNProgress } from '@/hooks/web/useNProgress'
|
import { useNProgress } from '@/hooks/web/useNProgress'
|
||||||
import { usePageLoading } from '@/hooks/web/usePageLoading'
|
import { usePageLoading } from '@/hooks/web/usePageLoading'
|
||||||
import { useDictStoreWithOut } from '@/store/modules/dict'
|
import { useDictStoreWithOut } from '@/store/modules/dict'
|
||||||
import { useUserStoreWithOut } from '@/store/modules/user'
|
import { useUserStoreWithOut } from '@/store/modules/user'
|
||||||
import { usePermissionStoreWithOut } from '@/store/modules/permission'
|
import { usePermissionStoreWithOut } from '@/store/modules/permission'
|
||||||
import { getAppId } from '@/utils/auth'
|
|
||||||
import cache from '@/plugins/cache'
|
|
||||||
|
|
||||||
const { start, done } = useNProgress()
|
const { start, done } = useNProgress()
|
||||||
|
|
||||||
@@ -20,21 +18,17 @@ const whiteList = ['/login', '/social-login', '/auth-redirect', '/bind', '/regis
|
|||||||
router.beforeEach(async (to, from, next) => {
|
router.beforeEach(async (to, from, next) => {
|
||||||
start()
|
start()
|
||||||
loadStart()
|
loadStart()
|
||||||
if (getAppId() && to.query?.appId && getAppId() != to.query?.appId) {
|
const userStore = useUserStoreWithOut()
|
||||||
removeToken()
|
if (to.path == '/login') {
|
||||||
cache?.local?.delete('appInfo')
|
userStore.resetState() // 重置用户信息状态
|
||||||
cache?.local?.delete('roleRouters')
|
}
|
||||||
cache?.local?.delete('user')
|
|
||||||
cache?.local?.delete('App_ID')
|
|
||||||
next(`/login`)
|
|
||||||
} else {
|
|
||||||
if (getAccessToken()) {
|
if (getAccessToken()) {
|
||||||
if (to.path === '/login') {
|
if (to.path === '/login') {
|
||||||
next({ path: '/' })
|
next({ path: '/' })
|
||||||
} else {
|
} else {
|
||||||
// 获取所有字典
|
// 获取所有字典
|
||||||
const dictStore = useDictStoreWithOut()
|
const dictStore = useDictStoreWithOut()
|
||||||
const userStore = useUserStoreWithOut()
|
|
||||||
const permissionStore = usePermissionStoreWithOut()
|
const permissionStore = usePermissionStoreWithOut()
|
||||||
if (!dictStore.getIsSetDict) {
|
if (!dictStore.getIsSetDict) {
|
||||||
await dictStore.setDictMap()
|
await dictStore.setDictMap()
|
||||||
@@ -69,7 +63,6 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
router.afterEach((to) => {
|
router.afterEach((to) => {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { defineStore } from 'pinia'
|
|||||||
import { getAccessToken, removeToken } from '@/utils/auth'
|
import { getAccessToken, removeToken } from '@/utils/auth'
|
||||||
import { CACHE_KEY } from '@/hooks/web/useCache'
|
import { CACHE_KEY } from '@/hooks/web/useCache'
|
||||||
import { loginOut } from '@/api/login'
|
import { loginOut } from '@/api/login'
|
||||||
import { getUser as getUserInfo } from '@/api/system/user'
|
import { getUserProfile as getUserInfo } from '@/api/system/user/profile'
|
||||||
|
|
||||||
import cache from '@/plugins/cache'
|
import cache from '@/plugins/cache'
|
||||||
|
|
||||||
@@ -55,9 +55,8 @@ export const useUserStore = defineStore('admin-user', {
|
|||||||
// userInfo = await getInfo({})
|
// userInfo = await getInfo({})
|
||||||
// }
|
// }
|
||||||
if (!userInfo?.user) {
|
if (!userInfo?.user) {
|
||||||
const userId = localStorage.getItem('userId')
|
|
||||||
userInfo = {
|
userInfo = {
|
||||||
user: await getUserInfo(Number(userId))
|
user: await getUserInfo()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// this.permissions = userInfo.permissions
|
// this.permissions = userInfo.permissions
|
||||||
@@ -82,6 +81,7 @@ export const useUserStore = defineStore('admin-user', {
|
|||||||
avatar: '',
|
avatar: '',
|
||||||
nickname: ''
|
nickname: ''
|
||||||
}
|
}
|
||||||
|
cache.local.delete(CACHE_KEY.USER)
|
||||||
},
|
},
|
||||||
refresh() {
|
refresh() {
|
||||||
cache.local.delete(CACHE_KEY.USER)
|
cache.local.delete(CACHE_KEY.USER)
|
||||||
|
|||||||
@@ -10,12 +10,17 @@
|
|||||||
@click="handleAppClick(item)"
|
@click="handleAppClick(item)"
|
||||||
>
|
>
|
||||||
<!-- card body -->
|
<!-- card body -->
|
||||||
|
<div
|
||||||
|
class="inline-flex align-center justify-center"
|
||||||
|
style="width: 180px; height: 180px; border-radius: 10px; background-color: #fff"
|
||||||
|
>
|
||||||
<el-image
|
<el-image
|
||||||
:src="item.clientLogo"
|
:src="item.clientLogo"
|
||||||
fit="fill"
|
fit="contain"
|
||||||
:lazy="true"
|
:lazy="true"
|
||||||
style="width: 180px; height: 180px; border-radius: 10px; background-color: #fff"
|
style="width: 100%; height: auto"
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
<div class="cutout-text">{{ item.clientName }}</div>
|
<div class="cutout-text">{{ item.clientName }}</div>
|
||||||
|
|
||||||
<template #footer v-if="item.clientDescription">
|
<template #footer v-if="item.clientDescription">
|
||||||
|
|||||||
@@ -200,8 +200,6 @@ const handleLogin = async (params) => {
|
|||||||
if (res?.tenantId) {
|
if (res?.tenantId) {
|
||||||
authUtil.setTenantId(res.tenantId)
|
authUtil.setTenantId(res.tenantId)
|
||||||
}
|
}
|
||||||
// 设置userId
|
|
||||||
localStorage.setItem('userId', res.userId)
|
|
||||||
|
|
||||||
ElLoading.service({
|
ElLoading.service({
|
||||||
lock: true,
|
lock: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user