api.js 4.62 KB
import axios from 'axios';

let base = 'https://api.k.wxpai.cn/bizproxy';
// let base = 'https://ow.go.qudone.com';


//formDataHeaders设置
let formDataHeaders = {
  headers: {
    "Content-Type": "multipart/form-data"
  }
}

// get方法demo
export const getDemo = params => {
  return axios.get(`${base}/path1/path2/getdemo`, {
    params: params
  }).then(res => res.data);
};

// post方法demo
export const postDemo = params => {
  return axios.post(`${base}/path1/path2/postdemo`, params).then(res => res.data);
};

// postformdata
export const updatePostformdata = params => {
  return axios.post(`${base}/path1/path2/postformdata`, params, formDataHeaders).then(res => res.data);
};

// 获取视频列表
export const getVideoList = params => {
  return axios.get(`${base}/zcrapi/admin/vedios/list`, {
    params: params
  }).then(res => res.data);
};

// 保存视频
export const saveVideo = params => {
  return axios.post(`${base}/zcrapi/admin/vedios/save`, params).then(res => res.data);
};

// 删除视频
export const deleteVideo = params => {
  return axios.post(`${base}/zcrapi/admin/vedios/delete`, params).then(res => res.data);
};


// 获取文章分类列表
export const getClassifyList = params => {
  return axios.get(`${base}/zcrapi/admin/article/classify/list`, {
    params: params
  }).then(res => res.data);
};


// 获取话题列表
export const getTagList = params => {
  return axios.get(`${base}/zcrapi/admin/article/tag/list`, {
    params: params
  }).then(res => res.data);
};

// 保存话题
export const saveTag = params => {
  return axios.post(`${base}/zcrapi/admin/article/tag/save`, params).then(res => res.data);
};

// 删除话题
export const deleteTag = params => {
  return axios.post(`${base}/zcrapi/admin/article/tag/delete`, params).then(res => res.data);
};

// 获取头图列表
export const getBannerList = params => {
  return axios.get(`${base}/zcrapi/admin/article/banner/list`, {
    params: params
  }).then(res => res.data);
};

// 保存头图
export const saveBanner = params => {
  return axios.post(`${base}/zcrapi/admin/article/banner/save`, params).then(res => res.data);
};

// 删除头图
export const deleteBanner = params => {
  return axios.post(`${base}/zcrapi/admin/article/banner/delete`, params).then(res => res.data);
};

// 删除头图
export const changeBanner = params => {
  console.log("params:", params);
  return axios.post(`${base}/zcrapi/admin/article/banner/change`, params).then(res => res.data);
};


// 获取文章列表
export const getArticleList = params => {
  return axios.get(`${base}/zcrapi/admin/article/list`, {
    params: params
  }).then(res => res.data);
};

// 保存文章
export const saveArticle = params => {
  return axios.post(`${base}/zcrapi/admin/article/save`, params).then(res => res.data);
};

// 删除文章
export const deleteArticle = params => {
  return axios.post(`${base}/zcrapi/admin/article/delete`, params).then(res => res.data);
};


// 获取门店列表
export const getStoreList = params => {
  return axios.get(`${base}/zcrapi/admin/store/list`, {
    params: params
  }).then(res => res.data);
};


// 文件上传 包含图片 postformdata
export const uploadFile = params => {
  return axios.post(`${base}/zcrapi/admin/file/upload`, params, formDataHeaders).then(res => res.data);
};


// 获取门店列表
export const postDashboard = params => {
  return axios.get(`${base}/zcrapi/admin/dashboard`, {
    params: params
  }).then(res => res.data);
};







export const requestLogin = params => {
  return axios.post(`${base}/login`, params).then(res => res.data);
};

export const getUserList = params => {
  return axios.get(`${base}/user/list`, {
    params: params
  }).then(res => res.data);
};

export const getUserListPage = params => {
  return axios.get(`${base}/user/listpage`, {
    params: params
  }).then(res => res.data);;
};

export const removeUser = params => {
  return axios.get(`${base}/user/remove`, {
    params: params
  }).then(res => res.data);;
};

export const batchRemoveUser = params => {
  return axios.get(`${base}/user/batchremove`, {
    params: params
  }).then(res => res.data);
};

export const editUser = params => {
  return axios.get(`${base}/user/edit`, {
    params: params
  }).then(res => res.data);
};

export const addUser = params => {
  return axios.get(`${base}/user/add`, {
    params: params
  }).then(res => res.data);
};


export const dashboardExport = params => {
  // return axios.get(`${base}/user/add`, {
  //   params: params
  // }).then(res => res.data);
  let url = `${base}/zcrapi/admin/dashboard/export` + '?fromDate=' + params.fromDate + '&toDate=' + params.toDate;
  console.log("url:", url);
  window.open(url)
};