7979 </div >
8080 </div >
8181 <div v-if =" showQrCodeTab" >
82- <QrCodeTab :tabs =" orgOptions" />
82+ <QrCodeTab :tabs =" orgOptions" />
8383 </div >
8484 <div class =" login-gradient-divider lighter mt-24" v-if =" modeList.length > 1" >
8585 <span >{{ $t('views.login.moreMethod') }}</span >
9898 'font-size': item === 'OAUTH2' ? '8px' : '10px',
9999 color: theme.themeInfo?.theme,
100100 }"
101- >{{ item }}</span
101+ >{{ item }}</span
102102 >
103103 </el-button >
104104 <el-button
108108 class =" login-button-circle color-secondary"
109109 @click =" changeMode('QR_CODE')"
110110 >
111- <img src =" @/assets/icon_qr_outlined.svg" width =" 25px" />
111+ <img src =" @/assets/icon_qr_outlined.svg" width =" 25px" />
112112 </el-button >
113113 <el-button
114114 v-if =" item === '' && loginMode !== ''"
125125 </login-layout >
126126</template >
127127<script setup lang="ts">
128- import {onMounted , ref , onBeforeMount , computed } from ' vue'
129- import {useRoute , useRouter } from ' vue-router'
130- import type {FormInstance , FormRules } from ' element-plus'
131- import type {LoginRequest } from ' @/api/type/login'
128+ import { onMounted , ref , onBeforeMount , computed } from ' vue'
129+ import { useRoute , useRouter } from ' vue-router'
130+ import type { FormInstance , FormRules } from ' element-plus'
131+ import type { LoginRequest } from ' @/api/type/login'
132132import LoginContainer from ' @/layout/login-layout/LoginContainer.vue'
133133import LoginLayout from ' @/layout/login-layout/LoginLayout.vue'
134134import loginApi from ' @/api/user/login'
135135import authApi from ' @/api/system-settings/auth-setting'
136- import {t , getBrowserLang } from ' @/locales'
136+ import { t , getBrowserLang } from ' @/locales'
137137import useStore from ' @/stores'
138- import {useI18n } from ' vue-i18n'
138+ import { useI18n } from ' vue-i18n'
139139import QrCodeTab from ' @/views/login/scanCompinents/QrCodeTab.vue'
140- import {MsgConfirm , MsgError } from ' @/utils/message.ts'
140+ import { MsgConfirm , MsgError } from ' @/utils/message.ts'
141141import * as dd from ' dingtalk-jsapi'
142- import {loadScript } from ' @/utils/common'
143- import {hasPermission } from " @/utils/permission" ;
144- import {RoleConst } from " @/utils/permission/data.ts" ;
142+ import { loadScript } from ' @/utils/common'
145143
146144const router = useRouter ()
147- const {login, user, theme} = useStore ()
148- const {locale} = useI18n ({useScope: ' global' })
145+ const { login, user, theme } = useStore ()
146+ const { locale } = useI18n ({ useScope: ' global' })
149147const loading = ref <boolean >(false )
150148
151149const identifyCode = ref <string >(' ' )
@@ -182,20 +180,32 @@ const rules = ref<FormRules<LoginRequest>>({
182180})
183181
184182const loginHandle = () => {
185- loginFormRef .value ?.validate ().then (() => {
186- if (loginMode .value === ' LDAP' ) {
187- login .asyncLdapLogin (loginForm .value , loading ).then (() => {
188- locale .value = localStorage .getItem (' MaxKB-locale' ) || getBrowserLang () || ' en-US'
189- router .push ({name: ' home' })
190- })
191- } else {
192- login .asyncLogin (loginForm .value , loading ).then (() => {
193- locale .value = localStorage .getItem (' MaxKB-locale' ) || getBrowserLang () || ' en-US'
194- localStorage .setItem (' workspace_id' , ' default' )
195- router .push ({name: ' home' })
196- })
197- }
198- })
183+ loading .value = true
184+ loginFormRef .value
185+ ?.validate ()
186+ .then (() => {
187+ if (loginMode .value === ' LDAP' ) {
188+ login .asyncLdapLogin (loginForm .value ).then (() => {
189+ locale .value = localStorage .getItem (' MaxKB-locale' ) || getBrowserLang () || ' en-US'
190+ loading .value = false
191+ router .push ({ name: ' home' })
192+ }).catch (() => {
193+ loading .value = false
194+ })
195+ } else {
196+ login .asyncLogin (loginForm .value ).then (() => {
197+ locale .value = localStorage .getItem (' MaxKB-locale' ) || getBrowserLang () || ' en-US'
198+ localStorage .setItem (' workspace_id' , ' default' )
199+ loading .value = false
200+ router .push ({ name: ' home' })
201+ }).catch (() => {
202+ loading .value = false
203+ })
204+ }
205+ })
206+ .catch (() => {
207+ loading .value = false
208+ })
199209}
200210
201211function makeCode() {
@@ -227,13 +237,13 @@ function uuidv4() {
227237 return v .toString (16 )
228238 })
229239}
230- const newDefaultSlogan= computed (()=> {
231- const default_login= ' 强大易用的企业级智能体平台'
232- if (! theme .themeInfo ?.slogan || default_login == theme .themeInfo ?.slogan ){
233- return t (' theme.defaultSlogan' )
234- } else {
235- return theme .themeInfo ?.slogan
236- }
240+ const newDefaultSlogan = computed (() => {
241+ const default_login = ' 强大易用的企业级智能体平台'
242+ if (! theme .themeInfo ?.slogan || default_login == theme .themeInfo ?.slogan ) {
243+ return t (' theme.defaultSlogan' )
244+ } else {
245+ return theme .themeInfo ?.slogan
246+ }
237247})
238248function redirectAuth(authType : string ) {
239249 if (authType === ' LDAP' || authType === ' ' ) {
@@ -282,8 +292,7 @@ function redirectAuth(authType: string) {
282292 window .location .href = url
283293 }
284294 })
285- .catch (() => {
286- })
295+ .catch (() => {})
287296 })
288297}
289298
@@ -358,10 +367,10 @@ onMounted(() => {
358367 const handleDingTalk = () => {
359368 const code = params .get (' corpId' )
360369 if (code ) {
361- dd .runtime .permission .requestAuthCode ({corpId: code }).then ((res ) => {
370+ dd .runtime .permission .requestAuthCode ({ corpId: code }).then ((res ) => {
362371 console .log (' DingTalk client request success:' , res )
363372 login .dingOauth2Callback (res .code ).then (() => {
364- router .push ({name: ' home' })
373+ router .push ({ name: ' home' })
365374 })
366375 })
367376 }
@@ -374,7 +383,7 @@ onMounted(() => {
374383 appId: appId ,
375384 success : (res : any ) => {
376385 login .larkCallback (res .code ).then (() => {
377- router .push ({name: ' home' })
386+ router .push ({ name: ' home' })
378387 })
379388 },
380389 fail : (error : any ) => {
@@ -394,11 +403,11 @@ onMounted(() => {
394403 scopeList: [],
395404 success : (res : any ) => {
396405 login .larkCallback (res .code ).then (() => {
397- router .push ({name: ' home' })
406+ router .push ({ name: ' home' })
398407 })
399408 },
400409 fail : (error : any ) => {
401- const {errno} = error
410+ const { errno } = error
402411 if (errno === 103 ) {
403412 callRequestAuthCode ()
404413 }
0 commit comments