/**答题活动接口 */
import efunRequest from '../util/efunRequest';
import APIConfig from '../res/values/api.json';
function genLessonAPIUrl(path) {
  return APIConfig.course_api_url + path;
}
export default class matchApi {
  /**获取全部赛事 */
  static getRaceAll(grade) {
    return efunRequest.getHttpRequest().params({
      grade
    }).url(genLessonAPIUrl('kt/race/all')).get();
  }
  /**我的赛事 */
  static getMyRace(grade) {
    return efunRequest.getHttpRequest().params({
      grade
    }).url(genLessonAPIUrl('kt/race/my')).get();
  }
  /**获取赛事信息 */
  static getRaceInfo(raceId) {
    return efunRequest.getHttpRequest().url(genLessonAPIUrl('kt/race/info')).params({
      raceId
    }).get();
  }
  /**提交单词答题 */
  static postQuestion(data) {
    return efunRequest.getHttpRequest().url(genLessonAPIUrl('kt/question')).data(data).post();
  }
  /**提交赛事 */
  static postQuestionSubmit(data) {
    return efunRequest.getHttpRequest().url(genLessonAPIUrl('kt/question/submit')).data(data).post();
  }
  /**预约赛事 */
  static postSubscribe(data) {
    return efunRequest.getHttpRequest().url(genLessonAPIUrl('kt/subscribe')).data(data).post();
  }
  /**总排名 */
  static getRankingList(grade) {
    return efunRequest.getHttpRequest().url(genLessonAPIUrl('kt/race/rankingList')).params({
      grade,
      pageSize: 99999
    }).get();
  }
  /**赛事排名 */
  static getRaceRanking(raceId, grade) {
    return efunRequest.getHttpRequest().url(genLessonAPIUrl('kt/race/raceRanking')).params({
      raceId,
      grade,
      pageSize: 99999
    }).get();
  }
  /**新错题本 */
  static getNewMistake(data) {
    return efunRequest.getHttpRequest().params(data).url(genLessonAPIUrl('kt/question/mistakeBook')).get();
  }
  /**是否参赛 */
  static getRaceJoin(raceId) {
    return efunRequest.getHttpRequest().url(genLessonAPIUrl('kt/race/join')).params({
      raceId
    }).get();
  }
}