refactor: clean up code formatting and improve readability in index.vue

v3.2
wxg0103 2025-09-17 15:21:02 +08:00
parent 680502f366
commit 52f420df58
1 changed files with 200 additions and 199 deletions

View File

@ -317,37 +317,38 @@ onBeforeMount(() => {
}
}
})
})
const modeList = ref<string[]>([''])
const QrList = ref<any[]>([''])
const loginMode = ref('')
const showQrCodeTab = ref(false)
const modeList = ref<string[]>([''])
const QrList = ref<any[]>([''])
const loginMode = ref('')
const showQrCodeTab = ref(false)
interface qrOption {
interface qrOption {
key: string
value: string
}
}
const orgOptions = ref<qrOption[]>([])
const orgOptions = ref<qrOption[]>([])
function uuidv4() {
function uuidv4() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
const r = (Math.random() * 16) | 0
const v = c === 'x' ? r : (r & 0x3) | 0x8
return v.toString(16)
})
}
}
const newDefaultSlogan = computed(() => {
const newDefaultSlogan = computed(() => {
const default_login = '强大易用的企业级智能体平台'
if (!theme.themeInfo?.slogan || default_login == theme.themeInfo?.slogan) {
return t('theme.defaultSlogan')
} else {
return theme.themeInfo?.slogan
}
})
})
function redirectAuth(authType: string, needMessage: boolean = true) {
function redirectAuth(authType: string, needMessage: boolean = true) {
if (authType === 'LDAP' || authType === '') {
return
}
@ -397,9 +398,9 @@ onBeforeMount(() => {
window.location.href = url
}
})
}
}
function changeMode(val: string, needMessage: boolean = true) {
function changeMode(val: string, needMessage: boolean = true) {
loginMode.value = val === 'LDAP' ? val : ''
if (val === 'QR_CODE') {
loginMode.value = val
@ -414,9 +415,9 @@ onBeforeMount(() => {
}
redirectAuth(val, needMessage)
loginFormRef.value?.clearValidate()
}
}
onBeforeMount(() => {
onBeforeMount(() => {
loading.value = true
user.asyncGetProfile().then((res) => {
//
@ -457,10 +458,10 @@ onBeforeMount(() => {
loading.value = false
}
})
})
declare const window: any
})
declare const window: any
onMounted(() => {
onMounted(() => {
const route = useRoute()
const currentUrl = ref(route.fullPath)
const params = new URLSearchParams(currentUrl.value.split('?')[1])
@ -534,7 +535,7 @@ onBeforeMount(() => {
default:
break
}
})
})
</script>
<style lang="scss" scoped>
.login-gradient-divider {