Skip to content

Commit 31f6da2

Browse files
committed
refactor: chat user login index
1 parent 14ae786 commit 31f6da2

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

ui/src/views/chat/user-login/index.vue

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<template>
22
<UserLoginLayout v-if="!loading" v-loading="loading">
33
<LoginContainer :subTitle="theme.themeInfo?.slogan || $t('theme.defaultSlogan')">
4-
<h2 class="mb-24" v-if="!showQrCodeTab">{{ loginMode || $t('views.login.title') }}</h2>
4+
<h2 class="mb-24" v-if="!showQrCodeTab">
5+
{{ loginMode == 'LOCAL' ? $t('views.login.title') : loginMode }}</h2>
56
<div v-if="!showQrCodeTab">
67
<el-form
78
class="login-form"
@@ -87,7 +88,7 @@
8788
<div class="text-center mt-16">
8889
<template v-for="item in modeList">
8990
<el-button
90-
v-if="item !== '' && loginMode !== item && item !== 'QR_CODE'"
91+
v-if="item !== 'LOCAL' && loginMode !== item && item !== 'QR_CODE'"
9192
circle
9293
:key="item"
9394
class="login-button-circle color-secondary"
@@ -111,13 +112,13 @@
111112
<img src="@/assets/scan/icon_qr_outlined.svg" width="25px"/>
112113
</el-button>
113114
<el-button
114-
v-if="item === '' && loginMode !== ''"
115+
v-if="item === 'LOCAL' && loginMode != 'LOCAL'"
115116
circle
116117
:key="item"
117118
class="login-button-circle color-secondary"
118119
style="font-size: 24px"
119120
icon="UserFilled"
120-
@click="changeMode('')"
121+
@click="changeMode('LOCAL')"
121122
/>
122123
</template>
123124
</div>
@@ -208,7 +209,7 @@ onBeforeMount(() => {
208209
makeCode()
209210
})
210211
211-
const modeList = ref<string[]>([''])
212+
const modeList = ref<string[]>([])
212213
//const QrList = ref<any[]>([''])
213214
const loginMode = ref('')
214215
const showQrCodeTab = ref(false)
@@ -279,7 +280,7 @@ function redirectAuth(authType: string, needMessage: boolean = false) {
279280
}
280281
281282
function changeMode(val: string) {
282-
loginMode.value = val === 'LDAP' ? val : ''
283+
loginMode.value = val === 'LDAP' ? val : 'LOCAL'
283284
if (val === 'QR_CODE') {
284285
loginMode.value = val
285286
showQrCodeTab.value = true
@@ -315,7 +316,8 @@ onBeforeMount(() => {
315316
const [ldap] = res.splice(ldapIndex, 1)
316317
res.unshift(ldap)
317318
}
318-
modeList.value = [...modeList.value, ...res]
319+
modeList.value = [...modeList.value, ...res].filter((item => item !== ''))
320+
loginMode.value = modeList.value[0] || 'LOCAL'
319321
console.log(modeList.value)
320322
}
321323
})

0 commit comments

Comments
 (0)