import HttpAxios from '@/utils/axios'

const baseUrl = 'http://localhost/api/Customer_Service_Online/login.php'

/**
 * 获取验证码
 */
export const getVerifcationCode = (params: any, config: any) => {
  return HttpAxios.get(
    `${baseUrl}`,
    {
      action: 'login',
      operate: 'verifcation_code',
      ...params
    },
    config
  )
}

/**
 * 验证用户名是否存在
 */
export const isUserNameExit = (params: any, config: any) => {
  return HttpAxios.post(
    `${baseUrl}`,
    {
      action: 'login',
      operate: 'check_uname',
      ...params
    },
    config
  )
}

/**
 * 登录
 */
export const login = (params: any, config: any) => {
  return HttpAxios.post(
    `${baseUrl}`,
    {
      action: 'login',
      operate: 'do_login',
      ...params
    },
    config
  )
}

/**
 * 忘记密码
 */
export const forgotPassword = (params: any, config: any) => {
  return HttpAxios.post(
    `${baseUrl}`,
    {
      action: 'login',
      operate: 'forgot_password',
      ...params
    },
    config
  )
}
