5151</template >
5252
5353<script lang="ts" setup>
54- import { ref , onMounted } from ' vue'
54+ import { ref , onMounted , nextTick , computed } from ' vue'
5555import QrcodeLdap from ' ./QrcodeLdap.vue'
5656import LdapLoginForm from ' ./LdapLoginForm.vue'
5757/* import Oidc from './Oidc.vue'
@@ -77,14 +77,18 @@ defineProps<{
7777 loading: boolean
7878}>()
7979const emits = defineEmits ([' switchTab' , ' autoCallback' , ' update:loading' ])
80- const updateLoading = (show : boolean ) => {
81- emits (' update:loading' , show )
80+ const updateLoading = (show : boolean , time : number = 1000 ) => {
81+ setTimeout (() => {
82+ emits (' update:loading' , show )
83+ }, time )
8284}
8385const { t } = useI18n ()
8486interface Categoryparam {
8587 category: string
8688 proxy? : string
8789}
90+
91+ const adminLogin = computed (() => router .currentRoute ?.value ?.name === ' admin-login' )
8892const loginDialogVisible = ref (false )
8993const dialogTitle = ref (' ' )
9094const dialogInterval = ref <any >(null )
@@ -102,7 +106,7 @@ const userStore = useUserStore()
102106const qrStatus = ref (false )
103107const loginCategory = ref ({} as LoginCategory )
104108const anyEnable = ref (false )
105- // const qrcodeLdapHandler = ref()
109+ const qrcodeLdapHandler = ref ()
106110const oauth2Handler = ref ()
107111const saml2Handler = ref ()
108112/* const state = reactive({
@@ -232,21 +236,21 @@ const toMfa = (mfa) => {
232236 document.getElementsByClassName('preheat-container')[0].setAttribute('style', 'display: none;')
233237 }
234238} */
235- /* const ssoLogin = (category) => {
239+ const ssoLogin = (category : any ) => {
236240 const array = [
237- { category: 'ldap', proxy: '' },
238- { category: 'oidc', proxy: '/oidcbi/#' },
239241 { category: ' cas' , proxy: ' /casbi/#' },
242+ { category: ' oidc' , proxy: ' /oidcbi/#' },
243+ { category: ' ldap' , proxy: ' ' },
240244 { category: ' oauth2' , proxy: ' /#' },
241245 { category: ' saml2' , proxy: ' /#' },
242246 ]
243247 if (category ) {
244- if (category === 1 ) {
248+ if (category === 3 ) {
245249 qrcodeLdapHandler .value ?.setActive (' ldap' )
246250 }
247251 switcherCategory (array [category - 1 ])
248252 }
249- } */
253+ }
250254
251255const switcherCategory = async (param : Categoryparam ) => {
252256 const { category, proxy } = param
@@ -540,47 +544,41 @@ const callBackType = () => {
540544 return getQueryString (' state' )
541545}
542546
543- /* const auto2Platform = async () => {
544- const resultParam = {
545- preheat: true,
546- loadingText: '加载中...',
547- activeName: 'simple',
547+ const auto2Platform = async () => {
548+ if (adminLogin .value ) {
549+ updateLoading (false , 100 )
550+ return
548551 }
549- if (!checkPlatform()) {
550- const res = await loginCategoryApi()
551- const adminLogin = router.currentRoute?.value?.name === 'admin-login'
552- if (adminLogin && (!res.data || res.data === 1)) {
553- emits('autoCallback', resultParam)
554- router.push('/401')
555- return
556- }
557- if (res.data && !adminLogin) {
558- if (res.data === 1) {
559- resultParam.activeName = 'ldap'
560- resultParam.preheat = false
561- } else {
562- resultParam.loadingText = '加载中...'
563- document.getElementsByClassName('ed-loading-text')?.length &&
564- (document.getElementsByClassName('ed-loading-text')[0]['innerText'] =
565- resultParam.loadingText)
566- }
567- nextTick(() => {
568- ssoLogin(res.data)
569- })
570- } else {
571- resultParam.preheat = false
552+ const resData = await request .get (' /system/parameter/login' )
553+ let res = 0
554+ const resObj = {} as any
555+ resData .forEach ((item : any ) => {
556+ resObj [item .pkey ] = item .pval
557+ })
558+ res = parseInt (resObj [' login.default_login' ] || 0 )
559+
560+ if (res && ! adminLogin .value ) {
561+ if (res === 3 ) {
562+ qrStatusChange (' ldap' )
563+ updateLoading (false )
572564 }
573- } else if (getQueryString('state')?.includes('fit2clouddeoauth2')) {
574- resultParam.preheat = true
565+ nextTick (() => {
566+ ssoLogin (res )
567+ })
568+ } else {
569+ updateLoading (false )
575570 }
576- emits('autoCallback', resultParam)
577- } */
571+ }
578572
579573onMounted (() => {
574+ if (adminLogin .value ) {
575+ updateLoading (false , 100 )
576+ return
577+ }
580578 // eslint-disable-next-line no-undef
581579 const obj = LicenseGenerator .getLicense ()
582580 if (obj ?.status !== ' valid' ) {
583- updateLoading (false )
581+ updateLoading (false , 100 )
584582 return
585583 }
586584 wsCache .delete (' de-platform-client' )
@@ -594,7 +592,7 @@ onMounted(() => {
594592 } else if (state ?.includes (' oidc' )) {
595593 oidcLogin ()
596594 } else {
597- updateLoading ( false )
595+ auto2Platform ( )
598596 }
599597 /* else if (window.location.pathname.includes('/oidcbi/')) {
600598 platformLogin(2)
0 commit comments