From fff8542395bf94a53a93b71a4567397475d104e9 Mon Sep 17 00:00:00 2001 From: wangxiang <1827945911@qq.com> Date: Fri, 11 Aug 2023 11:56:16 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E4=BC=98=E5=8C=96=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E7=AB=AF=E7=99=BB=E9=99=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/lock.ts | 4 ++-- src/store/modules/user.ts | 13 ++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/store/modules/lock.ts b/src/store/modules/lock.ts index 7ac50e9..508109f 100644 --- a/src/store/modules/lock.ts +++ b/src/store/modules/lock.ts @@ -37,7 +37,7 @@ export const useLockStore = defineStore({ this.lockInfo = null; }, /** 解锁锁屏 */ - async unLock(password?: string) { + async unLock(password: string) { const userStore = useUserStore(); // 浏览器存在当前锁屏信息缓存,直接比对当前用户密码 if (this.lockInfo?.pwd === password) { @@ -52,7 +52,7 @@ export const useLockStore = defineStore({ userStore.setRefreshToken(''); const res = await userStore.login({ username, - password: password!, + password: password, goHome: false, clientId: 'kicc_lock' }); diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index 15d45fd..81d1aa7 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -23,6 +23,7 @@ import { useGlobSetting } from '/@/hooks/setting'; import { isUrl, isEmpty } from '/@/utils/is'; import { h } from 'vue'; import { getAuthClient } from '/@/utils'; +import { merge } from 'lodash-es'; interface UserState { userInfo: Nullable; @@ -114,11 +115,13 @@ export const useUserStore = defineStore({ const { goHome = true, clientId = '', ...loginParams } = params; // 处理自定义授权客户端 if (clientId) { - const client = getAuthClient(clientId); - !isEmpty(client) && Object.assign({}, loginParams.options, { - clientId: client[0], - clientSecret: client[1] - }); + const client = getAuthClient(clientId); + !isEmpty(client) && merge(loginParams, { + options: { + clientId: client[0], + clientSecret: client[1] + } + }); } const data = await login(loginParams); const { access_token, refresh_token } = data;