import exp from "constants";
import requestHttp from "../utils/request";

export function registerApi(username, password, data) {
    return requestHttp({
        method: "post",
        url: `api/index/register?email=${username}&password=${password}`,
        data
    })
}

export function loginApi(username, password, data) {
    return requestHttp({
        method: "post",
        url: `api/index/login?language=zh-ch&username=${username}&password=${password}`,
        data
    })
}

//回答注册问答
export function registerAnswerApi(token, data) {
    return requestHttp({
        method: "post",
        url: `api/front/useranswer?token=${token}`,
        data
    })
}

//注册问答详情
export function registerAnwerDetailApi(token, data) {
    return requestHttp({
        method: "post",
        url: `api/front/useranswerlist?token=${token}`,
        data
    })
}

//个人信息
export function getPersonInfo(token) {
    return requestHttp({
        method: "post",
        url: `api/user/info?token=${token}`
    })
}


//问卷列表
export function wenJuanList(token) {
    return requestHttp({
        method: "post",
        url: `api/front/questionnaire?token=${token}`
    })
}

//问卷详情
export function wenJuanDetail(token, qid) {
    return requestHttp({
        method: "post",
        url: `api/front/questionnairedetail?token=${token}&qid=${qid}`
    })
}

//问卷回答
export function wenJuanAnswer(token, qid) {
    return requestHttp({
        method: "post",
        url: `api/front/answer?token=${token}&qid=${qid}`
    })
}

//找回密码
export function zhaoHuiPassword(email) {
    return requestHttp({
        method: "post",
        url: `api/userindex/findpassword?email=${email}`
    })
}

//修改密码
export function changePassword(code, password, email) {
    return requestHttp({
        method: "post",
        url: `api/userindex/editPasswordbyemail?code=${code}&password=${password}&email=${email}`
    })
}

//积分转余额
export function jiFenZhuanYuE(token, point) {
    return requestHttp({
        method: "post",
        url: `api/userindex/pointstobalance?token=${token}&point=${point}`
    })
}

//积分列表
export function jiFenList(token) {
    return requestHttp({
        method: "post",
        url: `api/front/integralslist?token=${token}`
    })
}

//联系我们
export function contactUs(token, name, email, cate, subject, content) {
    return requestHttp({
        method: "post",
        url: `api/front/contact?token=${token}&name=${name}&email=${email}&cate=${cate}&subject=${subject}&content=${content}`
    })
}