|
|
|
@ -82,7 +82,18 @@ Page({
|
|
|
|
|
console.log("answer_question");
|
|
|
|
|
console.log(value);
|
|
|
|
|
console.log(dataset);
|
|
|
|
|
app.client.answer_question({ question_id: dataset.question_id, exercise_choice_id: value})
|
|
|
|
|
let exercise_choice_id;
|
|
|
|
|
if(Array.isArray(value)){
|
|
|
|
|
exercise_choice_id = [];
|
|
|
|
|
for(var i of value){
|
|
|
|
|
exercise_choice_id.push(parseInt(i));
|
|
|
|
|
}
|
|
|
|
|
console.log(exercise_choice_id);
|
|
|
|
|
}else{
|
|
|
|
|
exercise_choice_id = parseInt(value);
|
|
|
|
|
console.log(exercise_choice_id);
|
|
|
|
|
}
|
|
|
|
|
app.client.answer_question({ question_id: dataset.question_id, exercise_choice_id})
|
|
|
|
|
.then(res=>{console.log("answer_question");console.log(res);})
|
|
|
|
|
.catch(error=>{
|
|
|
|
|
console.error(error);
|
|
|
|
@ -98,9 +109,10 @@ Page({
|
|
|
|
|
title: '请稍候',
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
console.log("保存答案中");
|
|
|
|
|
app.client.save_exercise({exercise_id: this.exercise_id, complete: wx.hideLoading})
|
|
|
|
|
.then(res=>{
|
|
|
|
|
console.log("保存答案");
|
|
|
|
|
console.log("保存答案完成");
|
|
|
|
|
console.log(res);
|
|
|
|
|
if(show_loading){
|
|
|
|
|
wx.showToast({
|
|
|
|
@ -141,14 +153,13 @@ Page({
|
|
|
|
|
onLoad: function (options) {
|
|
|
|
|
this.exercise_id = options.exercise_id;
|
|
|
|
|
this.course_name = options.exercise_name;//todo finish
|
|
|
|
|
this.pull_questions();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
|
|
*/
|
|
|
|
|
onReady: function () {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -167,14 +178,14 @@ Page({
|
|
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
|
|
*/
|
|
|
|
|
onHide: function () {
|
|
|
|
|
this.save_exercise({ show_loading: false });
|
|
|
|
|
this.save_exercise({show_loading: false});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
|
|
*/
|
|
|
|
|
onUnload: function () {
|
|
|
|
|
|
|
|
|
|
this.save_exercise({ show_loading: false });
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|