import type {IUser} from './user'

// 以下代码在build时自动移除，无需手动注释
// #ifdef DEV
localStorage.setItem('userInfo', JSON.stringify({
  "user_id": "213558",
  "user_name": "bozuser69",
  "email": "无",
  "lastlogintime": "2023-05-10 13:35:31",
  "regdate": "2020-04-14 14:01:11",
  "status": "0",
  "user_role_id": "69",
  "user_role_name": "区县管理员",
  "user_avatar": {
    "big": "https://openapi.dev.bozedu.net/template/default/static/img/avatar_teacher_big.png",
    "middle": "https://openapi.dev.bozedu.net/template/default/static/img/avatar_teacher_middle.png",
    "small": "https://openapi.dev.bozedu.net/template/default/static/img/avatar_teacher_small.png"
  },
  "user_no": {"no_title": "学号", "no": ""},
  "token": "f842MX83zJZkuqk8Q_blBD9kmZDaNkpzn70vbQkWvsWiqN9F63l4EXuwvfs_bjql3aSG9jkkBF08YOxGjL1cvM_a7_bk8gs",
  "user_realname": "博智测试区县",
  "user_phone": "",
  "idcard": "",
  "gender": "1",
  "gender_char": "男",
  "qq": "无",
  "nationality": "",
  "intro": "",
  "address": "",
  "education": "",
  "area_info": {
    "area_id1": "10",
    "area_id2": "166",
    "area_id3": "2074",
    "area_id4": "0",
    "area_id1_char": "江苏省",
    "area_id2_char": "苏州市",
    "area_id3_char": "相城区",
    "area_id4_char": "",
    "area_code1": "320000000000",
    "area_code2": "320500000000",
    "area_code3": "320507000000",
    "area_code4": "",
    "area_code_dist": "320507000000"
  },
  "sm_info": {
    "sm_id": "0",
    "sm_name": "",
    "adminid": "0",
    "is_org": "0",
    "up_org": "0",
    "area_id1": "0",
    "area_id2": "0",
    "area_id3": "0",
    "area_id4": "0",
    "major_mode": "0",
    "powers": {"vip_shiti": "1", "vip_sucai": "1", "vip_aicheck": "1"}
  },
  "cm_info": [],
  "first_cm_id": "",
  "first_cm_name": "",
  "related_desc": "全部",
  "bind3rd": {"wechat": "0"},
  "my_org": [],
  "org_info": {
    "org": null,
    "org_id": null,
    "telephone": "",
    "telephone_short": "",
    "is_org": "1",
    "up_org": null,
    "up_org_name": null,
    "up_org_info": {"sm_id": "", "sm_name": ""}
  },
  "pan": {"unit": "G", "size": "0", "used": "0.00", "desc": "无限制"},
  "safe_tips": ["您的密码安全程度较低,请立即修改", "必须包含数字、字母大小写或者特殊字符，长度8位及以上"],
  "update_center": "https://openapi.dev.bozedu.net",
  "base_url": {
    "aboutus": "https://openapi.dev.bozedu.net/aboutus",
    "file": "https://openapi.dev.bozedu.net",
    "vpn": "http://vpn.dev.bozedu.net",
    "uc": "https://uc.dev.bozedu.net",
    "yzy": "https://yzy.dev.bozedu.net",
    "kzkt": "https://openapi.dev.bozedu.net",
    "openapi": "https://openapi.dev.bozedu.net",
    "site_zhkt_api": "http://120.26.51.195:8008",
    "yxxt": "https://yxxt.dev.bozedu.net"
  },
  "role_system": {
    "kzkt": {
      "code": "kzkt",
      "name": "空中课堂",
      "icon": "",
      "cate": "1",
      "type": "1",
      "url": "https://openapi.dev.bozedu.net"
    },
    "yzy": {
      "code": "yzy",
      "name": "作业系统",
      "icon": "",
      "cate": "1",
      "type": "1",
      "url": "https://yzy.dev.bozedu.net"
    },
    "zhkt": {
      "code": "zhkt",
      "name": "智慧课堂",
      "icon": "",
      "cate": "1",
      "type": "2",
      "url": "http://120.26.51.195:8008/desadmin.php"
    }
  },
  "user_score": "70",
  "product": ["课堂", "直播", "作业"],
  "app_url": {
    "A119": "https://qqyxt.m.dev.bozedu.net/page/course/tskc_more.html",
    "A120": "https://qqyxt.m.dev.bozedu.net/page/my/msg_hybrid.html?id=31",
    "A121": "https://qqyxt.m.dev.bozedu.net/page/parent/msg.html",
    "A122": "https://qqyxt.m.dev.bozedu.net/page/my/integral_hybrid.html",
    "A123": "https://qqyxt.m.dev.bozedu.net/ktfx/xqbg.html",
    "A124": "https://qqyxt.m.dev.bozedu.net/page/my/footPrint.html",
    "A125": "https://qqyxt.m.dev.bozedu.net/page/my/intergralMall.html",
    "A126": "https://openapi.dev.bozedu.net/component/ebook_main/public",
    "A127": "https://qqyxt.m.dev.bozedu.net/Course_registration/transfer.html?v=1",
    "A128": "https://qqyxt.m.dev.bozedu.net/Course_registration/transfer.html?type=course_after_service",
    "A129": "https://qqyxt.m.dev.bozedu.net/ktfx/xqbg.html?tab=1",
    "A130": "https://qqyxt.m.dev.bozedu.net/ktfx/xqbg.html?tab=2",
    "A131": "https://qqyxt.m.dev.bozedu.net/ktfx/xqbg.html?tab=3",
    "A132": "https://qqyxt.m.dev.bozedu.net/ktfx/xqbg.html?tab=4"
  },
  "cpm_access_level": "3"
}))
// #endif

export const user = ref<IUser>(JSON.parse(localStorage.getItem('userInfo') ?? '{}'))

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