log: ueky登录增加日志

develop
时启龙 2024-08-28 15:28:51 +08:00
parent 3e63dd2c7f
commit b158fb5f9c
2 changed files with 19 additions and 1 deletions

View File

@ -10,8 +10,11 @@ const actions = {
Login({ commit }, password) { Login({ commit }, password) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// 调用 ukey 获取 clientHello // 调用 ukey 获取 clientHello
console.log('执行 store.dispatch(ukey/Login)开始,传参为password:', password)
getClientHello(password).then(checkRes => { getClientHello(password).then(checkRes => {
console.log('调用 ukey getClientHello 方法,接口返回结果为:', checkRes)
if (checkRes.result !== 0) { if (checkRes.result !== 0) {
console.log('调用 ukey getClientHello 方法失败,接口返回结果为:', checkRes)
Cookies.remove('ngx_cookie') Cookies.remove('ngx_cookie')
ElMessage({ message: checkRes.message, type: 'error' }) ElMessage({ message: checkRes.message, type: 'error' })
resolve({ resolve({
@ -19,23 +22,29 @@ const actions = {
}) })
} }
const clientHello = checkRes.clientHello const clientHello = checkRes.clientHello
console.log('clientHello:', clientHello)
Cookies.set('ngx_cookie', clientHello) Cookies.set('ngx_cookie', clientHello)
// 调用天融信单点登录获取 serverHello // 调用天融信单点登录获取 serverHello
getLoginRandom(clientHello) getLoginRandom(clientHello)
.then(randomRes => { .then(randomRes => {
console.log('调用 getLoginRandom 方法,接口返回结果为:', randomRes)
if (!randomRes.success) { if (!randomRes.success) {
console.log('调用 getLoginRandom 方法失败,接口返回结果为:', randomRes)
resolve({ resolve({
success: false success: false
}) })
} }
let serverHello = randomRes.data const serverHello = randomRes.data
console.log('serverHello:', serverHello)
// 调用 ukey 获取 ClientAuth // 调用 ukey 获取 ClientAuth
getClientAuth(password, serverHello, clientHello) getClientAuth(password, serverHello, clientHello)
.then(authRes => { .then(authRes => {
console.log('调用 ukey getClientAuth 方法,接口返回结果为:', authRes)
// 暂未用到 // 暂未用到
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
const ClientAuth = authRes.clientAuth const ClientAuth = authRes.clientAuth
if (authRes.result !== 0) { if (authRes.result !== 0) {
console.log('调用 ukey getClientAuth 方法失败,接口返回结果为:', authRes)
ElMessage({ message: authRes.message, type: 'error' }) ElMessage({ message: authRes.message, type: 'error' })
resolve({ resolve({
success: false success: false
@ -45,7 +54,9 @@ const actions = {
clientHello, clientHello,
serverHello serverHello
}).then(tokenRes => { }).then(tokenRes => {
console.log('调用 trxLogin 方法,接口返回结果为:', tokenRes)
if (!tokenRes.success) { if (!tokenRes.success) {
console.log('调用 trxLogin 方法失败,接口返回结果为:', tokenRes)
resolve({ resolve({
success: false success: false
}) })
@ -54,10 +65,12 @@ const actions = {
}) })
}) })
.catch(err => { .catch(err => {
console.log('调用 ukey getClientAuth 方法 [catch] ,接口返回结果为:', err)
reject(err) reject(err)
}) })
}) })
.catch(err => { .catch(err => {
console.log('调用 getLoginRandom 方法 [catch] ,接口返回结果为:', err)
reject(err) reject(err)
}) })
}) })

View File

@ -145,12 +145,17 @@ async function handleUkeyLogin() {
if (!loginFormRef.value) return if (!loginFormRef.value) return
loginFormRef.value.validate(async valid => { loginFormRef.value.validate(async valid => {
if (valid) { if (valid) {
console.log('UKEY: 密码校验通过')
console.log('store', store)
loading.value = true loading.value = true
const res = await store.dispatch('ukey/Login', loginForm.ukeyPassword).finally(() => (loading.value = false)) const res = await store.dispatch('ukey/Login', loginForm.ukeyPassword).finally(() => (loading.value = false))
if (res && res.success) { if (res && res.success) {
console.log('UKEY: 登录成功,云管融合登录接口返回', res)
// ukey // ukey
setUkeyPassword(loginForm.ukeyPassword) setUkeyPassword(loginForm.ukeyPassword)
goLogin(res.data) goLogin(res.data)
} else {
console.log('UKEY: 登录失败,云管融合登录接口返回', res)
} }
} }
}) })