From 2553434bd36175dbe451683b7902bbed2a82e15b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=97=B6=E5=90=AF=E9=BE=99?= Date: Fri, 23 Aug 2024 16:44:39 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=99=BB=E5=87=BA=E6=97=B6=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=A4=A9=E8=9E=8D=E4=BF=A1=20token=20=E4=BC=A0?= =?UTF-8?q?=E5=8F=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/services/trxLogin.js | 4 ++-- src/store/modules/ukey.js | 21 ++++++++++++--------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/services/trxLogin.js b/src/services/trxLogin.js index 4105d2c..4fe4f87 100644 --- a/src/services/trxLogin.js +++ b/src/services/trxLogin.js @@ -16,8 +16,8 @@ export function trxLogin(params) { return request.post('/sms/v1/trx/login', params) } -export function offlineToken() { - return request.post('/sms/v1/trx/logout') +export function offlineToken(trxToken) { + return request.post('/sms/v1/trx/logout', { trxToken }) } // 理想那边给的代码调用 getAuthToken 时需要传 ip,云管目前不传 diff --git a/src/store/modules/ukey.js b/src/store/modules/ukey.js index 3029b5d..276462a 100644 --- a/src/store/modules/ukey.js +++ b/src/store/modules/ukey.js @@ -2,6 +2,7 @@ import { getClientHello, getClientAuth } from 'services/ukeyAuth.js' import { getLoginRandom, trxLogin, offlineToken } from 'services/trxLogin.js' import Cookies from 'js-cookie' import { ElMessage } from 'element-plus' +import { getTrxToken } from 'utils/auth' const state = {} const mutations = {} const actions = { @@ -70,15 +71,17 @@ const actions = { success: true }) // 调用天融信单点退出系统 - // offlineToken().then( - // res => { - // console.log('调用天融信单点退出系统', res) - // resolve(res) - // }, - // err => { - // reject(err) - // } - // ) + const trxToken = getTrxToken() + if (!trxToken) reject(new Error('未找到 trxToken')) + offlineToken(trxToken).then( + res => { + console.log('调用天融信单点退出系统', res) + resolve(res) + }, + err => { + reject(err) + } + ) }) } }