gerson
2025-02-20 a762b59c2c4b459f72ede19716d476bb3513f622
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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();
};