UNPKG

webclass

Version:

A package for web class checking

104 lines (80 loc) 3.35 kB
const webclass = require('webclass'); var web = new webclass(); web.openjsonfile("./dyna_test.json"); web.addJSONEntry("exam_name", "动力学"); web.addJSONEntry("exam_des", "总分100分, 考试时间120分钟. 开卷 "); web.addJSONEntry( "teacher","杨"); web.addJSONEntry( "year", "2019-2020"); web.addJSONEntry( "term", "2"); web.addJSONEntry( "category", "A"); web.addJSONEntry( "time_length", 120); web.addJSONEntry( "open", "Y"); // Subjects types web.addExam( "exam_type", "short_answer", { "name": "简答题", "des": "简要回答下列问题,每题5分"} ) web.addExam( "exam_type", "fill_in_the_blank", { "name": "填空题", "des": "每空2分"} ); web.addExam( "exam_type", "true_false", {"name": "判断题","des": "每题2分"} ); web.addExam( "exam_type", "multiple_choice", {"name": "选择题", "des": "每题2分"} ); web.addExam( "exam_type", "calculation", {"name": "计算题", "des": "每题10分"} ); var itemType = "short_answer"; var itemID = 501; var theItem = {}; theItem["subject"] = " 质点的瞬时动量为$m\\vec{v}$"; theItem["figure"] = ""; theItem["answer"] = [ "M_{O}(m\vec{v}) = \vec{r} \times m\vec{v}"]; theItem["comment"] = ""; theItem["chapter"] = ""; web.addExam( itemType, itemID, theItem ) var itemType = "true_false"; var itemID = 401; var theItem = {}; theItem["subject"] = "质点系的机械能守恒."; theItem["figure"] = ""; theItem["answer"] = [ "false"]; theItem["comment"] = ""; theItem["chapter"] = "力改变质点的运动状态"; web.addExam( itemType, itemID, theItem ) // var itemType = "multiple_choice"; var itemID = 101; var theItem = {}; theItem["subject"] = "一个人在速度风速为( $~~~~$ )"; theItem["choices"] = {}; theItem["choices"]["A"] = " $20\\sqrt{2}m/s$, 向西偏北方向"; theItem["choices"]["B"] = " $20\\sqrt{2}m/s$, 向东偏南方向"; theItem["choices"]["C"] = "$10\\sqrt{2}m/s$, 向东偏南方向"; theItem["choices"]["D"] = "$10\\sqrt{2}m/s$, 向西偏北方向"; theItem["figure"] = ""; theItem["answer"] = "C"; theItem["comment"] = ""; theItem["chapter"] = "5"; web.addExam( itemType, itemID, theItem ) web.updating( ); var itemType = "fill_in_the_blank"; var itemID = 501; var theItem = {}; theItem["subject"] = "均质圆板质量为$m$对中心轴的转动惯量为$\\underline{~~~~~~~~~~~~}$ "; theItem["figure"] = ""; theItem["answer"] = ["$\\frac{1}{2} m R^{2}$"]; theItem["comment"] = ""; theItem["chapter"] = "5"; web.addExam( itemType, itemID, theItem ) var itemType = "calculation"; var itemID = 601; var theItem = {}; theItem["subject"] = " 杆长为$l$, 质量不计。 "; theItem["figure"] = {}; theItem["figure"]["path"] = "dyna-examp-21.png"; theItem["figure"]["width"] = 0.3; theItem["figure"]["caption"] = 0.4; theItem["answer"] = [ "定参考系","动参考系", "相对运动", "牵连运动", "绝对运动"]; theItem["comment"] = ""; theItem["chapter"] = "5"; web.addExam( itemType, itemID, theItem ) web.updating( ); web.examTexHead("./dyna_exam_A.tex"); web.writeExamSubject("multiple_choice"); web.writeExamSubject("true_false"); web.writeExamSubject("fill_in_the_blank"); web.writeExamSubject("short_answer"); web.writeExamSubject("calculation"); web.examTexEnd();