|
1 | 1 | <template> |
2 | 2 | <UserLoginLayout v-if="!loading" v-loading="loading"> |
3 | 3 | <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> |
5 | 6 | <div v-if="!showQrCodeTab"> |
6 | 7 | <el-form |
7 | 8 | class="login-form" |
|
87 | 88 | <div class="text-center mt-16"> |
88 | 89 | <template v-for="item in modeList"> |
89 | 90 | <el-button |
90 | | - v-if="item !== '' && loginMode !== item && item !== 'QR_CODE'" |
| 91 | + v-if="item !== 'LOCAL' && loginMode !== item && item !== 'QR_CODE'" |
91 | 92 | circle |
92 | 93 | :key="item" |
93 | 94 | class="login-button-circle color-secondary" |
|
111 | 112 | <img src="@/assets/scan/icon_qr_outlined.svg" width="25px"/> |
112 | 113 | </el-button> |
113 | 114 | <el-button |
114 | | - v-if="item === '' && loginMode !== ''" |
| 115 | + v-if="item === 'LOCAL' && loginMode != 'LOCAL'" |
115 | 116 | circle |
116 | 117 | :key="item" |
117 | 118 | class="login-button-circle color-secondary" |
118 | 119 | style="font-size: 24px" |
119 | 120 | icon="UserFilled" |
120 | | - @click="changeMode('')" |
| 121 | + @click="changeMode('LOCAL')" |
121 | 122 | /> |
122 | 123 | </template> |
123 | 124 | </div> |
@@ -208,7 +209,7 @@ onBeforeMount(() => { |
208 | 209 | makeCode() |
209 | 210 | }) |
210 | 211 |
|
211 | | -const modeList = ref<string[]>(['']) |
| 212 | +const modeList = ref<string[]>([]) |
212 | 213 | //const QrList = ref<any[]>(['']) |
213 | 214 | const loginMode = ref('') |
214 | 215 | const showQrCodeTab = ref(false) |
@@ -279,7 +280,7 @@ function redirectAuth(authType: string, needMessage: boolean = false) { |
279 | 280 | } |
280 | 281 |
|
281 | 282 | function changeMode(val: string) { |
282 | | - loginMode.value = val === 'LDAP' ? val : '' |
| 283 | + loginMode.value = val === 'LDAP' ? val : 'LOCAL' |
283 | 284 | if (val === 'QR_CODE') { |
284 | 285 | loginMode.value = val |
285 | 286 | showQrCodeTab.value = true |
@@ -315,7 +316,8 @@ onBeforeMount(() => { |
315 | 316 | const [ldap] = res.splice(ldapIndex, 1) |
316 | 317 | res.unshift(ldap) |
317 | 318 | } |
318 | | - modeList.value = [...modeList.value, ...res] |
| 319 | + modeList.value = [...modeList.value, ...res].filter((item => item !== '')) |
| 320 | + loginMode.value = modeList.value[0] || 'LOCAL' |
319 | 321 | console.log(modeList.value) |
320 | 322 | } |
321 | 323 | }) |
|
0 commit comments