Establishment of examination questionnaire system
1. Usage scenarios
Today's schools are more inclined to use the online examination questionnaire system,There is no need to manually mark papers like traditional examinations, which cost a lot of manpower and material resources, has low efficiency and is prone to errors. The online examination system automatically judges the results,However, our examination system usually includes multiple choice questions and short answer questions. If our single choice only needs to be equal to the answer to get the score, then how can our multiple choice points be achieved ~
2. Video Display
3. Procedure
3.1 multi-topic selection is implemented by using the check component. The title is written in the title, the answer is the check option, the single-line text is the correct answer, and the numerical component is the score box.
3.2 configure onChange actions for the check box, which will be triggered when the value of the check box changes.
3.3 configure the code according to the scoring rule to determine whether the option is correct and fill in the corresponding score
3.3.1 scoring rule 1: select the right one to give one point, select the right one to give four points, choose the wrong one to give no points
1) set the option value in the check box to ABCD, as shown in the following figure:
2) obtain the option value of the selected option when selecting, and calculate the intersection between the selected array set and the correct answer.
var arrjiao = value.filter(function(v){
return arranswer.indexOf(v)!==-1
})
3) if the character length of the intersection is less than the character length of the selected option, the error answer is selected, that is, no score is given. If the character length of the intersection is equal to the option length, the selected options are all correct.
4) If the selected option is the correct option, you need to determine the length of the intersection character and the length of the correct answer character. If the length of the intersection character is equal to the length of the correct answer character, the correct answer is scored four points, assign 4 to the score. If the intersection length is less than the correct answer length, the intersection * 1 is used to obtain the score and assign it to the score.
export function onChange({ value }) {
// console.log(value);
var arranswer = this.$('textField_kp3eb1wh').getValue();
var arrjiao = value.filter(function(v){
return arranswer.indexOf(v)!==-1
})
if(arrjiao.length < value.length){
this.$('numberField_kp2182ec').setValue("0");
} else if (arrjiao.length === value.length){
if (arrjiao.length === arranswer.length){
this.$('numberField_kp2182ec').setValue("4");
} else if (arrjiao.length < arranswer.length) {
this.$('numberField_kp2182ec').setValue(arrjiao.length * 1);
}
}
}
3.3.2 scoring rule 2: Select All pairs to give four points, choose wrong or choose less to give no points
1) set the option value in the check box to ABCD, as shown in the following figure:
2) obtain the option value of the selected option when selecting, and calculate the intersection between the selected array set and the correct answer.
var arrjiao = value.filter(function(v){
return arranswer.indexOf(v)!==-1
})
3) if the character length of the intersection is less than the character length of the selected option, the error answer is selected, that is, no score is given. If the character length of the intersection is equal to the option length, the selected options are all correct.
4) If the selected option is the correct option, you need to determine the length of the intersection character and the length of the correct answer character. If the length of the intersection character is equal to the length of the correct answer character, the correct answer is scored four points, assign 4 to the score. If the intersection length is less than the correct answer length, 0 points are obtained.
export function onChange({ value }) {
// console.log(value);
var arranswer = this.$('textField_kp3eb1wh').getValue();
var arrjiao = value.filter(function(v){
return arranswer.indexOf(v)!==-1
})
if(arrjiao.length < value.length){
this.$('numberField_kp2182ec').setValue("0");
} else if (arrjiao.length === value.length){
if (arrjiao.length === arranswer.length){
this.$('numberField_kp2182ec').setValue("4");
} else if (arrjiao.length < arranswer.length) {
this.$('numberField_kp2182ec').setValue("0");
}
}
}
##> click the link to authenticate now ##<
「Click me for free consultation!」
Kuairen enters the digital age step by step
-------------------- Get the latest information YIDA, welcome to follow US--------------------