import request from '@/utils/request'
// 题库中心接口
// 教学阶段列表
export function pharseList() {
  return request({
    url: '/front/v2/pharse/list',
    method: 'get',
  })
}

// 课程列表
export function subjectList() {
  return request({
    url: '/front/v2/papers/subjects',
    method: 'get',
  })
}

//  练习-课程列表
export function smartSubjectList() {
  return request({
    url: '/front/v2/subject/list',
    method: 'get',
  })
}

// 试卷学册列表
export function paperGrade(query) {
  return request({
    url: '/front/v2/papers/grades',
    method: 'get',
    params: query,
  })
}

// 练习 -- 年级列表
export function smartGradeList(query) {
  return request({
    url: '/front/v2/grade/list',
    method: 'get',
    params: query
  })
}
// 年级列表
export function gradeList(query) {
  return request({
    url: '/front/v2/papers/listGrade',
    method: 'get',
    params: query
  })
}

// 版本列表
export function editionList(query) {
  return request({
    url: '/front/v2/edition/list',
    method: 'get',
    params: query
  })
}

// 版本列表 新
export function newEditionList(query) {
  return request({
    url: '/front/v2/edition/listOrdered',
    method: 'get',
    params: query
  })
}

// 获得章节树
export function treeList(query) {
  return request({
    url: '/front/v2/chapterTree/list',
    method: 'get',
    params: query
  })
}
// 根据章节获取题库列表
export function listByChapter(query) {
  return request({
    url: '/front/v2/questions/listByChapter',
    method: 'get',
    params: query
  })
}


// 获取类型列表
export function papersTypes(query) {
  return request({
    url: '/front/v2/papers/types',
    method: 'get',
    params: query
  })
}
// 获取地区列表
export function papersAreas(query) {
  return request({
    url: '/front/v2/papers/areas',
    method: 'get',
    params: query
  })
}
// 获取试卷列表
export function papersList(query) {
  return request({
    url: '/front/v2/papers/list',
    method: 'get',
    params: query
  })
}

// 预览试卷
export function preview(query) {
  return request({
    url: 'front/v2/papers/preview',
    method: 'get',
    params: query
  })
}
// 收藏试卷
export function papersCollect(query) {
  return request({
    url: '/front/v2/papers/collect',
    method: 'post',
    params: query
  })
}
// 取消收藏试卷
export function papersCancelCollect(query) {
  return request({
    url: '/front/v2/papers/cancelCollect',
    method: 'post',
    params: query
  })
}

// 年份列表
export function papersYears(query) {
  return request({
    url: '/front/v2/papers/years',
    method: 'get',
    params: query
  })
}

// 根据科目查找题型  /front/v2/questions/listQuestionTypesBySubject
export function qtBySubject(query) {
  return request({
    url: '/front/v2/questions/listQuestionTypesBySubject',
    method: 'get',
    params: query
  })
}
//  获取知识点分类树
export function knowledgeTree(query) {
  return request({
    url: '/front/v2/knowledgeTree/list',
    method: 'get',
    params: query
  })
}

// 根据知识点获取题库列表
export function listByKnowledge(query) {
  return request({
    url: '/front/v2/questions/listByKnowledge',
    method: 'get',
    params: query
  })
}
// 根据章节获取题库类型和数量
export function countByChapter(query) {
  return request({
    url: '/front/v2/questions/countByChapter',
    method: 'get',
    params: query
  })
}

// 根据知识点获取题型数量
export function countByKnowledge(query) {
  return request({
    url: '/front/v2/questions/countByKnowledge',
    method: 'get',
    params: query
  })
}



// 根据章节获取题目数量
export function getQuestionsNumByChapter(query) {
  return request({
    url: '/front/v2/smartPractice/getQuestionsNumByChapter',
    method: 'get',
    params: query
  })
}
// 根据知识点获取题目数量
export function getQuestionsNumByKnowledge(query) {
  return request({
    url: '/front/v2/smartPractice/getQuestionsNumByKnowledge',
    method: 'get',
    params: query
  })
}


// 根据章节获取题目用来练习
export function getQuestionsByChapter(query) {
  return request({
    url: '/front/v2/smartPractice/getQuestionsByChapter',
    method: 'get',
    params: query
  })
}


// 根据知识点获取题目用来练习
export function getQuestionsByKnowledge(query) {
  return request({
    url: '/front/v2/smartPractice/getQuestionsByKnowledge',
    method: 'get',
    params: query
  })
}

// 保存练习
export function savePractice(query) {
  return request({
    url: '/front/v2/smartPractice/savePractice',
    method: 'post',
    params: query
  })
}


// 取消收藏试题
export function queCancelCollect(query) {
  return request({
    url: '/front/v2/questions/cancelCollect',
    method: 'post',
    params: query
  })
}

// 收藏试题
export function queCollect(query) {
  return request({
    url: '/front/v2/questions/collect',
    method: 'post',
    params: query
  })
}


