refactor: clean up code formatting and improve readability in index.vue
parent
680502f366
commit
52f420df58
|
|
@ -317,37 +317,38 @@ onBeforeMount(() => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
})
|
||||||
|
|
||||||
const modeList = ref<string[]>([''])
|
const modeList = ref<string[]>([''])
|
||||||
const QrList = ref<any[]>([''])
|
const QrList = ref<any[]>([''])
|
||||||
const loginMode = ref('')
|
const loginMode = ref('')
|
||||||
const showQrCodeTab = ref(false)
|
const showQrCodeTab = ref(false)
|
||||||
|
|
||||||
interface qrOption {
|
interface qrOption {
|
||||||
key: string
|
key: string
|
||||||
value: 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) {
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
||||||
const r = (Math.random() * 16) | 0
|
const r = (Math.random() * 16) | 0
|
||||||
const v = c === 'x' ? r : (r & 0x3) | 0x8
|
const v = c === 'x' ? r : (r & 0x3) | 0x8
|
||||||
return v.toString(16)
|
return v.toString(16)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const newDefaultSlogan = computed(() => {
|
const newDefaultSlogan = computed(() => {
|
||||||
const default_login = '强大易用的企业级智能体平台'
|
const default_login = '强大易用的企业级智能体平台'
|
||||||
if (!theme.themeInfo?.slogan || default_login == theme.themeInfo?.slogan) {
|
if (!theme.themeInfo?.slogan || default_login == theme.themeInfo?.slogan) {
|
||||||
return t('theme.defaultSlogan')
|
return t('theme.defaultSlogan')
|
||||||
} else {
|
} else {
|
||||||
return theme.themeInfo?.slogan
|
return theme.themeInfo?.slogan
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
function redirectAuth(authType: string, needMessage: boolean = true) {
|
function redirectAuth(authType: string, needMessage: boolean = true) {
|
||||||
if (authType === 'LDAP' || authType === '') {
|
if (authType === 'LDAP' || authType === '') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -397,9 +398,9 @@ onBeforeMount(() => {
|
||||||
window.location.href = url
|
window.location.href = url
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeMode(val: string, needMessage: boolean = true) {
|
function changeMode(val: string, needMessage: boolean = true) {
|
||||||
loginMode.value = val === 'LDAP' ? val : ''
|
loginMode.value = val === 'LDAP' ? val : ''
|
||||||
if (val === 'QR_CODE') {
|
if (val === 'QR_CODE') {
|
||||||
loginMode.value = val
|
loginMode.value = val
|
||||||
|
|
@ -414,9 +415,9 @@ onBeforeMount(() => {
|
||||||
}
|
}
|
||||||
redirectAuth(val, needMessage)
|
redirectAuth(val, needMessage)
|
||||||
loginFormRef.value?.clearValidate()
|
loginFormRef.value?.clearValidate()
|
||||||
}
|
}
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
user.asyncGetProfile().then((res) => {
|
user.asyncGetProfile().then((res) => {
|
||||||
// 企业版和专业版:第三方登录
|
// 企业版和专业版:第三方登录
|
||||||
|
|
@ -457,10 +458,10 @@ onBeforeMount(() => {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
declare const window: any
|
declare const window: any
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const currentUrl = ref(route.fullPath)
|
const currentUrl = ref(route.fullPath)
|
||||||
const params = new URLSearchParams(currentUrl.value.split('?')[1])
|
const params = new URLSearchParams(currentUrl.value.split('?')[1])
|
||||||
|
|
@ -534,7 +535,7 @@ onBeforeMount(() => {
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.login-gradient-divider {
|
.login-gradient-divider {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue