refactor: rename and convert type of args

This commit is contained in:
David 2021-08-16 18:27:07 +08:00
parent c4479cf8ab
commit 15b76f1fd9
4 changed files with 24 additions and 23 deletions

View File

@ -16,6 +16,7 @@ export default class index extends Component {
getAllPaper = () => {
Marking.testList({ userId: this.userId })
.then((res) => {
console.log(res)
if (res.data.status == "10000") {
let papers = [...res.data.data.papers]
this.setState(
@ -33,8 +34,9 @@ export default class index extends Component {
}
getAnswer = () => {
Marking.testAnswer({ userId: this.userId, testId: "1" })
Marking.testAnswer({ userId: this.userId, testId: 1 })
.then((res) => {
console.log(res)
if (res.data.status == "10000") {
this.setState({
keyTest: res.data.data.keyTest
@ -55,7 +57,7 @@ export default class index extends Component {
let testPaper = null;
if (this.state.keyTest != undefined || this.state.keyTest != null) {
testPaper = this.state.keyTest.map((item) => {
return <img src={item.Pic_src} alt="加载失败" className="test-question-img"/>
return <img src={item} alt="加载失败" className="test-question-img"/>
})
}

View File

@ -59,7 +59,7 @@ export default class index extends Component {
}
//
getCurrentPaper = () => {
Marking.testDisplay({ userId: this.userId, testId: this.state.papers[0].Test_id.toString() })
Marking.testDisplay({ userId: this.userId, testId: this.state.papers[0] })
.then((res) => {
if (res.data.status == "10000") {
let currentPaper = JSON.parse(JSON.stringify(res.data.data))
@ -75,9 +75,9 @@ export default class index extends Component {
//
showTest = () => {
let testPaper = null;
if (this.state.currentPaper.picSrcs != undefined) {
testPaper = this.state.currentPaper.picSrcs.map((item) => {
return <img src={item.Pic_src} alt="加载失败" className="test-question-img"/>
if (this.state.currentPaper.testInfos != undefined) {
testPaper = this.state.currentPaper.testInfos.map((item) => {
return <img src={item.pic_src} alt="加载失败" className="test-question-img"/>
})
}
@ -118,12 +118,12 @@ export default class index extends Component {
}
showSelect = () => {
let scoreSelect = null;
if (this.state.currentPaper.picSrcs != undefined) {
if (this.state.currentPaper.testInfos != undefined) {
scoreSelect = this.state.currentPaper.subTopic.map((item,index) => {
return <div className="score-select">
{item.Question_detail_name}<Select key={index} placeholder="请选择分数" style={{ width: 120 }} onSelect={this.select.bind(this,item.Question_detail_id)}>
{item.question_detail_name}<Select key={index} placeholder="请选择分数" style={{ width: 120 }} onSelect={this.select.bind(this,item.test_detail_id)}>
{
this.selectBox(item.Question_detail_score)
this.selectBox(item.question_detail_score)
}
</Select>
</div>
@ -193,11 +193,10 @@ export default class index extends Component {
onOk: () => {
let Qustion_detail_id = Util.getTextByJs(this.state.selectId);
let Question_detail_score = Util.getTextByJs(this.state.selectScore);
console.log()
if (value == 1) {
Marking.testPoint({
userId: this.userId,
testId: this.state.papers[0].Test_id.toString(),
testId: this.state.currentPaper.testId,
scores: Question_detail_score,
testDetailId: Qustion_detail_id
})
@ -226,8 +225,8 @@ export default class index extends Component {
handleOk = () => {
Marking.testProblem({
userId: this.userId,
testId: this.state.papers[0].Test_id.toString(),
problemType: this.state.problemValue.toString()
testId: this.state.currentPaper.testId,
problemType: this.state.problemValue
})
.then((res) => {
this.setState({

View File

@ -19,11 +19,11 @@ export default class index extends Component {
.then((res) => {
if (res.data.status == "10000") {
let reviewList = []
for (let i = 0; i < res.data.data.records.length; i++) {
for (let i = 0; i < res.data.data.testId.length; i++) {
reviewList.push({
order: i+1,
test_id: res.data.data.records[i].Test_id,
score: res.data.data.records[i].Score
test_id: res.data.data.testId[i],
score: res.data.data.score[i]
})
}
this.setState({

View File

@ -39,16 +39,16 @@ export default class index extends Component {
})
}
getSampleList = () => {
Marking.testExampleList({ userId: this.userId, testId: "1" })
Marking.testExampleList({ userId: this.userId, testId: 1 })
.then((res) => {
if (res.data.status == "10000") {
let sampleList = []
for (let i = 0; i< res.data.data.exampleTestId.length; i++) {
for (let i = 0; i< res.data.data.exampleTestPapers.length; i++) {
sampleList.push({
order: i,
question_id: res.data.data.exampleTestId[i].Test_id,
question_name: res.data.data.exampleTestId[i].Candidate,
score: res.data.data.exampleTestId[i].Final_score,
question_id: res.data.data.exampleTestPapers[i].test_id,
question_name: res.data.data.exampleTestPapers[i].candidate,
score: res.data.data.exampleTestPapers[i].final_score,
})
}
this.setState({
@ -89,7 +89,7 @@ export default class index extends Component {
let testPaper = null;
if (this.state.samplePaper != undefined || this.state.samplePaper != null) {
testPaper = this.state.samplePaper.map((item) => {
return <img src={item.Pic_src} alt="加载失败" className="test-question-img"/>
return <img src={item.pic_src} alt="加载失败" className="test-question-img"/>
})
}
@ -131,7 +131,7 @@ export default class index extends Component {
}
selectRow = (record) => {
console.log(record.order)
Marking.testDetail({ userId: this.userId, exampleTestId: record.question_id.toString() })
Marking.testDetail({ userId: this.userId, exampleTestId: record.question_id })
.then((res) => {
if (res.data.status == "10000") {
this.setState({