Detailed Description
Exemplary embodiments of the present invention will now be described with reference to the accompanying drawings, in which various details of the embodiments of the present invention are included to facilitate understanding, and are to be considered merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Referring to fig. 1, a main flowchart of a method for configuring form options according to an embodiment of the present invention is shown, including the following steps:
s101: configuration information associated with the form component is obtained, and a configuration table is generated based on the configuration information.
S102: and analyzing the configuration table, generating a corresponding form component, and displaying form options associated with the form component.
In the above embodiment, for step S101, the form is mainly responsible for collecting data on a page, and includes one or more form options, where the form options are data information input boxes on the page, and a user may perform a data input operation in the data information input boxes.
Based on the componentized concept, information associated with the form options may be combined, configured to generate a form option configuration table, see in particular table 1. Since the form component corresponds to the form option, the information related to the form option is the same as the information related to the form option. And then, when the list options are written and the contents are changed, the developer only needs to write and change in the option configuration list, and more operations are not needed. For example, based on the configuration information, when an "in-bin" form option needs to be regenerated, no redevelopment is required, and only one available field needs to be configured in the configuration information. After the configuration is finished, the reconfigured configuration information is analyzed, and then the form option of 'entering the warehouse' can be generated.
Table 1 form selection configuration table
The form option configuration table abstracts the page form unit element into an option configuration table in the form of key value pairs (corresponding one value is obtained according to one key value), and the table is a program language description of the form option. The following describes each type in the option configuration table:
1. The primary attribute is the configuration of the form option Section. For a more complex form page, the form page can be divided into a plurality of sections according to functions, rules and the like, so that the form option configuration can be performed on each Section, wherein the method comprises the following steps:
(1) the type field indicates the type of Section, which may be either a dynamic type or a static type. The dynamic type refers to that a user can determine whether to display the Section through a certain option on the page; the static type cannot be selected by the user and can only be displayed in the page by default;
(2) The properties field indicates all the form options in the form component Section for which the secondary attribute is configured in relation, specifically:
1) The type field in the secondary attribute indicates the component name used by the form item. For example, if the text box component designates the component name as text, the text box on the code generation page of the text component is read in the parsing process.
2) The name field in the secondary attribute indicates the mapping of the form item in the data pool (where the data is stored) and when the value of the form item changes (e.g., the user-entered information changes from a to B), the contents of the data pool are synchronized.
3) The validation field in the secondary attribute indicates the rule that the form item needs to satisfy to validate the data; the type field in the three-level attribute is the name of the verification component, and the rule field specifies the rule to be satisfied when verifying the data.
Taking a login input password box as an example:
Properties:{
type: 'text' — indicates that text components are used, namely input box components;
Id: ' the code can be arbitrarily defined, but must be unique, and requires a unique identifier;
Label: 'password', -label is two words of 'password' in front of the input box seen by the user on the page;
Description: the' password must consist of 16 bits— some description related to the password Label;
Param: { placeholder: 'please enter a password' } -there may be some information inside the page entry box, e.g. please enter a password or the like; in addition, for different components, the param may have different fields in part, for example, additional parameters needed in the code;
validing: the (data plane) password needs to meet the rule, for example, the password must be composed of 16 bits, and the framework can judge whether the password input by the user meets the condition according to the content of the field.
}
2. In addition, the definition and configuration of the option configuration table may be in YAML (Yet Another Markup Language, another markup language) language or JSON (JavaScript Object Notation ) format. The basic grammar rules of the YAML language comprise:
1) Case sensitive;
2) Representing hierarchical relationships using indents;
3) The TAB key is not allowed to be used during the retraction, and only the blank is allowed to be used;
4) The number of spaces indented is not important as long as the elements of the same hierarchy are left-side aligned;
Therefore, compared with the JSON format, the YAML language ensures that the file hierarchy is clearer, the file is easy to recognize and the readability is high.
For step S102, since the form configuration table contains all the associated configuration information, after the option configuration is completed, the corresponding form component can be generated by parsing the option configuration table.
After the form component is generated, form options corresponding to the form component may be displayed on a page to detect configuration information. Then, if the user inputs data in the form option, the data is displayed in the form option, and the user can also view the input data information on the page.
In addition, based on the componentization thought, a set of unified display formats can be provided for the forms displayed on the pages, so that the background management is facilitated, namely, the page styles of the web sites are unified after the web sites are established, and therefore, the display formats of the page areas and the form options are also drawn into a set of components. The display format refers to the distance between a certain area and another area on the page, the placement position of a form option input box in the area, the placement position of prompt information and the like. The display pages of different pixels may have the same display format, but different sizes are displayed.
The method provided by the embodiment provides a configurable idea for the form options, has high universality and improves the reusability and flexibility of the form components; compared with the prior art, the developer only needs to write/change the configuration information in the configuration table, so that the development efficiency is improved, and similar codes and code redundancy are avoided from being repeatedly written. In addition, based on the fixed format of the configuration table, the problem of bug caused by different development habits of different developers is avoided, the development cost and the later maintenance cost are reduced, and the project expansion is facilitated.
Referring to fig. 2, an alternative configuration form option method flow diagram is shown, comprising the steps of,
S201: acquiring configuration information associated with the form component, and generating a configuration table based on the configuration information; wherein the configuration information includes format receipt rules for the form component.
S202: and analyzing the configuration table, generating a corresponding form component, and displaying form options associated with the form component.
S203: and receiving a data input request of the form option, and acquiring the input data information.
S204: when the format of the data information does not accord with the format receiving rule, carrying out format conversion on the data information according to the preset format conversion rule, and transmitting the data information after format conversion to a form component for display in a form option.
In the above embodiment, the step S202 may refer to the description of the step S102 shown in fig. 1, which is not repeated here.
In the above embodiment, for step S201, due to the business requirement and the updating and iteration performed on the form component, the data information in the incoming component may need to be subjected to format conversion to meet the development requirement.
Furthermore, the format receiving rule corresponding to the form component can be preset in the configuration table, so that the format of the output data information is unified, and the background management is facilitated. The rule can be set according to the requirements of different components, and when the rule needs to be changed, the rule can be directly changed in the configuration table.
For step S203, after the user inputs data information in one input box in the page, the form option will send the data information and the corresponding input box information to the data pool for storage; wherein one input box corresponds to one form option. In addition, because of the complex hierarchical relationship of components, all data needs to be stored in a data pool in order to facilitate communication between components and management of the entered information.
In addition, each form option corresponds to a form component, each form option has respective identification information, and the form component corresponds to the identification information. After the data information is acquired, a corresponding form component can also be determined based on the form options; for example, the Property option in the option configuration table is parsed, and form components corresponding to the form options are determined according to identification information, for example, a component name type field in the secondary attribute.
For step S204, when the input data information meets the format receiving rule, the data information in the data pool is transmitted to the form component for displaying the input data information in the page form option. However, when the format receiving rule is not met, format conversion is required, for example, there is a date 2017.12.30 in the data information transmitted to the component, but the format that may need to be displayed for the date on the page is 12.30.2017.
In addition, as the front end of the page display is separated from the background server end, for the front end, data information, description and the like meeting the user requirements are displayed; for the backend server, the stored information is a tool that is suitable for the backend. Taking the rmb as an example, the front end needs to display in units of dollars, euros, etc. according to the requirement, which needs to be converted. In addition, in order to facilitate the subsequent working process and reduce the inconvenience caused by working handover, the background server may be set to store the data information in the original format, for example, the rmb, so that the data information finally stored in the background needs to be returned to the original format.
Thus, for the overall process of data information transfer to form component and last save, the specific operation of format conversion can be as follows:
(1) Before transmitting the data information to the form component, it is required to convert it to a corresponding format, for example, renminbi into USD, via a format converter.
(2) After the format of the data information in the form component is changed, the data information is converted into the previous format through a format converter when the data information is stored, for example, the RMB is converted into dollars and then is converted back into the RMB.
For the format converter of format conversion, a filter or the like may be used. Taking a filter as an example, the filtering mode can be as follows:
Key: value|Filter 1|Filter 2 …
Key-Value represents a Key Value pair, key is an identification of the Value, and Value is data information required to be subjected to format conversion processing; the filter is a conversion rule for displaying corresponding data information on a page or storing corresponding data information in the background together with the form options, such as unit conversion between dollars and RMB, date format conversion; the filters are separated by a symbol "|", are analyzed in the order from left to right, and sequentially process the data information.
Further, the information transmitted to the form component may also include data description information and the like; the data description information may be a requirement for inputting contents of a form option, for example, a password is required to be composed of 8 digits when registering an account number on a web page. For the acquisition of the data description information, the acquisition can be performed in the data pool based on the component information, such as tag information label, simple description, and the like.
In addition, in the process of analyzing the configuration information to generate the form component, the format of the form options can be unified through the rendering of the format component, so that subsequent management is facilitated, and corresponding format requirements can be stored in the configuration table.
The method provided by the embodiment realizes the idea that the format receiving rule of the form component is configurable so as to meet the format requirement of displaying data information on the form options and embody the diversity characteristic of the form component; in addition, the format receiving rule can be configured and stored in the configuration table, so that a developer can conveniently change the format receiving rule, and the later maintenance cost is reduced.
Referring to FIG. 3, another alternative configuration form option method flow diagram according to an embodiment of the invention is shown, comprising the steps of:
s301: acquiring configuration information associated with the form component, and generating a configuration table based on the configuration information; wherein the configuration information includes validation rules for the form component.
S302: and analyzing the configuration table, generating a corresponding form component, and displaying form options associated with the form component.
S303: and receiving a data input request of the form option, and acquiring the input data information.
S304: when the data information does not accord with the verification rule, corresponding abnormal information is determined, and the abnormal information is transmitted to the form component to be displayed in the form options.
In the above embodiment, step S302 may refer to the description of step S102 shown in fig. 1, step S303 may refer to the description of step S203 shown in fig. 2, and the description is omitted here.
In the above embodiment, for step S301, before the data is displayed, the data is verified based on the component, and it is determined whether the requirement for displaying the data in the form option is met. The verification rule may also be stored in the option configuration table and correspond to the option of the form, for example, a verification component corresponding to a type of the valid attribute in the option configuration table is convenient for subsequent modification.
The validation rules include, but are not limited to, the following:
(1) A length restriction rule for inputted information, for example, when a password is inputted to a login page, the password is composed of 16 bits;
(2) A rule for limiting the type of information entered, e.g., the input box can only input numbers, letters, punctuation marks, or a combination thereof;
(3) A size limitation rule for the input information, which is mainly directed to pictures, for example, the size of the uploaded picture must be 100 x 100;
(4) The order restriction rule for the inputted information, for example, the password is composed of 16 bits, the first four bits and the last four bits are composed of letters, and the middle eight bits are composed of numbers.
For step S304, when the data information does not meet the corresponding verification rule, the background analyzes the reason why the data information does not meet the verification rule, and generates corresponding abnormal information according to the reason, so as to display on the form page. The anomaly information may be stored in an error pool in the data pool; wherein the error pool is used to store exception information for all components. And the error pool transmits the abnormal information to the corresponding form component, and the re-rendering of the form component is triggered to be finally displayed on the page so as to inform the user of the error reason and improve the user input efficiency.
Further, when the data information meets the verification rule, a subsequent process can be performed, but when the data information does not meet the verification rule, the data information is still stored in the data pool, but based on the abnormal information frame, the subsequent process can be prevented from being continued, so that the user cannot log in unless the user changes the input information according to the prompt of the abnormal information.
For example, the password input box only allows inputting numbers, but when the user inputs letters, an abnormal information prompt of 'only inputting numbers, please re-input' is displayed; when the user changes the inputted letters into numbers and passes the verification, the subsequent process can be performed, and the correct password is synchronized to change the content in the data pool.
After the user changes the input information, for example, change option a to option B and input a password, the input framework is triggered to re-render the changed content, i.e. re-verify.
It should be noted that the verification logic supported by the configuration table may cover most verification rules, such as the length limitation, the type limitation, the size requirement, and the like mentioned above, but there are always some form components with relatively complex verification logic, for example, two input boxes need to meet some requirements at the same time, and at this time, the corresponding verification rules cannot be configured in the configuration table, and the verification service (e.g., code) needs to be used for verifying the verification rules.
The method provided by the embodiment provides a configurable idea of data verification, so that the generation and verification of form options in the page are integrated, service logic is simplified, and the number of form codes is reduced; in addition, based on the prompt of the abnormal information, the input efficiency of the user is improved, and the follow-up process is quickened.
Referring to FIG. 4, a flowchart of yet another alternative configuration form option method according to an embodiment of the invention is shown, comprising the steps of:
S401: acquiring configuration information associated with the form component, and generating a configuration table based on the configuration information; wherein the configuration information includes a type of the form component; wherein the type is one of dynamic or static.
S402: and analyzing the configuration table, generating a corresponding form component, and displaying form options associated with the form component.
S403: and receiving a data input request of the form option, and acquiring the input data information.
S404: and when the type of the form component is a dynamic type and a display request of the data information is received, transmitting the data information to the form component for display in the form option.
S404': when the type of the form component is a static type, data information is transmitted to the form component for display in the form option.
In the above embodiment, step S402 may be described with reference to step S102 shown in fig. 1, step S403 may be described with reference to step S203 shown in fig. 2, and the description is omitted here.
In the above embodiment, for step S401, the content input by the user in the form option may have a display or non-display, so that the corresponding dynamic type and static type may be set for the developer to select, and the selectivity of form component development is extended.
For step S404, if the current form option is dynamic, the switch may be added to the current form assembly through the dynamic switching assembly, so that the form option may have a function of displaying and not displaying when displayed on the page, so as to be selected by the user.
For dynamic form options, there may be the following displays on the page, for example: whether or not to display; wherein ∈is a check box, which is a change-over switch, and data information is displayed after checking, and if checking is canceled, data information is not displayed.
However, for the static form option, the data information is directly displayed, and whether to display is not determined by switching the switch.
The method provided by the embodiment provides the idea that the display information is configurable, so that the data input in the form options can be selected to be displayed or not displayed, and the use experience of a user on the page form is improved.
The method provided by the embodiment of the invention combines the idea of componentization, performs high abstraction on the basis of componentization, and provides an implementation scheme integrating option configuration, option generation, data format conversion and data verification. The required functions are assembled through the scheme, the form page with the verification function is generated rapidly, the reusability and flexibility of the components are improved greatly, the repeated writing of similar codes and code redundancy are avoided, meanwhile, the access of a third party code is facilitated, the form logic is simplified, the form is easy to manage, and the maintenance and expansion of the form are facilitated.
Referring to fig. 5, a schematic diagram of main modules of an apparatus 600 for configuring form options according to an embodiment of the present invention is shown, including:
An obtaining module 501, configured to obtain configuration information associated with a form component, and generate a configuration table based on the configuration information;
and the display module 502 is configured to parse the configuration table, generate a corresponding form component, and display form options associated with the form component.
In the embodiment of the invention, the configuration information comprises a format receiving rule of the form component;
the display module 502 is further configured to:
Receiving a data input request for the form options, and acquiring input data information;
and when the format of the data information does not accord with the format receiving rule, carrying out format conversion on the data information according to a preset format conversion rule, and transmitting the data information after format conversion to the form component for display in the form option.
In the implementation device of the invention, the configuration information comprises verification rules of the form component;
the display module 502 is further configured to:
Receiving a data input request for the form options, and acquiring input data information;
And when the data information does not accord with the verification rule, corresponding abnormal information is determined, and the abnormal information is transmitted to the form component to be displayed in the form option.
In the implementation device of the invention, the configuration information comprises the type of the form component; wherein the type is one of dynamic or static;
the display module 502 is further configured to:
Receiving a data input request for the form options, and acquiring input data information;
When the type of the form component is a dynamic type and a display request for the data information is received, transmitting the data information to the form component for display in the form option; or (b)
And when the type of the form component is a static type, transmitting the data information to the form component to display in the form option.
In the embodiment of the invention, the configuration information comprises format display rules of the form component;
the display module 502 is further configured to:
And carrying out format rendering on the form component according to the format display rule, and displaying the form options after format rendering.
The device provided by the embodiment of the invention combines the idea of componentization, performs high abstraction on the basis of componentization, and provides an implementation scheme integrating option configuration, option generation, data format conversion and data verification. The required functions are assembled through the scheme, the form page with the verification function is generated rapidly, the reusability and flexibility of the components are improved greatly, the repeated writing of similar codes and code redundancy are avoided, meanwhile, the access of a third party code is facilitated, the form logic is simplified, the form is easy to manage, and the maintenance and expansion of the form are facilitated.
In addition, the implementation of the configuration form option device in the embodiment of the present invention is described in detail in the configuration form option method described above, so that the description is not repeated here.
Referring to fig. 6, an exemplary system architecture 600 to which the configuration form options method or configuration form options apparatus of embodiments of the present invention may be applied is shown.
As shown in fig. 6, the system architecture 600 may include terminal devices 601, 602, 603, a network 604, and a server 605. The network 604 is used as a medium to provide communication links between the terminal devices 601, 602, 603 and the server 605. The network 604 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
A user may interact with the server 605 via the network 604 using the terminal devices 601, 602, 603 to receive or send messages, etc. Various communication client applications such as shopping class applications, web browser applications, search class applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only) may be installed on the terminal devices 601, 602, 603.
The terminal devices 601, 602, 603 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop and desktop computers, and the like.
The server 605 may be a server providing various services, such as a background management server (by way of example only) providing support for shopping-type websites browsed by users using terminal devices 601, 602, 603. The background management server may analyze and process the received data such as the product information query request, and feedback the processing result (e.g., the target push information, the product information—only an example) to the terminal device.
It should be noted that, the method for monitoring system security provided in the embodiment of the present invention is generally executed by the server 605, and accordingly, the monitoring system security device is generally disposed in the server 605.
It should be understood that the number of terminal devices, networks and servers in fig. 6 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring to fig. 7, there is shown a schematic diagram of a computer system 700 suitable for use in implementing the terminal device of an embodiment of the present invention. The terminal device shown in fig. 7 is only an example, and should not impose any limitation on the functions and the scope of use of the embodiment of the present invention.
As shown in fig. 7, the computer system 700 includes a Central Processing Unit (CPU) 701, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 702 or a program loaded from a storage section 708 into a Random Access Memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the system 700 are also stored. The CPU 701, ROM 702, and RAM 703 are connected to each other through a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
The following components are connected to the I/O interface 705: an input section 706 including a keyboard, a mouse, and the like; an output portion 707 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, a speaker, and the like; a storage section 708 including a hard disk or the like; and a communication section 709 including a network interface card such as a LAN card, a modem, or the like. The communication section 709 performs communication processing via a network such as the internet. The drive 710 is also connected to the I/O interface 705 as needed. A removable medium 711 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 710 as necessary, so that a computer program read therefrom is mounted into the storage section 708 as necessary.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication portion 709, and/or installed from the removable medium 711. The above-described functions defined in the system of the present invention are performed when the computer program is executed by a Central Processing Unit (CPU) 701.
The computer readable medium shown in the present invention may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules involved in the embodiments of the present invention may be implemented in software or in hardware. The described modules may also be provided in a processor, for example, as: a processor comprises an acquisition module and a display module. The names of these modules do not constitute a limitation on the module itself in some cases, and for example, the display module may also be described as a "form option display module".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be present alone without being fitted into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to include:
acquiring configuration information associated with a form component, and generating a configuration table based on the configuration information;
and analyzing the configuration table, generating a corresponding form component, and displaying form options associated with the form component.
According to the technical scheme of the embodiment of the invention, the high abstraction is carried out on the basis of componentization by combining with componentization thought, and an integrated implementation scheme of option configuration, option generation, data format conversion and data verification is provided. The required functions are assembled through the scheme, the form page with the verification function is generated rapidly, the reusability and flexibility of the components are improved greatly, the repeated writing of similar codes and code redundancy are avoided, meanwhile, the access of a third party code is facilitated, the form logic is simplified, the form is easy to manage, and the maintenance and expansion of the form are facilitated.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives can occur depending upon design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.