// 以下代码在build时自动移除，无需手动注释
// #ifdef DEV
// import './user/tmp'
// #endif
import type {User} from './user/index.d'

// let obj = {}
// if (!location.href.includes('txwx.txhlwxx.com')) {
//     obj = { "user_id": "648945", "user_name": "ces - zhao", "user_realname": "测试 - 局", "user_password": "fe577067f63c87bdfff1e968611bef25db0aed58", "user_group_id": "0", "user_role_id": "3", "user_role_id_ext": "13", "user_role_id_ext_now": "13", "user_level_id": "1", "user_detail_id": null, "user_score": "36", "modify_dateline": "1681365180", "create_dateline": "1678352534", "isdelete": "0", "area_id1": "0", "area_id2": "0", "area_id3": "0", "area_id4": "0", "sm_id": "0", "sm_admin": "0", "cm_id": "0", "cm_admin": "0", "user_phone": "18622222222", "phone_validation": "0", "parent_user_id": null, "user_nickname": null, "user_avatar": "https://txwxopenapi.bozedu.top/data/upload/month_202303/202303160949471460_AFjp.jpg", "user_email": "123@abc.com", "email_validation": "0", "email_token": null, "email_token_exptime": null, "ischeck": "1", "student_no": "", "address": "", "gender": "1", "about": "特长,自我介绍", "qq": null, "openid": "", "webchatopenid": null, "user_level": "0", "user_birthday": "", "grade_id": null, "create_user_id": null, "user_dept": "", "user_cardno": "", "dept_id": "", "user_eyear": "0", "user_grade_num": "0", "user_class_num": "0", "last_token": null, "last_login": null, "graduation": "0", "token": "3e4a3_bXfR3tHwj_awgZ18QRDh12_a94YiRwMhxYnVD65AzHXeZSIVC0BRfxZPF2ZMTTpvWgtEuuW1kpmyUw0_b8gJTBQKl3qXhRFuoaOA", "unread_message": 1 }
// } else {
//     obj = { "user_id": "100", "user_name": "tyyxadmin", "user_realname": "局管理", "user_password": "b923bc037bffebe673963ddd046c7306990ea7aa", "user_group_id": "1", "user_role_id": "69", "user_level_id": "1", "user_detail_id": null, "user_score": "0", "modify_dateline": "1616403054", "create_dateline": "1616403054", "isdelete": "0", "area_id1": "0", "area_id2": "0", "area_id3": "0", "area_id4": "0", "sm_id": "0", "sm_admin": "0", "cm_id": "0", "cm_admin": "0", "user_phone": "", "phone_validation": "0", "parent_user_id": null, "user_nickname": null, "user_avatar": "https://ossdownload.bozedu.net/template/default/static/img/avatar_student_small.png", "user_email": null, "email_validation": "0", "email_token": null, "email_token_exptime": null, "ischeck": "1", "student_no": null, "address": null, "gender": null, "about": null, "qq": null, "openid": "", "webchatopenid": null, "user_level": "1", "user_birthday": "", "grade_id": null, "create_user_id": null, "user_dept": "", "user_cardno": null, "dept_id": "", "user_eyear": "0", "user_grade_num": "0", "user_class_num": "0", "last_token": null, "last_login": null, "token": "64a5_b2I0GhYAUomxgvZDqnXTguluNKxn7PiFrcgq3NWtDPH7Nxng4DSTA4vkP07hYv5Lz4fowsZxfnKrJBRIuMSXC9ChtfMiJA" }
// }

export const user = ref<User>(JSON.parse(sessionStorage.getItem('userInfo') ?? '{}'))
// export const user = ref<User>(JSON.parse(sessionStorage.getItem('userInfo')))

watch(
    () => user.value,
    (val) => {
        sessionStorage.setItem('userInfo', JSON.stringify(val))
    },
)

export const loginShow = ref(false)
