import fetch from '@/common/fetch.js';
import BASE_URL from './base.js';

const USER_REGISTER = BASE_URL + '/webserver/userInfo/saveUserRegInfo.do'
const USER_LOGIN = BASE_URL + '/webserver/userInfo/verifyUserLoginInfo.do'
const USER_UPDATE = BASE_URL + '/webserver/userInfo/modifyPersonPassword.do'
const ENCRYPT = BASE_URL + '/webserver/secretController/encrypt'
const DECRYPR = BASE_URL + '/webserver/secretController/decrypt'
const CODE = BASE_URL + '/webserver/captchaController/generateVerifyCodeOfReport.do'
// 用户注册
export function registerUser(data) {
	return fetch.post(USER_REGISTER, data, {}, {'content-type': 'application/x-www-form-urlencoded'}).then(res => res);
}
// 用户登录
export function loginUser(data) {
	return fetch.post(USER_LOGIN, data, {}, {'content-type': 'application/x-www-form-urlencoded'}).then(res => res);
}
// 用户修改密码
export function updateUser(data) {
	return fetch.post(USER_UPDATE, data, {}, {'content-type': 'application/x-www-form-urlencoded'}).then(res => res);
}
// 加密接口
export function encryption(data) {
	return fetch.post(ENCRYPT, {str: data, token: ''}, {}, {'content-type': 'application/x-www-form-urlencoded'}).then(res => res);
}
// 解密接口
export function decryption(data) {
	return fetch.post(DECRYPR, {str: data, token: ''}, {}, {'content-type': 'application/x-www-form-urlencoded'}).then(res => res);
}
// 获取验证码图片
export function getCode(data) {
	return fetch.post(`${CODE}?timeStr=${new Date().getTime()}`, {index: '0.6261334077388199'}, {}, {'content-type': 'application/x-www-form-urlencoded'}).then(res => res);
}


