sc
This commit is contained in:
6
src/api/platform/index.js
Normal file
6
src/api/platform/index.js
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import request from '@/config/axios'
|
||||||
|
|
||||||
|
// 查询应用列表
|
||||||
|
export const getAppList = (params) => {
|
||||||
|
return request.get({ url: '/admin-api/system/auth/get-user-client', params })
|
||||||
|
}
|
||||||
@@ -213,12 +213,12 @@ service.interceptors.response.use(
|
|||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
// 无访问权限,退出登录
|
// 无访问权限,退出登录
|
||||||
const tenantId = cache.local.get('TENANT_ID')
|
// const tenantId = cache.local.get('TENANT_ID')
|
||||||
const appId = cache.local.get('App_ID')
|
// const appId = cache.local.get('App_ID')
|
||||||
resetRouter() // 重置静态路由表
|
resetRouter() // 重置静态路由表
|
||||||
cache.local.clear()
|
cache.local.clear()
|
||||||
removeToken()
|
removeToken()
|
||||||
window.location.href = `/login?tenantId=${tenantId}&appId=${appId}`
|
window.location.href = `/login`
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -258,15 +258,15 @@ const handleAuthorized = () => {
|
|||||||
confirmButtonText: t('login.relogin'),
|
confirmButtonText: t('login.relogin'),
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
const tenantId = cache.local.get('TENANT_ID')
|
// const tenantId = cache.local.get('TENANT_ID')
|
||||||
const appId = cache.local.get('App_ID')
|
// const appId = cache.local.get('App_ID')
|
||||||
resetRouter() // 重置静态路由表
|
resetRouter() // 重置静态路由表
|
||||||
cache.local.clear()
|
cache.local.clear()
|
||||||
removeToken()
|
removeToken()
|
||||||
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?tenantId=${tenantId}&appId=${appId}`
|
window.location.href = `/login`
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return Promise.reject(t('sys.api.timeoutMessage'))
|
return Promise.reject(t('sys.api.timeoutMessage'))
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { useDesign } from '@/hooks/web/useDesign'
|
|||||||
import avatarImg from '@/assets/imgs/avatar.gif'
|
import avatarImg from '@/assets/imgs/avatar.gif'
|
||||||
import { useUserStore } from '@/store/modules/user'
|
import { useUserStore } from '@/store/modules/user'
|
||||||
import { useTagsViewStore } from '@/store/modules/tagsView'
|
import { useTagsViewStore } from '@/store/modules/tagsView'
|
||||||
import { getTenantId, getAppId } from '@/utils/auth'
|
// import { getTenantId, getAppId } from '@/utils/auth'
|
||||||
|
|
||||||
import { Setting } from '@/layout/components/Setting'
|
import { Setting } from '@/layout/components/Setting'
|
||||||
import cache from '@/plugins/cache'
|
import cache from '@/plugins/cache'
|
||||||
@@ -36,11 +36,11 @@ const loginOut = () => {
|
|||||||
type: 'warning'
|
type: 'warning'
|
||||||
})
|
})
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
const tenantId = getTenantId()
|
// const tenantId = getTenantId()
|
||||||
const appId = getAppId()
|
// const appId = getAppId()
|
||||||
await userStore.loginOut()
|
await userStore.loginOut()
|
||||||
tagsViewStore.delAllViews()
|
tagsViewStore.delAllViews()
|
||||||
replace(`/login?tenantId=${tenantId}&appId=${appId}`)
|
replace(`/login`)
|
||||||
})
|
})
|
||||||
.catch(() => {})
|
.catch(() => {})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ 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 { getTenantId, getAppId } from '@/utils/auth'
|
import { getAppId } from '@/utils/auth'
|
||||||
import cache from '@/plugins/cache'
|
import cache from '@/plugins/cache'
|
||||||
|
|
||||||
const { start, done } = useNProgress()
|
const { start, done } = useNProgress()
|
||||||
@@ -26,7 +26,7 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
cache?.local?.delete('roleRouters')
|
cache?.local?.delete('roleRouters')
|
||||||
cache?.local?.delete('user')
|
cache?.local?.delete('user')
|
||||||
cache?.local?.delete('App_ID')
|
cache?.local?.delete('App_ID')
|
||||||
next(`/login?tenantId=${to.query?.tenantId}&appId=${to.query?.appId}`)
|
next(`/login`)
|
||||||
} else {
|
} else {
|
||||||
if (getAccessToken()) {
|
if (getAccessToken()) {
|
||||||
if (to.path === '/login') {
|
if (to.path === '/login') {
|
||||||
@@ -60,13 +60,13 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
if (whiteList.indexOf(to.path) !== -1) {
|
if (whiteList.indexOf(to.path) !== -1) {
|
||||||
next()
|
next()
|
||||||
} else {
|
} else {
|
||||||
const tenantId = getTenantId()
|
// const tenantId = getTenantId()
|
||||||
const appId = getAppId()
|
// const appId = getAppId()
|
||||||
if (tenantId && appId) {
|
// if (tenantId && appId) {
|
||||||
next(`/oa/login?tenantId=${tenantId}&appId=${appId}&redirect=${to.fullPath}`) // 否则全部重定向到登录页
|
// next(`/oa/login?tenantId=${tenantId}&appId=${appId}&redirect=${to.fullPath}`) // 否则全部重定向到登录页
|
||||||
} else {
|
// } else {
|
||||||
next(`/oa/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
|
next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,86 @@
|
|||||||
<template>
|
<template>
|
||||||
<div> 首页 </div>
|
<div>
|
||||||
|
<!-- 展示所有当前用户可打开的应用程序,包含图标和名称及各应用的角色 -->
|
||||||
|
<div class="flex flex-wrap gap-4">
|
||||||
|
<el-card
|
||||||
|
v-for="item in appList"
|
||||||
|
:key="item.id"
|
||||||
|
shadow="hover"
|
||||||
|
class="width-200px"
|
||||||
|
@click="handleAppClick(item)"
|
||||||
|
>
|
||||||
|
<!-- card body -->
|
||||||
|
<el-image :src="item.clientLogo" fit="fill" :lazy="true" style="width: 180px" />
|
||||||
|
<div class="cutout-text">{{ item.clientName }}</div>
|
||||||
|
|
||||||
|
<template #footer v-if="item.clientDescription">
|
||||||
|
<div class="text-14px text-gray-400">{{ item.clientDescription }}</div>
|
||||||
|
</template>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup name="Home"></script>
|
<script setup name="Home">
|
||||||
|
import { getAppList } from '@/api/platform/index.js'
|
||||||
|
|
||||||
<style lang="scss" scoped></style>
|
const appList = ref([])
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getAppList({
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: -1,
|
||||||
|
isCurrentUser: true
|
||||||
|
}).then((res) => {
|
||||||
|
appList.value = res || []
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
function handleAppClick(item) {
|
||||||
|
window.open(item.redirectUri, '_blank')
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
::v-deep(.el-card__body) {
|
||||||
|
background-color: #001529;
|
||||||
|
padding: 5px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cutout-text {
|
||||||
|
position: relative;
|
||||||
|
font-size: 40px;
|
||||||
|
font-weight: bold;
|
||||||
|
-webkit-text-stroke: 1px #9a9acc;
|
||||||
|
color: #001529;
|
||||||
|
&::before {
|
||||||
|
content: ' ';
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
background-image: linear-gradient(45deg, #ff269b, #2ab5f5, #ffbf00);
|
||||||
|
mix-blend-mode: multiply;
|
||||||
|
}
|
||||||
|
&::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
left: -75%;
|
||||||
|
top: 0;
|
||||||
|
width: 200%;
|
||||||
|
height: 100%;
|
||||||
|
background: radial-gradient(circle, #fff, #000 50%);
|
||||||
|
background-size: 25% 30%;
|
||||||
|
mix-blend-mode: color-dodge;
|
||||||
|
animation: mix 4s linear infinite;
|
||||||
|
background-repeat: repeat;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@keyframes mix {
|
||||||
|
to {
|
||||||
|
transform: translateX(25%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -193,6 +193,14 @@ const handleLogin = async (params) => {
|
|||||||
if (!res) {
|
if (!res) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (res?.instanceId) {
|
||||||
|
authUtil.setAppId(res.instanceId)
|
||||||
|
}
|
||||||
|
if (res?.tenantId) {
|
||||||
|
authUtil.setTenantId(res.tenantId)
|
||||||
|
}
|
||||||
|
|
||||||
ElLoading.service({
|
ElLoading.service({
|
||||||
lock: true,
|
lock: true,
|
||||||
text: '正在加载系统中...',
|
text: '正在加载系统中...',
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<Icon class="mr-5px" icon="ep:user" />
|
<Icon class="mr-5px" icon="ep:user" />
|
||||||
{{ t('profile.user.username') }}
|
{{ t('profile.user.username') }}
|
||||||
<div class="pull-right">{{ userInfo?.username }}</div>
|
<div class="pull-right">{{ userInfo?.nickname }}</div>
|
||||||
</li>
|
</li>
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<Icon class="mr-5px" icon="ep:phone" />
|
<Icon class="mr-5px" icon="ep:phone" />
|
||||||
|
|||||||
Reference in New Issue
Block a user