From b158fb5f9ca9f22da41f2c4b551a455619d76ec1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=97=B6=E5=90=AF=E9=BE=99?= Date: Wed, 28 Aug 2024 15:28:51 +0800 Subject: [PATCH] =?UTF-8?q?log:=20ueky=E7=99=BB=E5=BD=95=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/ukey.js | 15 ++++++++++++++- src/views/login/login.vue | 5 +++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/store/modules/ukey.js b/src/store/modules/ukey.js index f04b915..83c61c2 100644 --- a/src/store/modules/ukey.js +++ b/src/store/modules/ukey.js @@ -10,8 +10,11 @@ const actions = { Login({ commit }, password) { return new Promise((resolve, reject) => { // 调用 ukey 获取 clientHello + console.log('执行 store.dispatch(ukey/Login)开始,传参为password:', password) getClientHello(password).then(checkRes => { + console.log('调用 ukey getClientHello 方法,接口返回结果为:', checkRes) if (checkRes.result !== 0) { + console.log('调用 ukey getClientHello 方法失败,接口返回结果为:', checkRes) Cookies.remove('ngx_cookie') ElMessage({ message: checkRes.message, type: 'error' }) resolve({ @@ -19,23 +22,29 @@ const actions = { }) } const clientHello = checkRes.clientHello + console.log('clientHello:', clientHello) Cookies.set('ngx_cookie', clientHello) // 调用天融信单点登录获取 serverHello getLoginRandom(clientHello) .then(randomRes => { + console.log('调用 getLoginRandom 方法,接口返回结果为:', randomRes) if (!randomRes.success) { + console.log('调用 getLoginRandom 方法失败,接口返回结果为:', randomRes) resolve({ success: false }) } - let serverHello = randomRes.data + const serverHello = randomRes.data + console.log('serverHello:', serverHello) // 调用 ukey 获取 ClientAuth getClientAuth(password, serverHello, clientHello) .then(authRes => { + console.log('调用 ukey getClientAuth 方法,接口返回结果为:', authRes) // 暂未用到 // eslint-disable-next-line @typescript-eslint/no-unused-vars const ClientAuth = authRes.clientAuth if (authRes.result !== 0) { + console.log('调用 ukey getClientAuth 方法失败,接口返回结果为:', authRes) ElMessage({ message: authRes.message, type: 'error' }) resolve({ success: false @@ -45,7 +54,9 @@ const actions = { clientHello, serverHello }).then(tokenRes => { + console.log('调用 trxLogin 方法,接口返回结果为:', tokenRes) if (!tokenRes.success) { + console.log('调用 trxLogin 方法失败,接口返回结果为:', tokenRes) resolve({ success: false }) @@ -54,10 +65,12 @@ const actions = { }) }) .catch(err => { + console.log('调用 ukey getClientAuth 方法 [catch] ,接口返回结果为:', err) reject(err) }) }) .catch(err => { + console.log('调用 getLoginRandom 方法 [catch] ,接口返回结果为:', err) reject(err) }) }) diff --git a/src/views/login/login.vue b/src/views/login/login.vue index bc797d6..3c1ca9e 100644 --- a/src/views/login/login.vue +++ b/src/views/login/login.vue @@ -145,12 +145,17 @@ async function handleUkeyLogin() { if (!loginFormRef.value) return loginFormRef.value.validate(async valid => { if (valid) { + console.log('UKEY: 密码校验通过') + console.log('store', store) loading.value = true const res = await store.dispatch('ukey/Login', loginForm.ukeyPassword).finally(() => (loading.value = false)) if (res && res.success) { + console.log('UKEY: 登录成功,云管融合登录接口返回', res) // 用于保活与监测 ukey 是否拔出 setUkeyPassword(loginForm.ukeyPassword) goLogin(res.data) + } else { + console.log('UKEY: 登录失败,云管融合登录接口返回', res) } } })