/*
 * @Author: lixg lixg@dongwu-inc.com
 * @Date: 2022-11-07 17:06:45
 * @LastEditors: lixg lixg@dongwu-inc.com
 * @LastEditTime: 2022-11-21 16:39:00
 * @FilePath: /fe-manage/src/api/index.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import http from "./config";
// import qs from 'qs';


/**
 * 接口传参数方式（get）
 * axios.get('/user', {
 *  params: {  
 *      id: 12345，
 *     name: user
 *  }
 * }).then(res => console.log(res))
 *
 * 接口传参三种方式（post/put/patch）
 *
 * 1.'Content-Type'= 'multipart/form-data'，传参格式为 formData。
 * （全局请求头:'Content-Type'= 'application/x-www-form-urlencoded'）
 * （request的Header:'Content-Type'= 'multipart/form-data'）
 * var formData=new FormData();
 * formData.append('user',123456);formData.append('pass',12345678);
 * axios.post("/notice",formData).then()
 *
 * 2.'Content-Type'= 'application/x-www-form-urlencoded'，传参格式为 query 形式,使用$qs.stringify。
 * （全局请求头:'Content-Type'= 'application/x-www-form-urlencoded'）
 * （request的Header:'Content-Type'= 'application/x-www-form-urlencoded'）
 * let data = {"code":"1234","name":"yyyy"};
 * axios.post(`${this.$url}/test/testRequest`,qs.stringify({data})).then()
 *
 * 3.'Content-Type'= 'application/json，传参格式为 raw (JSON格式)。
 * （全局请求头:'Content-Type'= 'application/x-www-form-urlencoded'）
 * （request的Header:'Content-Type'= 'application/json;charset=UTF-8'）
 * let data = {"code":"1234","name":"yyyy"}
 * axios.post(`${this.$url}/test/testRequest`,data).then()
 *
 */


// 接口-请求

// 创建编辑单层项目（type=3）/ 多层项目（type=1）/ 多层子项目（type=2）
export const createProject = (obj) => http.post('/admin/project/edit', obj)

// 获取项目列表
export const getProjectList = (obj) => http.post('/admin/project/list', obj)

// 获取项目详情信息（包含阶段及任务列表）
export const getProjectDetail = (obj) => http.get('/admin/project/detail', {params: obj})
//发布项目
export const releaseProject = (obj) => http.post('/admin/project/publish', obj)
//获取项目学员
export const projectStudent = (obj) => http.post('/admin/project/studentList', obj)
export const projectStudentCount = (obj) => http.get('/admin/student/getStudentCount', {params: obj})
//撤回发布、结束
export const handleProject = (obj) => http.post('/admin/project/handle', obj)

//获取任务管理列表
export const taskStudentList = (obj) => http.post('/admin/project/taskStudentList', obj)


//获取讨论信息
export const getDiscussDetail = (obj) => http.post('/discuss/getDiscussDetail', obj)

//获取模版列表
export const getTemplate = (obj) => http.post('/admin/project/template/list', obj)
//获取模版详细信息
export const getTemplateDetail = (obj) => http.get('/admin/project/template/detail', {params: obj})

//获取项目统计
export const getProjectCount = (projectId) => http.get('/admin/project/projectCount', {params: {projectId: projectId}})

export const login = (obj) => http.post('/admin/CheckUser/userLogin', obj)
export const userInfo = () => http.get('/admin/CheckUser/userInfo')

