Disclosure of Invention
The technical task of the invention is to provide a method and a system capable of dynamically adding and deleting and customizing test paper contents, so as to solve the problems of how to realize the basic information of the customized test paper, the questions and the test paper contents of the test paper, improve the paper assembling efficiency and reduce the working strength of teachers.
The technical task of the invention is realized in the following way, and the method for dynamically adding and deleting and customizing the test paper content is as follows:
defining a test question basic information object paperBasicData by default, wherein the test question basic information object paperBasicData comprises three fields of a test paper name PAPERNAME, a test paper total score paperTotalCount and a question answering time PAPERTIME, and defining three input boxes on an interface to be dynamically bound with the three fields of the test paper name field PAPERNAME, the test paper total score paperTotalCount and the question answering time PAPERTIME;
Defining a group of arrays for each test question type, defining different array names for different test question types, and storing information of all test questions selected under the corresponding test question types in the arrays, wherein the divisor arrays are empty arrays;
Each test question is taken as an object, each test question object comprises a test question name, a test question content, a test question score and a test question ID field (the field is a unique identification which is dynamically generated and is not repeated when a test question is newly added), when the test question is selected from the test question library, the selected test question is compared with all test questions under the current test question type, and the repeated test questions are removed through the comparison test question ID.
Preferably, the test paper name PAPERNAME and the answer time PAPERTIME are dynamically bound to an input box in the interface, and the field variable value is customized in the input box.
Preferably, the total score paperTotalCount of the test paper is formed by adding total scores of each test question type, after each test question is changed, the total score of each test question type is triggered to be recalculated, and then the total score of each test question type is added to obtain the total score of the test paper and is displayed on an interface;
The attribute of the total score paperTotalCount is set to read-only.
Preferably, each test question type is provided with a group of arrays with unique names, a folding panel is arranged in each test question type in the interface, all the question types corresponding to the test question type are displayed in a table under the folding panel, and the contents of each row of table are dynamically bound with the test question object;
when the test questions are operated in the table, the array content is changed only in the test question type array to which the test questions belong, and the array corresponding to other test question types is not influenced.
More preferably, when a test question is newly added, the test question object and all variables contained therein are stored in an array of test question types, and when a test question is selected from a test question library, all test question objects stored in the array of the current test question type are traversed, and whether the test question ID field of the object is consistent with the test question ID field in the selected test question object is compared:
if the two are equal, the interface display fails to add and exits the traversal method;
If no equality condition occurs after traversing for one time, the interface display is successful in adding, and the selected test question object is stored in the array of the current test question type.
A system for dynamically adding and deleting and customizing test paper content, which comprises,
The definition unit I is used for defining a test question basic information object paperBasicData by default, wherein the test question basic information object paperBasicData comprises three fields of a test paper name PAPERNAME, a test paper total score paperTotalCount and a answer time PAPERTIME, and three input boxes are defined on an interface and are dynamically bound with the three fields of the test paper name field PAPERNAME, the test paper total score paperTotalCount and the answer time PAPERTIME;
The definition unit II is used for defining a group of arrays for each test question type, defining different array names for different test question types, and storing information of all test questions selected under the corresponding test question types in the arrays;
And a definition unit III, which is used for each test question as an object, wherein each test question object comprises a test question name, a test question content, a test question score and a test question ID field (the field is a unique identification which is dynamically generated and is not repeated when a test question is newly added), when the test question is selected from the test question library, the selected test question is compared with all test questions under the current test question type, and the repeated test questions are removed through the comparison test question ID.
Preferably, the test paper name PAPERNAME and the answer time PAPERTIME are dynamically bound to an input box in the interface, and the field variable value is customized in the input box;
the total score paperTotalCount of the test paper is formed by adding the total score of each test question type, after each test question is changed, the total score of each test question type is triggered to be recalculated, and then the total score of each test question type is added to obtain the total score of the test paper and displayed on an interface;
The attribute of the total score paperTotalCount is set to read-only.
More preferably, the definition unit II comprises,
The binding module is used for setting a folding panel for each test question type in the interface, displaying all the question types corresponding to the test question types in a table below the folding panel, and dynamically binding each row of table contents with test question objects, wherein when the test questions are operated by the table each time, only the array contents are changed in the test question type array to which the test questions belong, and the array corresponding to other test question types is ensured not to be influenced;
the definition unit three includes that,
The new adding and repeating judging module is used for storing test question objects and all variables contained in the test question objects in an array of test question types when the test questions are added newly, traversing all the test question objects stored in the array of the current test question types when the test questions are selected from the test question library, and comparing whether the test question ID fields of the objects are consistent with the test question ID fields in the selected test question objects or not:
if the two are equal, the interface display fails to add and exits the traversal method;
If no equality condition occurs after traversing for one time, the interface display is successful in adding, and the selected test question object is stored in the array of the current test question type.
An electronic device includes a memory and at least one processor;
wherein the memory has a computer program stored thereon;
The at least one processor executes the computer program stored in the memory, so that the at least one processor executes the method capable of dynamically adding and deleting and customizing the test paper content.
A computer readable storage medium having a computer program stored therein, the computer program being executable by a processor to implement a method of dynamically adding and deleting and customizing test paper content as described above.
The method and the system for dynamically adding and deleting and customizing the test paper content have the following advantages:
the method for dynamically processing the test question type and the test questions through the buttons has good universality, improves the working efficiency and well solves the problems in the working process;
Secondly, the invention has good universality and easy operability aiming at the requirement of dynamically adding and deleting and customizing the test paper content;
The invention defaults to five test question types for selection, namely single choice questions, multiple choice questions, judgment questions, blank filling questions and simple answer questions, each test question type defines a special folding panel for distinguishing and classifying;
Fourthly, the invention has two modes of adding the test questions, namely clicking a new adding button in a folding panel of the test questions; secondly, clicking a button for selecting a test question library in the folding panel to select a test question from the question library, and judging whether the test question is repeated or not when the test question library is selected, so as to ensure the uniqueness of the test question;
And fifthly, after each time of test questions are changed, the invention adds the score of each test question in each test question type to obtain the total score of each test question type, adds the score of each test question type to obtain the total score of the test paper, records the total score in the basic information of the test paper, and displays the number of the test questions, the total score and the total score of the test paper of each large test question of the current test paper below the selected test question list.
Detailed Description
The method and system for dynamically adding and deleting and customizing the test paper content according to the invention are described in detail below with reference to the accompanying drawings and specific embodiments of the specification.
Example 1:
As shown in fig. 1, the present embodiment provides a method for dynamically adding and deleting and customizing test paper contents, which specifically includes the following steps:
s1, defining a test question basic information object paperBasicData by default, wherein the test question basic information object paperBasicData comprises three fields of a test paper name PAPERNAME, a test paper total score paperTotalCount and a answer time PAPERTIME, and defining three input frames on an interface to be dynamically bound with the three fields of the test paper name field PAPERNAME, the test paper total score paperTotalCount and the answer time PAPERTIME;
S2, defining a group of arrays for each test question type, defining different array names for different test question types, and storing information of all test questions selected under the corresponding test question types in the arrays, wherein the divisor arrays are empty arrays;
s3, each test question is taken as an object, each test question object comprises a test question name, a test question content, a test question score and a test question ID field (the field is a unique identification which is dynamically generated and is not repeated when a test question is newly added), when the test question is selected from the test question library, the selected test question is compared with all the test questions under the current test question type, and the repeated test questions are removed through the comparison test question ID.
In the embodiment, the test paper name PAPERNAME and the answer time PAPERTIME in step S1 are dynamically bound to an input box in the interface, and the field variable value is customized in the input box.
The total score paperTotalCount of the test paper in the step S1 of the embodiment is formed by adding the total score of each test question type, after each test question is changed, the total score of each test question type is triggered to be recalculated, and then the total score of each test question type is added to obtain the total score of the test paper and is displayed on an interface;
The attribute of the total score paperTotalCount is set to read-only.
In the embodiment, in step S2, each test question type has a group of arrays with unique names, a folding panel is arranged on each test question type in the interface, all the question types corresponding to the test question type are displayed in the table under the folding panel, and the contents of each row of table are dynamically bound with the test question object;
when the test questions are operated in the table, the array content is changed only in the test question type array to which the test questions belong, and the array corresponding to other test question types is not influenced.
The initial array is an empty array, a folding panel is defined for each test question type on the interface, new test questions are added on the folding panel, buttons are selected from a test question library, and tables in the folding panel are dynamically bound with the array and used for displaying all test questions under the test question type, and test question objects corresponding to the lines can be obtained in an operation column.
When clicking the button for new addition on the folding panel or acquiring the button from the test question library, acquiring the test question array corresponding to the current folding panel, storing the new added test question object in the array, and when clicking the button for editing the test question corresponding to the table, acquiring the test question array corresponding to the table and the line of test question objects, and storing the changed test question object in the test question array. After the change, the method adds the scores of each test question to update the total score field of the test paper. Every time the array and the objects under the array change, the table interface display is refreshed.
In this embodiment, when a test question is newly added, a test question object and all variables contained therein are stored in an array of test question types, and when a test question is selected from a test question library, all test question objects stored in the array of the current test question type are traversed, and whether a test question ID field of the object is consistent with a test question ID field in the selected test question object is compared:
if the two are equal, the interface display fails to add and exits the traversal method;
If no equality condition occurs after traversing for one time, the interface display is successful in adding, and the selected test question object is stored in the array of the current test question type.
Example 2:
the embodiment provides a system for dynamically adding and deleting and customizing test paper contents, which comprises,
The definition unit I is used for defining a test question basic information object paperBasicData by default, wherein the test question basic information object paperBasicData comprises three fields of a test paper name PAPERNAME, a test paper total score paperTotalCount and a answer time PAPERTIME, and three input boxes are defined on an interface and are dynamically bound with the three fields of the test paper name field PAPERNAME, the test paper total score paperTotalCount and the answer time PAPERTIME;
The definition unit II is used for defining a group of arrays for each test question type, defining different array names for different test question types, and storing information of all test questions selected under the corresponding test question types in the arrays;
And a definition unit III, which is used for each test question as an object, wherein each test question object comprises a test question name, a test question content, a test question score and a test question ID field (the field is a unique identification which is dynamically generated and is not repeated when a test question is newly added), when the test question is selected from the test question library, the selected test question is compared with all test questions under the current test question type, and the repeated test questions are removed through the comparison test question ID.
The test paper name PAPERNAME and the answer time PAPERTIME in the embodiment are dynamically bound to an input box in the interface, and the field variable value is customized in the input box;
The total score paperTotalCount of the test paper in the embodiment is formed by adding the total score of each test question type, after each test question is changed, the total score of each test question type is triggered to be recalculated, and then the total score of each test question type is added to obtain the total score of the test paper and displayed on an interface;
The attribute of the total score paperTotalCount is set to read-only.
The second definition unit in the present embodiment includes,
The binding module is used for setting a folding panel for each test question type in the interface, displaying all the question types corresponding to the test question types in a table under the folding panel, and dynamically binding each row of table contents with test question objects, wherein each time when the test questions are operated by the table, only the array contents are changed in the test question type array to which the test questions belong, and the array corresponding to other test question types is ensured not to be influenced.
The definition unit three in the present embodiment includes,
The new adding and repeating judging module is used for storing test question objects and all variables contained in the test question objects in an array of test question types when the test questions are added newly, traversing all the test question objects stored in the array of the current test question types when the test questions are selected from the test question library, and comparing whether the test question ID fields of the objects are consistent with the test question ID fields in the selected test question objects or not:
if the two are equal, the interface display fails to add and exits the traversal method;
If no equality condition occurs after traversing for one time, the interface display is successful in adding, and the selected test question object is stored in the array of the current test question type.
The working process of the system is specifically as follows:
(1) Recording basic information of the test paper, namely recording basic information object paperBasicData of the test paper, wherein the basic information object comprises three fields of a test paper name field PAPERNAME, a test paper total score paperTotalCount and answer time PAPERTIME, and defining three input frames on an interface to be dynamically bound with the three fields, wherein the test paper total score is calculated and set to be read-only;
(2) The test question type array is independent of each other because the types are different and the arrays with different names are required to be defined, all test question objects of the types are stored in the arrays, the test question type array is dynamically bound with a table, and all test questions are displayed;
(3) And dynamically adding and deleting test questions, namely acquiring a current test question type array and test question objects when clicking a new adding button, selecting and editing buttons from a test question library, dynamically changing the test question objects in the array, and reminding of new adding failure when the test question ID fields of the test question objects in the same test question type array are repeated. And after dynamically changing the test question array, adding all the test question scores to obtain a total score of the test paper, and displaying the total score in an interface.
Example 3:
the embodiment also provides an electronic device, which comprises a memory and at least one processor;
Wherein the memory stores computer-executable instructions;
And the at least one processor executes the computer-executed instructions stored in the memory, so that the at least one processor executes the method capable of dynamically adding and deleting and customizing the test paper content in any embodiment of the invention.
Example 4:
The embodiment of the invention also provides a computer readable storage medium, wherein a plurality of instructions are stored, and the instructions are loaded by a processor, so that the processor executes the method capable of dynamically adding and deleting and customizing the test paper content in any embodiment of the invention. Specifically, a system or apparatus provided with a storage medium on which a software program code realizing the functions of any of the above embodiments is stored, and a computer (or CPU or MPU) of the system or apparatus may be caused to read out and execute the program code stored in the storage medium.
In this case, the program code itself read from the storage medium may realize the functions of any of the above-described embodiments, and thus the program code and the storage medium storing the program code form part of the present invention.
Examples of storage media for providing program code include floppy disks, hard disks, magneto-optical disks, optical disks (e.g., CD-ROMs, CD-R, CD-RW, DVD-ROMs, DVD-RYM, DVD-RW, DVD+RW), magnetic tapes, nonvolatile memory cards, and ROMs. Alternatively, the program code may be downloaded from a server computer by a communication network.
Further, it should be apparent that the functions of any of the above-described embodiments may be implemented not only by executing the program code read out by the computer, but also by causing an operating system or the like operating on the computer to perform part or all of the actual operations based on the instructions of the program code.
Further, it is understood that the program code read out by the storage medium is written into a memory provided in an expansion board inserted into a computer or into a memory provided in an expansion unit connected to the computer, and then a CPU or the like mounted on the expansion board or the expansion unit is caused to perform part and all of actual operations based on instructions of the program code, thereby realizing the functions of any of the above embodiments.
It should be noted that the above embodiments are merely for illustrating the technical solution of the present invention and not for limiting the same, and although the present invention has been described in detail with reference to the above embodiments, it should be understood by those skilled in the art that the technical solution described in the above embodiments may be modified or some or all of the technical features may be equivalently replaced, and these modifications or substitutions do not make the essence of the corresponding technical solution deviate from the scope of the technical solution of the embodiments of the present invention.