import http from '@/apis/user/axios'
import urlConfig from '@/apis/url-config'
import { getToken } from '@/utils/auth'
// 登录
export function login(data) {
  return http({
    url: `${urlConfig.baseURL}admin/login/login`,
    method: 'post',
    data
  })
}

export function requestMenus(data = {}){
  return http({
    url: `${urlConfig.baseURL}admin/menu/query`,
    method: 'post',
    data
  })
}

// 获取个人信息
export function userinfo(data) {
  return http({
    url: `${urlConfig.baseURL}admin/login/index`,
    method: 'post',
    data
  })
}

// 获取用户权限导航列表
export function menuList(data) {
  return http({
    url: `${urlConfig.baseURL}admin/menu`,
    method: 'post',
    data
  })
}
// 钉钉获取用户信息
export function dingdingdetail(data) {
  return http({
    url: `${urlConfig.baseURL}Api/dintalk`,
    method: 'post',
    data
  })
}
// 获取账号详情
export function usergetinfo(data) {
  const _data = {
    ...data,
   // noRelation: true
  }
  return http({
    url: `${urlConfig.baseURL}admin/login/index`,
    method: 'post',
    data: _data
  })
}

// 获取角色流程节点详情
export function roleProcessInfo(data) {
  const _data = {
    ...data,
    noRelation: true
  }

  return http({
    url: `${urlConfig.baseURL}admin/role_process_detail`,
    method: 'post',
    data: _data
  })
}

// 获取角色详情
export function reuqsetRoleInfo(data) {
  const _data = {
    ...data,
    noRelation: true
  }

  return http({
    url: `${urlConfig.baseURL}admin/roleinfo`,
    method: 'post',
    data: _data
  })
}

// 获取用户的企业列表
export function requsetCompanyList(data) {
  return http({
    url: `${urlConfig.baseURL}admin/businesslist`,
    method: 'post',
    data
  })
}

// 超管用户获取所有企业列表
export function requsetSupertubeCompany(data) {
  return http({
    url: `${urlConfig.baseURL}admin/comprehensiveList`,
    method: 'post',
    data
  })
}

// 普通用户获取绑定的企业列表
export function requsetUserBindingCompany(data) {
  const _data = {
    ...data,
    noRelation: true
  }

  return http({
    url: `${urlConfig.baseURL}admin/myCompanyList`,
    method: 'post',
    data: _data
  })
}
