import Service from '../lib/service.js'
import axios from 'axios'
import Config from '../config'

class LoginService extends Service {
  constructor() {
    super()
    axios.defaults.baseURL = Config.Host85
  }

  //登录
  async Login(params = {}) {
    return await this.postAll("Host80","/custom/login", params);
  }

  // 获取登录信息
  async CustomLoginInfo(params = {}) {
    return await this.postAll("Host80","/custom/info", params);
  }

  //登出
  async Logout(params = {}) {
    return await this.post('/user/logout', params)
  }

  //注册
  async Register(params = {}) {
    return await this.postAll("Host80","/custom/register", params);
  }

  //发送邮件验证
  async Code(params = {}) {
    return await this.post('/custom/register/send/code', params)
  }

  //当前国家编码
  async CodeById(params = {}) {
    return await this.postAll("Host80","/country/getCodeByIp", params);
  }

  //语言切换
  async switchLanguage(params = {}) {
    return await this.post('/user/switch/lang', params)
  }

  //忘记密码
  async forgetPwd(params = {}) {
    return await this.post('/user/update/password/send/email', params)
  }

  //修改密码
  async updatePwd(params = {}) {
    return await this.post('/user/update/login/password', params)
  }

  //高风险客户内转提醒list
  async financeTransferRiskRemindList(params = {}) {
    return await this.post('/finance/transfer/risk/remind/list', params)
  }

  //高风险客户内转提醒
  async financeTransferRiskRemindConfirm(params = {}) {
    return await this.post('/finance/transfer/risk/remind/confirm', params)
  }

  //发送邮件验证
  async sendCode(params = {}) {
    return await this.post('/user/login/send/code', params)
  }

  //登录验证方式
  async loginValid(params = {}) {
    return await this.post("/custom/login/valid", params)
  }

  //获取用户附加信息（角色列表）
  async getUserAttachs(params = {}) {
    return await this.post('/user/attachs', params)
  }

  //切换登录身份
  async switchLogin(params = {}) {
    return await this.post('/user/switchLogin', params)
  }
}

export default new LoginService()
