|
@@ -19,7 +19,7 @@ import { JDragConfigEnum } from '/@/enums/jeecgEnum';
|
|
|
import { RoleEnum } from '/@/enums/roleEnum';
|
|
|
import { useSso } from '/@/hooks/web/useSso';
|
|
|
import { getActions } from '/@/qiankun/state';
|
|
|
-import { AUTO_LOGIN_PASSWORD, AUTO_LOGIN_USERNAME } from '../constant';
|
|
|
+import { MOCK_LOGIN_PASSWORD, MOCK_LOGIN_UESRNAME } from '../constant';
|
|
|
|
|
|
interface UserState {
|
|
|
userInfo: Nullable<UserInfo>;
|
|
@@ -90,9 +90,9 @@ export const useUserStore = defineStore({
|
|
|
return getAuthCache<string>(PWD_KEY);
|
|
|
},
|
|
|
// 目前用户角色列表为空数组,所以使用既定的用户名判断
|
|
|
- getIsAutoLogin() {
|
|
|
- console.log(this.getUserInfo.username === AUTO_LOGIN_USERNAME);
|
|
|
- return this.getUserInfo.username === AUTO_LOGIN_USERNAME;
|
|
|
+ getIsMockLogin() {
|
|
|
+ console.log(this.getUserInfo.username === MOCK_LOGIN_UESRNAME);
|
|
|
+ return this.getUserInfo.username === MOCK_LOGIN_UESRNAME;
|
|
|
},
|
|
|
},
|
|
|
actions: {
|
|
@@ -371,7 +371,8 @@ export const useUserStore = defineStore({
|
|
|
},
|
|
|
});
|
|
|
},
|
|
|
- async autoLogin(
|
|
|
+ /** 模拟用户登录行为,使用既定的账号,账号权限将受限 */
|
|
|
+ async mockLogin(
|
|
|
params: Partial<LoginParams> & {
|
|
|
goHome?: boolean;
|
|
|
mode?: ErrorMessageMode;
|
|
@@ -379,8 +380,8 @@ export const useUserStore = defineStore({
|
|
|
) {
|
|
|
try {
|
|
|
const loginParams = {
|
|
|
- username: AUTO_LOGIN_USERNAME,
|
|
|
- password: AUTO_LOGIN_PASSWORD,
|
|
|
+ username: MOCK_LOGIN_UESRNAME,
|
|
|
+ password: MOCK_LOGIN_PASSWORD,
|
|
|
checkKey: new Date().getTime(),
|
|
|
...params,
|
|
|
};
|
|
@@ -397,15 +398,15 @@ export const useUserStore = defineStore({
|
|
|
return atob(password);
|
|
|
// return AES.decrypt(password, PWD_KEY).toString();
|
|
|
},
|
|
|
- /** 续登录,即登出后自动登录并刷新当前页面,不需要用户重复登录自动登录账户 */
|
|
|
- async continuallyLogin(
|
|
|
+ /** 续登录,即登出后再次模拟登录并刷新当前页面,不需要用户重复登录"自动"登录账户 */
|
|
|
+ async redoMockLogin(
|
|
|
params: Partial<LoginParams> & {
|
|
|
goHome?: boolean;
|
|
|
mode?: ErrorMessageMode;
|
|
|
} = {}
|
|
|
) {
|
|
|
await this.logout();
|
|
|
- await this.autoLogin({
|
|
|
+ await this.mockLogin({
|
|
|
goHome: false,
|
|
|
...params,
|
|
|
});
|