You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
1.6 KiB

// pages/exercise_result/exercise_result.js
const app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
results: [],
page_status: 0,
error:""
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.exercise_id = options.exercise_id;
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
app.api("exericses.exercise_result")({ exercise_id: this.exercise_id })
.then(res => {
this.setData({ error: "" })
5 years ago
;
if (res.commit_results) {
let results = res.commit_results;
for (var result of results) {
if (result.ques_type == 4) {
for (var detail of result.ques_details) {
if (detail.choice_text == 1) detail.choice_text = "满分作答";
else if (detail.choice_text == 2) detail.choice_text = "部分得分作答";
else if (detail.choice_text == 3) detail.choice_text = "零分作答";
else if (detail.choice_text == 4) detail.choice_text = "未批";
}
}
if (result.ques_type == 3) {
for (var detail of result.ques_details) {
if (detail.choice_text == "wrong") detail.choice_text = "错误答案";
}
}
}
5 years ago
;
this.setData({ results, page_status: 1 })
}
})
.catch(error => {
5 years ago
;
this.setData({ error: error.message })
})
},
onShareAppMessage: function () {
}
})