99 class =" mr-8"
1010 style =" background : none "
1111 >
12- <img :src =" chatUser.chat_profile?.icon" alt =" " />
12+ <img :src =" chatUser.chat_profile?.icon" alt =" " />
1313 </el-avatar >
14- <LogoIcon v-else height="32px" class="mr-8"/>
14+ <LogoIcon v-else height="32px" class="mr-8" />
1515 <h1 >{{ chatUser.chat_profile?.application_name }}</h1 >
1616 </div >
1717 <!-- 移动端头部标题-->
2525 :size =" 32"
2626 style =" background : none "
2727 >
28- <img :src =" chatUser.chat_profile?.icon" alt =" " />
28+ <img :src =" chatUser.chat_profile?.icon" alt =" " />
2929 </el-avatar >
30- <LogoIcon v-else height="32px"/>
30+ <LogoIcon v-else height="32px" />
3131 </div >
3232
3333 <h4
4141 </div >
4242 </div >
4343
44- <el-card class =" login-card" v-if =" chatUser.chat_profile?.authentication_type == 'password'" >
44+ <el-card
45+ class =" login-card"
46+ v-if ="
47+ chatUser.chat_profile?.authentication &&
48+ chatUser.chat_profile?.authentication_type == 'password'
49+ "
50+ >
4551 <h2 class =" mb-24" >
4652 {{ $t('views.applicationOverview.appInfo.LimitDialog.authenticationValue') }}
4753 </h2 >
8591 </el-input >
8692 </el-form-item >
8793 </div >
88- <div class =" mb-24" v-if =" loginMode !== 'LDAP'&& identifyCode" >
94+ <div class =" mb-24" v-if =" loginMode !== 'LDAP' && identifyCode" >
8995 <el-form-item prop =" captcha" >
9096 <div class =" flex-between w-full" >
9197 <el-input
119125 </el-button >
120126 </div >
121127 <div v-if =" showQrCodeTab" >
122- <QrCodeTab :tabs =" orgOptions " />
128+ <QrCodeTab :tabs =" orgOptions " />
123129 </div >
124130 <div class =" login-gradient-divider lighter mt-24" v-if =" modeList.length > 1" >
125131 <span >{{ $t('views.login.moreMethod') }}</span >
138144 'font-size': item === 'OAUTH2' ? '8px' : '10px',
139145 color: theme.themeInfo?.theme,
140146 }"
141- >{{ item }}</span
147+ >{{ item }}</span
142148 >
143149 </el-button >
144150 <el-button
148154 class =" login-button-circle color-secondary"
149155 @click =" changeMode('QR_CODE')"
150156 >
151- <img src =" @/assets/icon_qr_outlined.svg" width =" 25px" />
157+ <img src =" @/assets/icon_qr_outlined.svg" width =" 25px" />
152158 </el-button >
153159 <el-button
154160 v-if =" item === 'LOCAL' && loginMode != 'LOCAL'"
166172 </UserLoginLayout >
167173</template >
168174<script setup lang="ts">
169- import {onMounted , ref , onBeforeMount , computed } from ' vue'
170- import {useRoute , useRouter } from ' vue-router'
171- import type {FormInstance , FormRules } from ' element-plus'
172- import type {LoginRequest } from ' @/api/type/login'
175+ import { onMounted , ref , onBeforeMount , computed } from ' vue'
176+ import { useRoute , useRouter } from ' vue-router'
177+ import type { FormInstance , FormRules } from ' element-plus'
178+ import type { LoginRequest } from ' @/api/type/login'
173179import UserLoginLayout from ' @/layout/login-layout/UserLoginLayout.vue'
174180import loginApi from ' @/api/chat/chat.ts'
175- import {t } from ' @/locales'
181+ import { t } from ' @/locales'
176182import useResize from ' @/layout/hooks/useResize'
177183import useStore from ' @/stores'
178- import {useI18n } from ' vue-i18n'
184+ import { useI18n } from ' vue-i18n'
179185import QrCodeTab from ' @/views/chat/user-login/scanCompinents/QrCodeTab.vue'
180- import {MsgConfirm , MsgError } from ' @/utils/message.ts'
186+ import { MsgConfirm , MsgError } from ' @/utils/message.ts'
181187import PasswordAuth from ' @/views/chat/auth/component/password.vue'
182- import {isAppIcon , loadScript } from ' @/utils/common'
183- import * as dd from " dingtalk-jsapi" ;
184- import JSEncrypt from " jsencrypt" ;
188+ import { isAppIcon , loadScript } from ' @/utils/common'
189+ import * as dd from ' dingtalk-jsapi'
190+ import JSEncrypt from ' jsencrypt'
185191
186192useResize ()
187193const router = useRouter ()
188194
189- const {theme, chatUser, common} = useStore ()
190- const {locale} = useI18n ({useScope: ' global' })
195+ const { theme, chatUser, common } = useStore ()
196+ const { locale } = useI18n ({ useScope: ' global' })
191197const loading = ref <boolean >(false )
192198const route = useRoute ()
193199const identifyCode = ref <string >(' ' )
194200const {
195- params : {accessToken},
196- query : {mode},
201+ params : { accessToken },
202+ query : { mode },
197203} = route as any
198204
199205const isPc = computed (() => {
@@ -215,7 +221,7 @@ const loginForm = ref<LoginRequest>({
215221 captcha: ' ' ,
216222})
217223
218- const max_attempts = ref <number >(1 ) // 声明为 ref
224+ const max_attempts = ref <number >(1 ) // 声明为 ref
219225const rules = ref <FormRules <LoginRequest >>({
220226 username: [
221227 {
@@ -246,30 +252,33 @@ const loginHandle = () => {
246252 chatUser .ldapLogin (loginForm .value ).then ((ok ) => {
247253 router .push ({
248254 name: ' chat' ,
249- params: {accessToken: chatUser .accessToken },
255+ params: { accessToken: chatUser .accessToken },
250256 query: route .query ,
251257 })
252258 })
253259 } else {
254260 // JSEncrypt 在有些打包环境可能作为 default export 或直接导出,兼容两种情况
255- const JSEncryptCtor = (JSEncrypt as any )?.default ? (JSEncrypt as any ).default : JSEncrypt ;
256- const js = new (JSEncryptCtor as any )();
257- js .setPublicKey (chatUser ?.chat_profile ?.rsaKey as any );
258- const jsonData = JSON .stringify (loginForm .value );
259- const encryptedBase64 = js .encrypt (jsonData );
260-
261- chatUser .login ({
262- encryptedData: encryptedBase64 ,
263- username: loginForm .value .username
264- }).then ((ok ) => {
265- router .push ({
266- name: ' chat' ,
267- params: {accessToken: chatUser .accessToken },
268- query: route .query ,
261+ const JSEncryptCtor = (JSEncrypt as any )?.default ? (JSEncrypt as any ).default : JSEncrypt
262+ const js = new (JSEncryptCtor as any )()
263+ js .setPublicKey (chatUser ?.chat_profile ?.rsaKey as any )
264+ const jsonData = JSON .stringify (loginForm .value )
265+ const encryptedBase64 = js .encrypt (jsonData )
266+
267+ chatUser
268+ .login ({
269+ encryptedData: encryptedBase64 ,
270+ username: loginForm .value .username ,
271+ })
272+ .then ((ok ) => {
273+ router .push ({
274+ name: ' chat' ,
275+ params: { accessToken: chatUser .accessToken },
276+ query: route .query ,
277+ })
278+ })
279+ .catch (() => {
280+ makeCode (loginForm .value .username )
269281 })
270- }).catch (() => {
271- makeCode (loginForm .value .username )
272- })
273282 }
274283 })
275284}
@@ -353,8 +362,7 @@ function redirectAuth(authType: string, needMessage: boolean = false) {
353362 .then (() => {
354363 window .location .href = url
355364 })
356- .catch (() => {
357- })
365+ .catch (() => {})
358366 } else {
359367 console .log (' url' , url )
360368 window .location .href = url
@@ -390,6 +398,9 @@ onBeforeMount(() => {
390398 if (chatUser .chat_profile ?.max_attempts ) {
391399 max_attempts .value = chatUser .chat_profile .max_attempts
392400 }
401+ if (! chatUser .chat_profile ?.authentication ) {
402+ return
403+ }
393404 if (chatUser .chat_profile ?.login_value ) {
394405 modeList .value = chatUser .chat_profile .login_value
395406 if (modeList .value .includes (' LOCAL' )) {
@@ -440,12 +451,12 @@ onBeforeMount(() => {
440451 const handleDingTalk = () => {
441452 const code = params .get (' corpId' )
442453 if (code ) {
443- dd .runtime .permission .requestAuthCode ({corpId: code }).then ((res ) => {
454+ dd .runtime .permission .requestAuthCode ({ corpId: code }).then ((res ) => {
444455 console .log (' DingTalk client request success:' , res )
445456 chatUser .dingOauth2Callback (res .code , accessToken ).then (() => {
446457 router .push ({
447458 name: ' chat' ,
448- params: {accessToken: accessToken },
459+ params: { accessToken: accessToken },
449460 query: route .query ,
450461 })
451462 })
@@ -462,7 +473,7 @@ onBeforeMount(() => {
462473 chatUser .larkCallback (res .code , accessToken ).then (() => {
463474 router .push ({
464475 name: ' chat' ,
465- params: {accessToken: accessToken },
476+ params: { accessToken: accessToken },
466477 query: route .query ,
467478 })
468479 })
@@ -486,13 +497,13 @@ onBeforeMount(() => {
486497 chatUser .larkCallback (res .code , accessToken ).then (() => {
487498 router .push ({
488499 name: ' chat' ,
489- params: {accessToken: accessToken },
500+ params: { accessToken: accessToken },
490501 query: route .query ,
491502 })
492503 })
493504 },
494505 fail : (error : any ) => {
495- const {errno} = error
506+ const { errno } = error
496507 if (errno === 103 ) {
497508 callRequestAuthCode ()
498509 }
0 commit comments