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.
|
|
|
const app = getApp();
|
|
|
|
Component({
|
|
|
|
properties: {
|
|
|
|
data:Object,
|
|
|
|
is_md: Boolean,
|
|
|
|
exercise_status: Number,
|
|
|
|
user_exercise_status: Number,
|
|
|
|
},
|
|
|
|
data: {
|
|
|
|
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
triggerAnswer({answered=1}={}) {
|
|
|
|
if (this.answered!=answered) {
|
|
|
|
let { question_id, q_position } = this.data.data;
|
|
|
|
this.triggerEvent("answer", { q_position, question_id, answered }, { bubbles: true });
|
|
|
|
this.answered = answered;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
answer_main_question: function ({detail: {value}, currentTarget: { dataset } }) {
|
|
|
|
console.log("answer_main_question");
|
|
|
|
console.log(value);
|
|
|
|
console.log(dataset);
|
|
|
|
app.api("exercise_questions.exercise_answers")({ question_id: dataset.question_id, answer_text: value })
|
|
|
|
.then(res => {
|
|
|
|
if (value)
|
|
|
|
this.triggerAnswer({answered:1});
|
|
|
|
else
|
|
|
|
this.triggerAnswer({answered:0});
|
|
|
|
console.log("answer_main_question"); console.log(res);
|
|
|
|
})
|
|
|
|
.catch(e => {
|
|
|
|
console.error(e);
|
|
|
|
app.showError(e);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
}
|
|
|
|
})
|