// 查询组卷记录
export function paperRecords(query) {
  return request({
    url: '/front/v2/papers/paperRecords',
    method: 'get',
    params: query
  })
}

// 获取试题蓝记录
export function getQuestionCardList(query) {
  return request({
    url: '/front/v2/papers/getQuestionCardList',
    method: 'get',
    params: query
  })
}
// 保存试题栏
export function editQuestionCard(query) {
  return request({
    url: '/front/v2/papers/editQuestionCard',
    method: 'post',
    data: query,
  })
}
// 清空试题栏
export function deleteQuestionCard(query) {
  return request({
    url: '/front/v2/papers/deleteQuestionCard',
    method: 'post',
    data: query,
  })
}


// 清空试题栏
export function deletePaper(query) {
  return request({
    url: '/front/v2/papers/deletePaper',
    method: 'post',
    params: query,
  })
}

// 收藏涉及的学科, type: question/paper

export function favSubjects(query) {
  return request({
    url: '/front/v2/favorites/subjects',
    method: 'get',
    params: query,
  })
}

// 收藏涉及的题型
export function favQueTypes(query) {
  return request({
    url: '/front/v2/favorites/qtypes',
    method: 'get',
    params: query,
  })
}

// 收藏的问题列表
export function favQuestions(query) {
  return request({
    url: '/front/v2/favorites/questions',
    method: 'get',
    params: query,
  })
}

// 收藏的试卷列表
export function favPapers(query) {
  return request({
    url: '/front/v2/favorites/papers',
    method: 'get',
    params: query,
  })
}


// 错题涉及的题型
export function wrongTypes(query) {
  return request({
    url: '/front/v2/wrongBook/qtypes',
    method: 'get',
    params: query,
  })
}

// 错题涉及的学科
export function wrongSubjects(query) {
  return request({
    url: '/front/v2/wrongBook/subjects',
    method: 'get',
    params: query,
  })
}


// 错题列表
export function wrongQuestions(query) {
  return request({
    url: '/front/v2/wrongBook/wrongQuestions',
    method: 'get',
    params: query,
  })
}

// 删除错题
export function deleteWrongQuestion(query) {
  return request({
    url: '/front/v2/wrongBook/deleteWrongQuestion',
    method: 'post',
    params: query,
  })
}

// 数据统计（总）
export function summary(query) {
  return request({
    url: '/front/v2/studyRecord/summary',
    method: 'get',
    params: query,
  })
}


// 数据统计-做题数量-按天
export function questionStatsByDay(query) {
  return request({
    url: '/front/v2/studyRecord/questionStatsByDay',
    method: 'get',
    params: query,
  })
}

//  数据统计-做题数量-按学科
export function questionStatsBySubject(query) {
  return request({
    url: '/front/v2/studyRecord/questionStatsBySubject',
    method: 'get',
    params: query,
  })
}
// 数据统计-视频观看时长 - 按天
export function videoStatsByDay(query) {
  return request({
    url: '/front/v2/studyRecord/videoStatsByDay',
    method: 'get',
    params: query,
  })
}

// 数据统计-视频观看时长 - 按学科
export function videoStatsBySubject(query) {
  return request({
    url: '/front/v2/studyRecord/videoStatsBySubject',
    method: 'get',
    params: query,
  })
}


// 视频学习记录
export function videoWatchRecords(query) {
  return request({
    url: '/front/v2/studyRecord/videoWatchRecords',
    method: 'get',
    params: query,
  })
}

// 知识点诊断记录
export function knowRecords(query) {
  return request({
    url: '/front/v2/studyRecord/knowledgeDiagnoseRecords',
    method: 'get',
    params: query,
  })
}

// 知识点诊断记录
export function isCollected(query) {
  return request({
    url: '/front/v2/papers/isCollected',
    method: 'get',
    params: query,
  })
}

// 添加题目到试题栏
export function addToQuestionCard(query) {
  return request({
    url: '/front/v2/papers/addToQuestionCard',
    method: 'post',
    params: query,
  })
}

// 获取最底层的知识点
export function listBottoms(query) {
  return request({
    url: '/front/v2/knowledgeTree/listBottoms',
    method: 'get',
    params: query,
  })
}

// 保存试卷
export function savePaperInfo(query) {
  return request({
    url: '/front/v2/papers/savePaperInfo',
    method: 'post',
    data: query,
  })
}

// 根据题目类型和数量获取题目
export function getQuestionsByQTypeAndNum(data) {
  return request({
    url: '/front/v2/papers/getQuestionsByQTypeAndNum',
    method: 'post',
    data: data,
  })
}

// 根据章节获取知识点
export function knowByChapter(query) {
  return request({
    url: '/front/v2/knowledgeTree/listByChapter',
    method: 'get',
    params: query,
  })
}

// 获取诊断记录
export function diagnosticRecords(query) {
  return request({
    url: '/front/v2/smartPractice/diagnosticRecords',
    method: 'get',
    params: query,
  })
}

