import request from '@/utils/request'

export function login(username, password, communityId) {
  const config = {
    url: '/user/login',
    method: 'post',
    data: {
      'loginName': username,
      'code': password,
      'communityId': communityId
    }
  }

  return request(config)
}

export function getInfo() {
  return request({
    url: '/user/info',
    method: 'get'
    // params: { token }
  })
}

// 退出登陆
export function logOut() {
  return request({
    url: '/user/logOut',
    method: 'post'
  })
}

// 发送验证码
export function sendCode(phone) {
  return request({
    url: '/code/sendCode',
    method: 'post',
    params: { phone }
  })
}

// 获取权限集合
export function getPermission() {
  return request({
    url: '/user/permission',
    method: 'get'
  })
}

