import { requestList } from '@/utils/params';
import request from '@/utils/request';

// 后台账号管理

export function TosUserGetAllInfrom(values: any) {
  return request('/tos/user/getAllInfrom', {
    method: 'POST',
    body: JSON.stringify(values),
    headers: { 'Content-Type': 'application/json' },
  });
}
export function TosUsersQuitAndUser(values: any) {
  return request('/tos/users/quitAndUser', {
    method: 'POST',
    body: JSON.stringify(values),
    headers: { 'Content-Type': 'application/json' },
  });
}
export function TosUserLogin(values: any) {
  return request('/tos/user/login/', {
    method: 'POST',
    body: JSON.stringify(values),
    headers: { 'Content-Type': 'application/json' },
  });
}
export function TosUserNewCurrentUser(values: any) {
  return request('/tos/user/newCurrentUser', {
    method: 'POST',
    body: JSON.stringify(values),
    headers: { 'Content-Type': 'application/json' },
  });
}
export function TosCheckAccountUsername(values: any) {
  return request('/tos/checkAccount/username', {
    method: 'POST',
    body: JSON.stringify(values),
    headers: { 'Content-Type': 'application/json' },
  });
}
export function TosAccountPermissionCheckPermission(values: any) {
  return request('/tos/account/permission/checkPermission', {
    method: 'POST',
    body: JSON.stringify(values),
    headers: { 'Content-Type': 'application/json' },
  });
}

// 服务商
export function TosTosServiceProviderGet(values: any) {
  console.log(values);
  // return
  return request('/tos/tosServiceProvider/get', {
    method: 'POST',
    body: JSON.stringify(values),
    headers: { 'Content-Type': 'application/json' },
  });
}
export function TosSecurityGuarderGet(values: any) {
  return request('/tos/securityGuarder/get', {
    method: 'POST',
    body: JSON.stringify(values),
    headers: { 'Content-Type': 'application/json' },
  });
}
export function TosTosServiceProviderSave(values: any) {
  return request('/tos/tosServiceProvider/save', {
    method: 'POST',
    body: JSON.stringify(values),
    headers: { 'Content-Type': 'application/json' },
  });
}

// /tos/community/facilities/fuzzy/query
//配置文件
// const yellowcolor ="\033[40;33m"
// // const bulecolor='\033[40;34m';
// const colorend = "\033[0m"

const headers = { 'Content-Type': 'application/json' };

function Body(values: any) {
  return {
    method: 'POST',
    body: JSON.stringify(values),
    headers: headers,
  };
}

function requestAuto(url: string, values: any) {
  return request(url, Body(values));
}

export function RA(playload: any) {
  console.log('playload参数===========================================', playload);
  var url = requestList[playload.index][0].toString();
  console.log(playload.index + '》【发送请求】' + url + ' ' + requestList[playload.index][1]);
  console.log('参数如下：');
  console.log(playload.body);
  // console.log(JSON.stringify(playload.body))
  return requestAuto(url, playload.body);
}

//新增小区公告接口文件上传 http://47.74.233.180:8651/tos/image/upload imageType  参数值为  tosNotice
