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;