import request from '@/utils/request'

// 登录方法
export function login(data) {
    return request({
        url: '/login?type=frontApp',
        method: 'post',
        data: data
    })
}

// 获取用户详细信息
export function getInfo() {
    return request({
        url: '/getInfo',
        method: 'get'
    })
}

// 退出方法
export function logout() {
    return request({
        url: '/logout',
        method: 'post'
    })
}

export function logoutPhysical() {
    return request({
        url: '/logoutPhysical',
        method: 'post'
    })
}

// 获取验证码
export function getCodeImg(params) {
    return request({
        url: '/captchaImage',
        method: 'get',
        params: params
    })
}

// 短信验证码
export function sendSms(params) {
    return request({
        url: '/common/shortMessage/sendSms',
        method: 'post',
        params: params,
        custom: {autoFitNoToken: true}
    })
}

// 验证码校验
export function validateSms(params) {
    return request({
        url: '/common/shortMessage/validateSms',
        method: 'post',
        params: params,
        custom: {withoutToken: true}
    })
}

// 验证码校验
export function improveUserInfo(params) {
    return request({
        url: '/improve',
        method: 'post',
        data: params
    })
}

export function getAreaAndSchool(params) {
    return request({
        url: '/getAreaAndSchool',
        method: 'get',
        params
    })
}

export function getAreaSchoolTree(params) {
    return request({
        url: '/getAreaSchoolTree',
        method: 'get',
        params
    })
}

export function getRegisterGaokaoYears(params) {
    return request({
        url: '/getRegisterGaokaoYears',
        method: 'get',
        params
    })
}

export function sendSmsNoValidation(params) {
    return request({
        url: '/common/shortMessage/sendSmsNoValidation',
        method: 'get',
        data: params,
        custom: {autoFitNoToken: true}
    })
}

export function sendSmsNoValidationNoToken(params) {
    return request({
        url: '/common/shortMessage/sendSmsNoValidationNoToken',
        method: 'get',
        params,
        custom: {withoutToken: true}
    })
}

export function resetCardPassword(params) {
    return request({
        url: '/resetCardPassword',
        method: 'post',
        params: params
    })
}

// 切换角色 changeRole?newRoleId=12
export function changeRole(roleId) {
    return request({
        url: '/changeRole?newRoleId=' + roleId,
        method: 'post'
    })
}

// 注册
export function register(data) {
    return request({
        url: '/register',
        method: 'post',
        data
    })
}

// 绑卡
export function bindCard(data) {
    return request({
        url: '/bindCard',
        method: 'post',
        data
    })
}

// 绑手机
export function bindPhone(data) {
    return request({
        url: '/bindPhone',
        method: 'post',
        data
    })
}

/// 考生类别
export function getExamTypes(params) {
    return request({
        // url: '/getExamTypes',
        url: '/front/comm/dict/exam_type',
        method: 'get',
        params,
        custom: {autoFitNoToken: true}
    })
}

/// 考生专业 - 职高对口
export function getExamMajors(params) {
    return request({
        url: '/getExamMajors',
        method: 'get',
        params,
        custom: {autoFitNoToken: true}
    })
}
