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

const CREATE_URL = BASE_URL + '/webserver/reportInfos/weburlChange'
const URL_REPEAT = BASE_URL + '/webserver/reportInfos/websiteUrlRepeat.do'
const UPLOAD_PICTURE = BASE_URL + 'webserver/fileUploadController/uploadToLocal'
const WEB_REPORT = BASE_URL + '/webserver/reportInfos/submitReportInfos.do'
// const OTHER_REPORT = BASE_URL + '/webserver/reportInfos/submitReportInfos.do'
// const SPECIAL_REPORT = BASE_URL + '/webserver/reportInfos/submitReportInfos.do'
const GET_CODE_URL = BASE_URL + '/webserver/captchaController/generateVerifyCodeOfReport.do'
const REPORT_LIST = BASE_URL + '/webserver/reportInfo/queryPersonReportedInfo.do'
const REPORT_DETAIL = BASE_URL + '/webserver/reportInfos/shortcutQueryReportInfo.do'
const GET_SPECIAL = BASE_URL + '/webserver/reportInfos/queryTopicList.do'
/**
 * 生成网址、网址转换
 * @param {*}  // url: ''
 */
export function createUrl(data) { 
  return fetch.get(CREATE_URL, data).then(res => res);
}

// 网址重复验证 reportWebsiteUrl: ''
export function websiteUrlRepeat(data) {
  return fetch.get(URL_REPEAT, data).then(res => res);
}

// 网站类型举报
export function webReport(data) {
	return fetch.get(WEB_REPORT, data).then(res => res);
}
export function webReportPost(data) {
	return fetch.post(WEB_REPORT, data, {}, { 'Content-Type': 'application/x-www-form-urlencoded'}).then(res => res);
}
// // 其他类型举报
// export function otherReport(data) {
// 	return fetch.get(OTHER_REPORT, data).then(res => res);
// }
// // 专项举报
// export function specialReport(data) {
// 	return fetch.get(SPECIAL_REPORT, data).then(res => res);
// }
// 获取验证码
export function getCodeURl() {
	const data = {
		timeStr: new Date().getTime()
	}
	return fetch.get(GET_CODE_URL, data).then(res => res);
}
// 举报列表
export function getReportList(data) {
	return fetch.post(REPORT_LIST, data, {}, {'content-type': 'application/x-www-form-urlencoded'}).then(res => res);
}
// 举报详情
export function getReportDetail(data) {
	return fetch.post(REPORT_DETAIL, data, {}, {'content-type': 'application/x-www-form-urlencoded'}).then(res => res);
}

// 获取专题
export function getSpecial(data) {
	return fetch.get(GET_SPECIAL, data).then(res => res);
}