// /prod-api/web/student/resources/getResources
// 前端 学生资源库列表
export function getResources(query) {
  return request({
    url: '/web/student/resources/getResources',
    method: 'get',
    params: query,
  })
}

// 根据数组获取题目
export function getQuestionsByIds(query) {
  return request({
    url: '/front/v2/questions/getQuestionsByIds',
    method: 'get',
    params: query,
  })
}


//诊断详情
export function diagnosticRecordsDetail(query) {
  return request({
    url: '/front/v2/smartPractice/diagnosticRecordsDetail',
    method: 'get',
    params: query,
  })
}
//获取题目信息
export function getQuestionInfo(query) {
  return request({
    url: '/front/v2/questions/getQuestionInfo',
    method: 'get',
    params: query,
  })
}

export function xkcxlist(query) {
  return request({
    url: '/front/syzy/xkcx/list',
    method: 'get',
    params: query,
  })
}

export function xkcxlistByMarjors(query) {
  return request({
    url: '/front/syzy/xkcx/list',
    method: 'get',
    params: query,
  })
}


export function drawInferences(query) {
  return request({
    url: '/front/v2/smartPractice/drawInferences',
    method: 'get',
    params: query,
  })
}


export function xkcxYears(query) {
  return request({
    url: '/front/syzy/xkcx/years',
    method: 'get',
    params: query,
  })
}

export function collectAdd(query) {
  return request({
    url: '/front/syzy/xkcx/collect/add',
    method: 'get',
    params: query,
  })
}

export function collectRemove(query) {
  return request({
    url: '/front/syzy/xkcx/collect/remove',
    method: 'get',
    params: query,
  })
}
export function universityFilters(query) {
  return request({
    url: '/front/university/filters',
    method: 'get',
    params: query,
  })
}
export function marjorsList(query) {
  return request({
    url: '/front/marjors/list',
    method: 'get',
    params: query,
  })
}

export function xkcxScheme(query) {
  return request({
    url: '/front/syzy/xkcx/scheme',
    method: 'get',
    params: query,
  })
}
export function schemeAdd(query) {
  return request({
    url: '/front/syzy/xkcx/scheme/add',
    method: 'post',
    data: query,
  })
}

export function getMyXkcx(query) {
  return request({
    url: '/front/syzy/xkcx/my',
    method: 'get',
    params: query,
  })
}

export function schemeDf(query) {
  return request({
    url: '/front/syzy/xkcx/scheme/df',
    method: 'get',
    params: query,
  })
}
export function schemeDfRemove(query) {
  return request({
    url: '/front/syzy/xkcx/scheme/remove',
    method: 'get',
    params: query,
  })
}
export function saveSelectCourse(query) {
  return request({
    url: '/front/syzy/xkcx/saveSelectCourse',
    method: 'get',
    params: query,
  })
}


// /prod-api/front/v2/papers/saveToPersonResources
// 保存到个人资料库(课件资源)
export function saveToPersonResources(paperId) {
  return request({
    url: '/front/v2/papers/saveToPersonResources',
    method: 'post',
    params: {
      paperId
    },
  })
}

// /prod-api/front/v2/papers/listCustomerPaperQeustions
// 查询组卷题目
export function listCustomerPaperQeustions(paperId) {
  return request({
    url: '/front/v2/papers/listCustomerPaperQeustions',
    method: 'get',
    params: {
      paperId
    },
  })
}

// /prod-api/front/v2/papers/download
// 下载试卷
export function download(paperId, period) {
  const baseURL = process.env.VUE_APP_BASE_API
  const downloadUrl = baseURL + '/front/v2/papers/download?paperId=' + paperId + "&period=" + period
  window.location.href = downloadUrl
}



// /prod-api/front/v2/papers/updateNameById
// 修改试卷标题
export function updateNameById(paperId, paperName) {
  return request({
    url: '/front/v2/papers/updateNameById',
    method: 'post',
    params: {
      paperId: paperId,
      name: paperName
    },
  })
}

// .填报批次
export function zytbBatches(query) {
  return request({
    url: '/front/syzy/zytb/batches',
    method: 'get',
    params: query,
  })
}

// .填报批次
export function zytbMarjor(query) {
  return request({
    url: '/front/syzy/zytb/marjor',
    method: 'get',
    params: query,
  })
}

export function zytbUniversity(query) {
  return request({
    url: '/front/syzy/zytb/university',
    method: 'get',
    params: query,
  })
}

export function zytbSave(data) {
  return request({
    url: '/front/syzy/zytb/save',
    method: 'post',
    data: data,
  })
}

export function zytbFilter(batch) {
  return request({
    url: '/front/syzy/zytb/university/filters',
    method: 'get',
    params: { batch }
  })
}

// /prod-api/front/v2/papers/downloadRealPaper
// 下载真題试卷
export function downloadRealPaper(paperId, period) {
  const baseURL = process.env.VUE_APP_BASE_API
  const downloadUrl = baseURL + '/front/v2/papers/downloadRealPaper?paperId=' + paperId + "&period=" + period
  window.location.href = downloadUrl
}


