Browse Source

chore: 优化客户端登陆

master
wangxiang 2 years ago
parent
commit
fff8542395
No known key found for this signature in database
GPG Key ID: 1BA7946AB6B232E4
  1. 4
      src/store/modules/lock.ts
  2. 5
      src/store/modules/user.ts

4
src/store/modules/lock.ts

@ -37,7 +37,7 @@ export const useLockStore = defineStore({ @@ -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({ @@ -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'
});

5
src/store/modules/user.ts

@ -23,6 +23,7 @@ import { useGlobSetting } from '/@/hooks/setting'; @@ -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<User>;
@ -115,9 +116,11 @@ export const useUserStore = defineStore({ @@ -115,9 +116,11 @@ export const useUserStore = defineStore({
// 处理自定义授权客户端
if (clientId) {
const client = getAuthClient(clientId);
!isEmpty(client) && Object.assign({}, loginParams.options, {
!isEmpty(client) && merge(loginParams, {
options: {
clientId: client[0],
clientSecret: client[1]
}
});
}
const data = await login(loginParams);

Loading…
Cancel
Save