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.
39 lines
995 B
39 lines
995 B
5 years ago
|
const app = getApp();
|
||
|
Component({
|
||
|
properties: {
|
||
|
data:Object
|
||
|
},
|
||
|
|
||
|
data: {
|
||
|
|
||
|
},
|
||
|
|
||
|
methods: {
|
||
|
answer_choice_question: function ({ detail: { value }, currentTarget: { dataset } }) {
|
||
|
console.log("answer_question");
|
||
|
console.log(value);
|
||
|
console.log(dataset);
|
||
|
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.api("exercise_questions.exercise_answers")({ question_id: dataset.question_id, exercise_choice_id })
|
||
|
.then(res => { console.log("answer_question"); console.log(res); })
|
||
|
.catch(error => {
|
||
|
console.error(error);
|
||
|
wx.showToast({
|
||
|
title: error.toString(),
|
||
|
icon: "none"
|
||
|
})
|
||
|
});
|
||
|
},
|
||
|
}
|
||
|
})
|