mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-08 01:06:59 +08:00
perf: Optimize the embedded Ask-Data module in the client
This commit is contained in:
committed by
fit2cloud-chenyw
parent
0dc289956b
commit
1819d95adf
@@ -4,7 +4,7 @@ import { AuthApi } from '@/api/login'
|
||||
import { useCache } from '@/utils/useCache'
|
||||
import { i18n } from '@/i18n'
|
||||
import { store } from './index'
|
||||
import { getCurrentRouter, getQueryString, isPlatform } from '@/utils/utils'
|
||||
import { getCurrentRouter, getQueryString, getSQLBotAddr, isPlatform } from '@/utils/utils'
|
||||
|
||||
const { wsCache } = useCache()
|
||||
|
||||
@@ -103,7 +103,7 @@ export const UserStore = defineStore('user', {
|
||||
isPlatform()
|
||||
) {
|
||||
const currentPath = getCurrentRouter()
|
||||
let logout_url = location.origin + location.pathname + '#/login'
|
||||
let logout_url = getSQLBotAddr() + '#/login'
|
||||
if (currentPath) {
|
||||
logout_url += `?redirect=${currentPath}`
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ import { useCache } from '@/utils/useCache'
|
||||
|
||||
import router from '@/router'
|
||||
import { useUserStore } from '@/stores/user.ts'
|
||||
import { getQueryString, getUrlParams, isPlatformClient } from '@/utils/utils'
|
||||
import { getQueryString, getSQLBotAddr, getUrlParams, isPlatformClient } from '@/utils/utils'
|
||||
import { loadClient, type LoginCategory } from './PlatformClient'
|
||||
// import MfaStep from './MfaStep.vue'
|
||||
// import { logoutHandler } from '@/utils/logout'
|
||||
@@ -344,8 +344,7 @@ const casLogin = () => {
|
||||
// logoutHandler(true, true)
|
||||
platformLoginMsg.value = e?.message || e
|
||||
setTimeout(() => {
|
||||
window.location.href =
|
||||
window.location.origin + window.location.pathname + window.location.hash
|
||||
window.location.href = getSQLBotAddr() + window.location.hash
|
||||
}, 2000)
|
||||
}, 1500)
|
||||
})
|
||||
@@ -377,8 +376,7 @@ const oauth2Login = () => {
|
||||
// logoutHandler(true, true)
|
||||
platformLoginMsg.value = e?.message || e
|
||||
setTimeout(() => {
|
||||
window.location.href =
|
||||
window.location.origin + window.location.pathname + window.location.hash
|
||||
window.location.href = getSQLBotAddr() + window.location.hash
|
||||
}, 2000)
|
||||
}, 1500)
|
||||
})
|
||||
@@ -410,8 +408,7 @@ const oidcLogin = () => {
|
||||
// logoutHandler(true, true)
|
||||
platformLoginMsg.value = e?.message || e
|
||||
setTimeout(() => {
|
||||
window.location.href =
|
||||
window.location.origin + window.location.pathname + window.location.hash
|
||||
window.location.href = getSQLBotAddr() + window.location.hash
|
||||
}, 2000)
|
||||
}, 1500)
|
||||
})
|
||||
@@ -443,15 +440,14 @@ const wecomLogin = () => {
|
||||
// logoutHandler(true, true)
|
||||
platformLoginMsg.value = e?.message || e
|
||||
setTimeout(() => {
|
||||
window.location.href =
|
||||
window.location.origin + window.location.pathname + window.location.hash
|
||||
window.location.href = getSQLBotAddr() + window.location.hash
|
||||
}, 2000)
|
||||
}, 1500)
|
||||
})
|
||||
}
|
||||
const larkLogin = () => {
|
||||
const urlParams = getUrlParams()
|
||||
urlParams['redirect_uri'] = encodeURIComponent(window.location.origin + window.location.pathname)
|
||||
urlParams['redirect_uri'] = encodeURIComponent(getSQLBotAddr())
|
||||
request
|
||||
.post('/system/platform/sso/8', urlParams)
|
||||
.then((res: any) => {
|
||||
@@ -477,8 +473,7 @@ const larkLogin = () => {
|
||||
// logoutHandler(true, true)
|
||||
platformLoginMsg.value = e?.message || e
|
||||
setTimeout(() => {
|
||||
window.location.href =
|
||||
window.location.origin + window.location.pathname + window.location.hash
|
||||
window.location.href = getSQLBotAddr() + window.location.hash
|
||||
}, 2000)
|
||||
}, 1500)
|
||||
})
|
||||
@@ -510,8 +505,7 @@ const dingtalkLogin = () => {
|
||||
// logoutHandler(true, true)
|
||||
platformLoginMsg.value = e?.message || e
|
||||
setTimeout(() => {
|
||||
window.location.href =
|
||||
window.location.origin + window.location.pathname + window.location.hash
|
||||
window.location.href = getSQLBotAddr() + window.location.hash
|
||||
}, 2000)
|
||||
}, 1500)
|
||||
})
|
||||
@@ -536,7 +530,7 @@ const dingtalkLogin = () => {
|
||||
userStore.setTime(Date.now())
|
||||
if (origin === 10 || isLarkPlatform()) {
|
||||
window.location.href =
|
||||
window.location.origin + window.location.pathname + window.location.hash
|
||||
getSQLBotAddr() + window.location.hash
|
||||
} else {
|
||||
const queryRedirectPath = getCurLocation()
|
||||
router.push({ path: queryRedirectPath })
|
||||
@@ -547,7 +541,7 @@ const dingtalkLogin = () => {
|
||||
if (isLarkPlatform()) {
|
||||
setTimeout(() => {
|
||||
window.location.href =
|
||||
window.location.origin + window.location.pathname + window.location.hash
|
||||
getSQLBotAddr() + window.location.hash
|
||||
}, 2000)
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
@@ -613,7 +607,7 @@ const oauth2Token = (cb) => {
|
||||
.catch(() => {
|
||||
setTimeout(() => {
|
||||
window.location.href =
|
||||
window.location.origin + window.location.pathname + window.location.hash
|
||||
getSQLBotAddr() + window.location.hash
|
||||
}, 2000)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { loadScript } from '@/utils/RemoteJs'
|
||||
import { getQueryString } from '@/utils/utils'
|
||||
import { getCurrentRouter, getQueryString } from '@/utils/utils'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus-secondary'
|
||||
|
||||
// import { useI18n } from 'vue-i18n'
|
||||
@@ -35,7 +35,7 @@ export const loadClient = (category: LoginCategory) => {
|
||||
const type = getQueryString('client')
|
||||
const corpid = getQueryString('corpid')
|
||||
if (type && !category[type as keyof LoginCategory]) {
|
||||
ElMessageBox.confirm(t('login.platform_disable', [t(`threshold.${type}`)]), {
|
||||
ElMessageBox.confirm(t('login.platform_disable', [t(`user.${type}`)]), {
|
||||
confirmButtonType: 'danger',
|
||||
type: 'warning',
|
||||
showCancelButton: false,
|
||||
@@ -173,5 +173,7 @@ const larksuiteClientRequest = async () => {
|
||||
|
||||
const toUrl = (url: string) => {
|
||||
const { origin, pathname } = window.location
|
||||
window.location.href = origin + pathname + url
|
||||
const redirect = getCurrentRouter()
|
||||
window.location.href =
|
||||
origin + pathname + url + (redirect?.includes('chatPreview') ? `#${redirect}` : '')
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import { ElMessage, ElLoading } from 'element-plus-secondary'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import type { FormInstance, FormRules } from 'element-plus-secondary'
|
||||
import { request } from '@/utils/request'
|
||||
import { getSQLBotAddr } from '@/utils/utils'
|
||||
const { t } = useI18n()
|
||||
const dialogVisible = ref(false)
|
||||
const loadingInstance = ref<ReturnType<typeof ElLoading.service> | null>(null)
|
||||
@@ -28,7 +29,7 @@ const state = reactive({
|
||||
})
|
||||
|
||||
/* const spMetaDataUrl = ref('')
|
||||
spMetaDataUrl.value = location.origin + location.pathname + 'saml/metadata' */
|
||||
spMetaDataUrl.value = getSQLBotAddr() + 'saml/metadata' */
|
||||
|
||||
const rule = reactive<FormRules>({
|
||||
/* idpUri: [
|
||||
@@ -72,8 +73,8 @@ const submitForm = async (formEl: FormInstance | undefined) => {
|
||||
await formEl.validate((valid) => {
|
||||
if (valid) {
|
||||
const param = { ...state.form } as any
|
||||
param['spEntityId'] = location.origin + location.pathname + 'saml/metadata'
|
||||
param['spAcs'] = location.origin + location.pathname + 'saml/sso'
|
||||
param['spEntityId'] = getSQLBotAddr() + 'saml/metadata'
|
||||
param['spAcs'] = getSQLBotAddr() + 'saml/sso'
|
||||
const method = request.post('/setting/authentication/save/saml', param)
|
||||
showLoading()
|
||||
method
|
||||
@@ -114,8 +115,8 @@ const closeLoading = () => {
|
||||
const validate = () => {
|
||||
const url = '/setting/authentication/validate/saml2'
|
||||
const data = { ...state.form } as any
|
||||
data['spEntityId'] = location.origin + location.pathname + 'saml/metadata'
|
||||
data['spAcs'] = location.origin + location.pathname + 'saml/sso'
|
||||
data['spEntityId'] = getSQLBotAddr() + 'saml/metadata'
|
||||
data['spAcs'] = getSQLBotAddr() + 'saml/sso'
|
||||
showLoading()
|
||||
request
|
||||
.post(url, data)
|
||||
|
||||
Reference in New Issue
Block a user