mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-08 09:17:06 +08:00
perf: Authentication Failure Prompt Optimization
This commit is contained in:
committed by
fit2cloud-chenyw
parent
4285ec386b
commit
a426c39328
@@ -0,0 +1,29 @@
|
||||
<svg width="101" height="87" viewBox="0 0 101 87" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M2.5 -0.000976562H98.5C99.6046 -0.000976563 100.5 0.894454 100.5 1.99902V84.9038C100.5 86.0084 99.6046 86.9038 98.5 86.9038H2.5C1.39543 86.9038 0.5 86.0084 0.5 84.9038V1.99902C0.5 0.894454 1.39543 -0.000976562 2.5 -0.000976562Z" fill="#D6DAE1"/>
|
||||
<mask id="mask0_262_30765" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="-1" width="101" height="88">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M2.5 -0.000976562H98.5C99.6046 -0.000976563 100.5 0.894454 100.5 1.99902V84.9038C100.5 86.0084 99.6046 86.9038 98.5 86.9038H2.5C1.39543 86.9038 0.5 86.0084 0.5 84.9038V1.99902C0.5 0.894454 1.39543 -0.000976562 2.5 -0.000976562Z" fill="white"/>
|
||||
</mask>
|
||||
<g mask="url(#mask0_262_30765)">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M-3.07178 -7.14453H102.881V14.284H-3.07178V-7.14453Z" fill="#B5BEC8"/>
|
||||
</g>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.8331 9.52411C10.1481 9.52411 11.2141 8.45812 11.2141 7.14316C11.2141 5.8282 10.1481 4.76221 8.8331 4.76221C7.51814 4.76221 6.45215 5.8282 6.45215 7.14316C6.45215 8.45812 7.51814 9.52411 8.8331 9.52411Z" fill="white"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M15.9762 9.52411C17.2911 9.52411 18.3571 8.45812 18.3571 7.14316C18.3571 5.8282 17.2911 4.76221 15.9762 4.76221C14.6612 4.76221 13.5952 5.8282 13.5952 7.14316C13.5952 8.45812 14.6612 9.52411 15.9762 9.52411Z" fill="white"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M23.1187 9.52411C24.4337 9.52411 25.4997 8.45812 25.4997 7.14316C25.4997 5.8282 24.4337 4.76221 23.1187 4.76221C21.8038 4.76221 20.7378 5.8282 20.7378 7.14316C20.7378 8.45812 21.8038 9.52411 23.1187 9.52411Z" fill="white"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M44.5477 22.6187H13.2144C12.1098 22.6187 11.2144 23.5141 11.2144 24.6187V74.1901C11.2144 75.2947 12.1098 76.1901 13.2144 76.1901H52.1263L41.6098 65.3387L49.583 55.2156L41.6098 46.6868L50.9358 33.9282L44.5477 22.6187Z" fill="#F4F5F9"/>
|
||||
<mask id="mask1_262_30765" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="11" y="22" width="42" height="55">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M44.5477 22.6187H13.2144C12.1098 22.6187 11.2144 23.5141 11.2144 24.6187V74.1901C11.2144 75.2947 12.1098 76.1901 13.2144 76.1901H52.1263L41.6098 65.3387L49.583 55.2156L41.6098 46.6868L50.9358 33.9282L44.5477 22.6187Z" fill="white"/>
|
||||
</mask>
|
||||
<g mask="url(#mask1_262_30765)">
|
||||
<rect x="17.9033" y="42.9996" width="63" height="6" rx="1" fill="#E0E4E8"/>
|
||||
<rect x="17.9033" y="31.9985" width="63" height="6" rx="1" fill="#E0E4E8"/>
|
||||
</g>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M48.0167 22.6187H86.5954C87.6999 22.6187 88.5954 23.5141 88.5954 24.6187V74.1901C88.5954 75.2947 87.6999 76.1901 86.5954 76.1901H55.6135L45.583 65.4615L54.0716 54.0824L45.583 46.5528L54.0716 33.9282L48.0167 22.6187Z" fill="#F4F5F9"/>
|
||||
<mask id="mask2_262_30765" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="45" y="22" width="44" height="55">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M48.0167 22.6187H86.5954C87.6999 22.6187 88.5954 23.5141 88.5954 24.6187V74.1901C88.5954 75.2947 87.6999 76.1901 86.5954 76.1901H55.6135L45.583 65.4615L54.0716 54.0824L45.583 46.5528L54.0716 33.9282L48.0167 22.6187Z" fill="white"/>
|
||||
</mask>
|
||||
<g mask="url(#mask2_262_30765)">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M18.9033 31.9985H79.9033C80.4556 31.9985 80.9033 32.3716 80.9033 32.8319V36.1652C80.9033 36.6254 80.4556 36.9985 79.9033 36.9985H18.9033C18.351 36.9985 17.9033 36.6254 17.9033 36.1652V32.8319C17.9033 32.3716 18.351 31.9985 18.9033 31.9985Z" fill="#E0E4E8"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M18.9033 42.9996H79.9033C80.4556 42.9996 80.9033 43.3727 80.9033 43.833V47.1663C80.9033 47.6265 80.4556 47.9996 79.9033 47.9996H18.9033C18.351 47.9996 17.9033 47.6265 17.9033 47.1663V43.833C17.9033 43.3727 18.351 42.9996 18.9033 42.9996Z" fill="#E0E4E8"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M56.9033 57.9996H79.9033C80.4556 57.9996 80.9033 58.3727 80.9033 58.833V62.1663C80.9033 62.6265 80.4556 62.9996 79.9033 62.9996H56.9033C56.351 62.9996 55.9033 62.6265 55.9033 62.1663V58.833C55.9033 58.3727 56.351 57.9996 56.9033 57.9996Z" fill="#E0E4E8"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 4.2 KiB |
@@ -21,6 +21,7 @@ import Appearance from '@/views/system/appearance/index.vue'
|
||||
import Permission from '@/views/system/permission/index.vue'
|
||||
import User from '@/views/system/user/User.vue'
|
||||
import Workspace from '@/views/system/workspace/index.vue'
|
||||
import Page401 from '@/views/error/index.vue'
|
||||
import { i18n } from '@/i18n'
|
||||
import { watchRouter } from './watch'
|
||||
|
||||
@@ -207,6 +208,13 @@ export const routes = [
|
||||
name: 'assistantTest',
|
||||
component: assistantTest,
|
||||
},
|
||||
{
|
||||
path: '/401',
|
||||
name: '401',
|
||||
hidden: true,
|
||||
meta: {},
|
||||
component: Page401,
|
||||
},
|
||||
]
|
||||
const router = createRouter({
|
||||
history: createWebHashHistory(),
|
||||
|
||||
@@ -8,7 +8,7 @@ const appearanceStore = useAppearanceStoreWithOut()
|
||||
const userStore = useUserStore()
|
||||
const { wsCache } = useCache()
|
||||
const whiteList = ['/login']
|
||||
const assistantWhiteList = ['/assistant', '/embeddedPage']
|
||||
const assistantWhiteList = ['/assistant', '/embeddedPage', '/401']
|
||||
export const watchRouter = (router: any) => {
|
||||
router.beforeEach(async (to: any, from: any, next: any) => {
|
||||
await loadXpackStatic()
|
||||
|
||||
@@ -11,10 +11,12 @@ import axios, {
|
||||
import { useCache } from '@/utils/useCache'
|
||||
import { getLocale } from './utils'
|
||||
import { useAssistantStore } from '@/stores/assistant'
|
||||
import { useRouter } from 'vue-router'
|
||||
// import { i18n } from '@/i18n'
|
||||
// const t = i18n.global.t
|
||||
const assistantStore = useAssistantStore()
|
||||
const { wsCache } = useCache()
|
||||
const router = useRouter()
|
||||
// Response data structure
|
||||
export interface ApiResponse<T = unknown> {
|
||||
code: number
|
||||
@@ -193,6 +195,15 @@ class HttpService {
|
||||
? error.response.data.toString()
|
||||
: 'Unauthorized, please login again'
|
||||
// Redirect to login page if needed
|
||||
if (assistantStore.getAssistant) {
|
||||
wsCache.delete('user.token')
|
||||
if (router?.push) {
|
||||
router.push(`/401?title=${encodeURIComponent(errorMessage)}`)
|
||||
} else {
|
||||
window.location.href = `/#/401?title=${encodeURIComponent(errorMessage)}`
|
||||
}
|
||||
return
|
||||
}
|
||||
ElMessage({
|
||||
message: errorMessage,
|
||||
type: 'error',
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
<template>
|
||||
<div class="page-not-found">
|
||||
<Icon name="401"><Four class="svg-icon login-logo-icon" /></Icon>
|
||||
<span class="span-403">{{ title || routerTitle || '' }}</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import Four from '@/assets/svg/401.svg'
|
||||
import { Icon } from '@/components/icon-custom'
|
||||
import { propTypes } from '@/utils/propTypes'
|
||||
import { computed } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
const route = useRoute()
|
||||
defineProps({
|
||||
title: propTypes.string,
|
||||
})
|
||||
const routerTitle = computed(() => route.query?.title || '')
|
||||
</script>
|
||||
<style lang="less">
|
||||
.page-not-found {
|
||||
height: 100px;
|
||||
width: 100%;
|
||||
top: calc(50% - 100px);
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
}
|
||||
.span-403 {
|
||||
display: block;
|
||||
margin: 0;
|
||||
font-size: var(--ed-font-size-base);
|
||||
color: var(--ed-text-color-secondary);
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user