import axios from '@/utils/http';
import pako from 'pako';
const base = process.env.VUE_APP_SERVER + '/auth';
const auth = {
    get(params: any) {
        return axios.get(`${base}/user/get?user_id=0`, {
        });
    },
    bankcard4c(params: any) {
        return axios.post(`${base}/user/bankcard4c`, {
            ...params,
        });
    },
    face(params: any, cb: (progressEvent: any) => void = (progressEvent: any) => progressEvent) {
        // const { video_base64 }
        // return axios.post(`${base}/user/face`, {
        //     ...params,
        // });
        params = pako.gzip(JSON.stringify(params));
        return axios({
            url: `${base}/user/face`,
            method: 'post',
            headers: {
                'Content-Encoding': 'gzip',
                'Content-Type': 'text',
             },
            data: params, // {...params},
            onUploadProgress:  (progressEvent) => {
                // 对原生进度事件的处理
                cb(progressEvent);
            },
            timeout: 0,
        });
    },
    banks(params: any) {
        return axios.get(`${base}/company/banks`, {
            ...params,
        });
    },
    info(params: any) {
        return axios.get(`${base}/company/info?user_id=0`, {});
    },
    basic(params: any) {
        return axios.post(`${base}/company/basic`, {
            ...params,
        });
    },
    bank(params: any) {
        return axios.post(`${base}/company/bank`, {
            ...params,
        });
    },
    bankNum(params: any) {
        return axios.post(`${base}/company/bankNum`, {
            ...params,
        });
    },
};
export default auth;
