import {HttpClient} from "@angular/common/http";
import {Injectable} from "@angular/core";
import {Observable} from "rxjs/Observable";
import {AppGlobal} from "../../../service/http.service";
import {CommonService} from "../../../provide/common.service";

@Injectable()
export class LearnService{

    constructor(private http:HttpClient,private commonSer:CommonService){}

    //测试列表
    getLearnTestList(data): Observable<any>{
       return this.http.post(AppGlobal.domain+'/wisdomgroup/modules/learnTest/getLearnTestList',this.commonSer.toFormData(data) );
    }

    //获取测试信息
    startTest(data): Observable<any>{
        return this.http.post(AppGlobal.domain+'/wisdomgroup/modules/learnTest/startTest',this.commonSer.toFormData(data) )
    }

    //提交测试结果
    submitPaper(data): Observable<any>{
        return this.http.post(AppGlobal.domain+'/wisdomgroup/modules/learnTest/submitPaper',data)
    }

    //查看测试页面
    viewTestResult(data): Observable<any>{
        return this.http.post(AppGlobal.domain+'/wisdomgroup/modules/learnTest/viewTestResult',this.commonSer.toFormData(data));
    }

    //查看题目页面
    viewAnswerDetail(data): Observable<any>{
        return this.http.post(AppGlobal.domain+'/wisdomgroup/modules/learnTest/viewAnswerDetail',this.commonSer.toFormData(data));
    }

    //纠错
    questionCorrecting(data): Observable<any>{
        return this.http.post(AppGlobal.domain+'/wisdomgroup/learntest/questionCorrecting/submit',data);
    }

    //top5
    getTop5(data): Observable<any>{
        return this.http.get(AppGlobal.domain+'/wisdomgroup/modules/learnPcTest/top/' + data);
    }

    //待批阅列表
    getMarkList(data): Observable<any>{
        return this.http.post(AppGlobal.domain+'/wisdomgroup/modules/testManage/getMarkList' , data);
    }

    //提交批阅结果
    submitMarkResult(data): Observable<any>{
        return this.http.post(AppGlobal.domain+'/wisdomgroup/modules/testManage/submitMarkResult' , data);
    }
}