0.2.2 • Published 3 years ago

webclass v0.2.2

Weekly downloads
175
License
-
Repository
-
Last release
3 years ago

webclass

This is an application especially for TKK Colleague of Xiamen University.

安装

npm install webclass

Main Methods

  • init( filePath )
  • updating()
  • checking( filePath )

Example

init

const webclass = require('webclass');  

var web = new webclass();
web.init( "./studall.txt" ); 

web.updating(); 

解析studall.txt中的学生信息,将其转化为json格式并保存在stud.json文件中。

作业统计

前提条件:

  • 学生信息文件 -- stud.json

  • 历次学生作业分别存放在 ./1 , ./2 文件夹中

学生作业统计结果保存到stud.json文件学生数据的"hw"项下; 统计结果记录到score.html中,以供查阅.

const webclass = require('webclass');  

var web = new webclass();

web.homework( 1 );
web.updating();

web.homework( 2 );
web.updating();

web.htmlhead();
web.writescoretohtml("homework");
web.htmlend();

学生作业成绩可以保存到stud.json文件学生相应作业成绩项中。

Adding one homework entry, under serial id 1, for all students.

const webclass = require('webclass');  

var web = new webclass();

web.addHomework( 1 );
web.updating();

web.htmlhead();
web.writescoretohtml("homework");
web.htmlend();

作业提交统计.

const webclass = require('webclass');  

var web = new webclass();

web.addHomework( 1 );
web.updating();

web.homeworkStat( 1 );

web.htmlhead();
web.writescoretohtml("homework");
web.htmlend();

作业成绩修改.

const webclass = require('webclass');  

var web = new webclass();

web.addHomework( 1 );
web.setHwScore( "MEE18064","homework", "1", 90 );
web.updating();
web.homeworkStat( 1 );

web.seteditable(true);
web.htmlhead();
web.writescoretohtml("homework");
web.htmlend();

The code will create a html file wihch contains an editable table. It contains the homework scores. You can edit the content of the table while inputing the scores. Click the button 'Table Content', the page will generate the script code for all the homework scores in the talbe, for example,

web.setHwScore( "MDD18269","homework", "1", 90 );

考勤统计

前提条件:

  • 学生信息文件 -- stud.json

  • 上课聊天记录存放在 ./3-5.txt ./3-12.txt等 文件夹中

学生考勤统计结果保存到stud.json文件学生数据的"check"项下; 统计结果记录到score.html中,以供查阅.

const webclass = require('webclass');  

var web = new webclass();
var checkfilepath;

checkfilepath = "./3-5.txt";
web._classID = 1;
web.checking( checkfilepath );
web.stat(); 
web.updating(); 

checkfilepath = "./3-12.txt";
web._classID = 2;
web.checking( checkfilepath );
web.stat(); 
web.updating(); 

checkfilepath = "./3-19.txt";
web._classID = 3;
web.checking( checkfilepath );
web.stat(); 
web.updating(); 

checkfilepath = "./3-26.txt";
web._classID = 4;
web.checking( checkfilepath );
web.stat(); 
web.updating(); 

web.htmlhead();
web.writescoretohtml("check");
web.htmlend();

编制教案

前提条件:

  • 教课记录文件 -- phyjiaoan.json

  • 所需图片文件存放在 ./figures 文件夹中

教案记录文档phyjiaoan.json样例

{
    "name": "课程名称", 
    "teacher":"授课老师姓名",
    "target": "班级名称",
    "semester":"2019 -- 2020 (2) 学年(学期)",
    "reference":"参考教材",
    "targetCharacters": "有一定工程力学基础,但有的同学基础不扎实。(学生特点)",
    "mainMethod":"基于大学物理课程特点,通过习题训练,例题演示等方法,引导学生逐步学习大学物理. 通过互动,提问,等多种手段对学生强化训练,以期达到教学目标。(主要教学方法)",
    "classes":{
        "1":{
            "date":"2020-2-24(第一次课教学日期)", 
            "topic":"大学物理课程简介(主题)", 
            "teachTarget": "物理学的研究范围,牛顿时空观,牛顿力学基本概念",
            "hardPoints":"",
            "introduction":"从物理学定义引入物理学研究范围。物理学最初的中文译名是格物学,取自格物致知. 根据第23界国际纯粹物理与应用物理联合会议决议,物理学是研究物质,能量和它们的相互作用的学科。",
            "content_1":[" 物理学的研究领域,通过视频资料演示世界的世界尺度和空间尺度。 进而介绍从古代物理,近代物理到现代物理学的发展历程.(第一段), 下面添加一幅图片.",
                {"figure": {
                    "path": "B.PNG",
                    "width": 0.4
                   }}, 
                "牛顿力学的绝对时空观,相对论的时空观。(第二段)"],
            "content_2":["质点是物理学中最基本的抽象模型.(第一段)", 
                "参考系,坐标系的概念,常用参考系.(第二段)",
                "矢量代数简介 (第三段)"],
            "summary":"学好大学物理的注意事项。大学物理的一些经典教材,如费曼物理学讲义等",
            "homework":"课后作业"
        },
        "2":{
            "date":"2020-2-26", 
            "topic":"质点,运动,参考系",  
            "teachTarget": "介绍物理学中基础抽象模型,物质世界运动本性和度量体系",
            "hardPoints":"",
            "introduction":"从学生已有的高中物理知识引入大学物理范畴",
            "content_1":"位置矢量的定义,数学表达式以及其物理意义. 运动方程,位移与路程的区别和联系",
            "content_2":"",
            "summary":"",
            "homework":""
        }
    }
}

代码样例

const webclass = require('webclass');  

var web = new webclass(); 
web._jiaoanTexFilePath = "./jiaoan.tex",
web.jiaoan("./phyjiaoan.json");

编制试卷

前提条件:

  • 试题信息文件 -- phy_test.json

  • 试题所需图片文件存放在 ./figures 文件夹中

const webclass = require('webclass');  

var web = new webclass(); 

web.openjsonfile("./phy_test.json");

web.examTexHead("./exam.tex");
web.writeExamSubject("multiple_choice");
web.writeExamSubject("true_false"); 
web.writeExamSubject("fill_in_the_blank"); 
web.examTexEnd();

根据试卷模板,设置开卷,闭卷选项,A卷,B卷选项

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();

编制带答案和注释的试卷

const webclass = require('webclass');  

var web = new webclass(); 
web._hasAnswer = true;
web._hasComment = true;

web.openjsonfile("./phy_test.json");

web.examTexHead("./exam.tex");
web.writeExamSubject("multiple_choice");
web.writeExamSubject("true_false"); 
web.writeExamSubject("fill_in_the_blank"); 
web.examTexEnd();

编制课堂练习

const webclass = require('webclass');  

var web = new webclass(); 

var theExamFilePath = "./phy_test.json";
var classexamhtmlfilename = "./test.html";

web.openjsonfile( theExamFilePath );
web.classexamfile( classexamhtmlfilename );

课堂练习为网页格式,只有选择题。可自动判断对错,统计分数。

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.12

4 years ago

0.1.11

4 years ago

0.1.10

4 years ago

0.1.8

4 years ago

0.1.7

4 years ago

0.1.6

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago