import { isLoginStatus, isShowLogin } from '/@/stores/chatRoom';
|
import { userInfoKey } from '/@/utils/request';
|
import { Local, LoginInfo } from '/@/utils/storage';
|
|
export const LOGIN_CLIENT = 'Web端';
|
|
export const STORED_ACCOUNT_KEY = 'account';
|
/** @description 自动登录账号过期时间,单位天 */
|
// export const ACCOUNT_EXPIRE_DAY = 10 / (24 * 60 * 60); // 10秒转换为天数
|
export const ACCOUNT_EXPIRE_DAY = 7; // 10秒转换为天数
|
|
|
export const createUserInfo = (res: any) => {
|
return {
|
id: res.id,
|
realName: res.real_name,
|
department: res.part,
|
sex: res.sex,
|
note: res.note,
|
userName: res.name,
|
phoneNumber: res.phone,
|
email: res.email,
|
} as any;
|
};
|
|
export const handleAfterLogin = (res: any) => {
|
const userInfo = createUserInfo(res);
|
Local.set(userInfoKey, userInfo);
|
LoginInfo.set(res.hswatersession, userInfo.userName);
|
Local.set('isNewUser', !res?.web_login);
|
isShowLogin.value = false;
|
isLoginStatus.value = true;
|
window.location.reload();
|
};
|