Specific embodiment
Below in conjunction with attached drawing, an exemplary embodiment of the present invention will be described, including the various of the embodiment of the present inventionDetails should think them only exemplary to help understanding.Therefore, those of ordinary skill in the art should recognizeIt arrives, it can be with various changes and modifications are made to the embodiments described herein, without departing from scope and spirit of the present invention.TogetherSample, for clarity and conciseness, descriptions of well-known functions and structures are omitted from the following description.
Referring to Fig. 1, thus it is shown that a kind of broad flow diagram of the method for allocation list radio button provided in an embodiment of the present invention,Include the following steps:
S101: obtaining configuration information associated with form component, generates allocation list based on configuration information.
S102: parsing allocation list generates corresponding form component, shows list option associated with form component.
In above embodiment, it includes one that for step S101, list, which is mainly responsible for the progress data acquisition on the page,Or multiple list options, the list option are the data information input frame on the page, user can carry out data input whereinOperation.
Information associated with list option can be combined, carry out option to it and match by the thinking based on modularizationIt sets, list option configuration table is generated, referring specifically to shown in table 1.Since form component is corresponding to list option, with listThe relevant information of option and information relevant to list option are identical.Later, need to write list option, content moreWhen changing, developer only needs to write in the option configuration table, change, without more operation.For example, being based onThe configuration information, when needing to regenerate " warehouse entry " list option, without developing again, it is only necessary to match in configuration informationSet an available fields.After configuration, the configuration information reconfigured is parsed, that is, produces the list choosing of " warehouse entry "?.
1 list type selection table of table
Wherein, list option configuration table, will by way of key-value pair (obtaining a corresponding value according to a key assignments)Page table list element is abstracted into an option configuration table, which is the program language description of list option.Below to optionEach type is illustrated in allocation list:
1, level-one attribute is the configuration to list option Section.It, can be according to function for more complicated forms pagesEnergy, rule etc. are divided into multiple Section, to carry out list option configuration respectively to each Section, wherein having:
(1) type field shows that the type of Section, the type can be regime type and be also possible to static types.ItsIn, regime type refers to that user can determine whether to show this Section by some option on the page;Static types then can notIt is selected by user, displaying can only be defaulted in the page;
(2) properties field shows all list options in form component Section, and secondary attributes carry out phase for itConfiguration is closed, specifically:
1) the type field in secondary attributes shows component Name used in form item.Such as text box component is by its groupPart title is appointed as text, then can read the text box on the code building page of text component in resolving.
2) the name field in secondary attributes shows mapping of the form item in data pool (place of storing data), works as tableWhen the value of individual event changes (for example, the information of user's input changes from A for B), content in meeting synchrodata pond.
3) the validation field in secondary attributes shows the rule met required for form item verify data;Wherein,Type field in three-level attribute is the title of checking assembly, whens rules field specific authentication data required satisfaction rule.
For logging in input password box:
Properties:{
Type: ' text ' --- it indicates and uses text component, be exactly input frame component;
Id: ' ' --- can arbitrarily it determine, but must be unique, code needs a unique mark;
Label: ' password ', --- label is exactly ' password ' two words before the input frame that user sees on the page;
Description: ' password must be formed by 16 ', --- relevant some descriptions with Label this password;
Param:{ placeholder: ' password please be input ' } --- may exist some information inside page input frame,For example, password etc please be input;In addition, can have part field different inside param, for example, code different componentsIn the additional parameter that needs to use;
Validation:(data plane) password needs the rule that meets, such as must be formed by 16, and frame can basisThe password that the content of this field inputs user judges, judges whether eligible.
}
2, in addition, YAML (Yet Another Markup can be used to definition, configuration that option configuration table carries outLanguage, another markup language) language, JSON (JavaScript Object Notation, JavaScript object tableShow method) format.Wherein, the basic syntax rule of YAML language includes:
1) case sensitive;
2) hierarchical relationship is indicated using retraction;
3) do not allow only to allow using TAB key using space when being retracted;
4) the space number being retracted is inessential, as long as alignment on the left of the element of same level;
Therefore, YAML language is compared with JSON format, so that file hierarchy is more clear, is easily recognized, readable high, thisInventive embodiments mainly use YAML language to be defined list option configuration table.
For step S102, due to including all associated configuration informations in list allocation list, complete optionAfter configuration, option configuration table is parsed and produces corresponding form component.
After generating form component, list option corresponding with form component can be shown on the page, withJust configuration information is detected.Later, if user's input data in list option, can be shown in list optionShow, user can also check inputted data information in the page.
In addition, the thinking based on modularization can have a set of unified displaying lattice for list shown on the pageFormula, in order to back-stage management, i.e., its page style is unified after website is established, therefore by page area, listThe displaying format of option is also pumped into a set of component.Wherein, show that format refers to a certain region on the page and another regionPlacement location, the placement location of prompt information etc. of list option input frame inside distance, region.In the displaying page of different pixelsOn face, identical displaying format can have, what is only shown is of different sizes.
Method provided by above-described embodiment provides a kind of thinking that can configure for list option, and versatility is high, mentionsThe high reusability and flexibility of form component;Compared with the prior art, developer only need in the allocation list with confidenceBreath write/change, and improves development efficiency, avoids repetition and writes similar code and code redundancy.In addition, being based onThe fixed format of allocation list, avoid different developers different exploitations be accustomed to brought by bug problems, reduce exploitation atSheet and later maintenance cost are expanded convenient for project.
Referring to fig. 2, a kind of optional allocation list radio button method flow schematic diagram according to an embodiment of the present invention is shown,Include the following steps,
S201: obtaining configuration information associated with form component, generates allocation list based on configuration information;Wherein, it configuresInformation includes the reception of beacons rule of form component.
S202: parsing allocation list generates corresponding form component, shows list option associated with form component.
S203: receiving the data input request to list option, obtains inputted data information.
S204: when the format of data information does not meet reception of beacons rule, according to scheduled format transformation rule, logarithmIt is believed that breath formats, the data information after transformat conversion is into form component, to show in list option.
In above embodiment, step S202 can be found in the description of step S102 shown in Fig. 1, and details are not described herein.
In above embodiment, for step S201, the update that is carried out due to the demand of business and to form component withIteration, the data information being passed in component, which may need to format, is just able to satisfy exploitation demand.
Further, reception of beacons rule corresponding with form component can be preset in allocation list, it is unified with thisThe format of institute's output data information is convenient for back-stage management.The rule can be set according to the requirement of different components, when the ruleWhen needing to be modified, can directly it be modified in allocation list.
For step S203, after an input frame input data information of the user in the page, list option can be by the numberIt is believed that breath and corresponding input frame information are sent to data pool and are stored;Wherein, an input frame corresponds to a listOption.In addition, since component hierarchical relationship is complicated, by convenient between component communication and to input information management, instituteThere are data to require to store into data pool.
In addition, each list option corresponds to a form component, each list option has respective identification information, tableUnimodule is corresponding to the identification information.After obtaining data information, it is also based on list option and determines corresponding list groupPart;For example, being parsed to the Property option in option configuration table, according to identification information, for example, the group in secondary attributesPart title type field determines form component corresponding with list option.
Data information for step S204, when the data information inputted meets reception of beacons rule, in data poolIt can issue and be transmitted to form component, to be shown in page table list option to the data information inputted.But works as and do not meetIt when the reception of beacons rule, then needs to format it, for example, being transferred in the data information of component has a dateIt 2017.12.30, but is 12.30.2017 for the format that the date may need to show on the page.
In addition, for front end, showing data, description since page presentation front end is separated with background serverDeng the data information of met user demand;For background server, the information stored is the tool suitable for rear end.With peopleFor people's coin, front end according to require need to by dollar, Euro etc. as unit of shown, this just needs to convert it.In addition,For convenience of follow-up work process, inconvenience brought by work handover is reduced, can set background server is with data informationFormer format is stored, such as RMB, therefore the data information finally stored to backstage needs to return former format.
Overall process when therefore, for data information transfer to form component and last preservation, format conversionConcrete operations can be as follows:
(1) it before transmitting data information to form component, needs to first pass through format converter and converts thereof into accordinglyFormat, for example, RMB is converted to dollar.
It (2), need to be using lattice when being saved to it after carrying out format change to the data information in form componentFormula converter be converted into before format, for example, RMB, which is converted to dollar, converts back RMB again.
For the format converter of format conversion, filter etc. can be.By taking filter as an example, filter type can be withAre as follows:
Key:Value | filter 1 | filter 2 ...
Wherein, Key-Value indicates that key-value pair, the mark that Key is the Value, Value are the conversion of required formatThe data information of processing;Filter is show on the page with list option or the conversion of backstage storage corresponding data information is advisedThen, for example, Conversion of measurement unit, date format between dollar and RMB are converted;It is separated between filter with symbol " | ",And parsed according to sequence from left to right, successively handle data information.
Further, the information for being transmitted to form component can also be comprising data specifying-information etc.;Wherein, data description letterBreath can be the requirement of the content to input list option, for example, requiring password by 8 digits in register account number on WebpageWord composition.Acquisition for data specifying-information can be obtained in data pool based on module information, such as label informationLabel, description is briefly described etc..
In addition, may also pass through the rendering of format component during parsing configuration information generates form component, with unifiedThe format of list option, is convenient for follow-up management, and corresponding call format equally can store in allocation list.
Method provided by above-described embodiment realizes the configurable thinking of form component reception of beacons rule, to meetThe call format that data information is shown on list option embodies the diversity feature of form component;In addition, being based on reception of beaconsRule is configurable and is stored in allocation list, is modified operation to it convenient for developer, reduces later maintenance cost.
Referring to Fig. 3, another optional allocation list radio button method flow signal according to an embodiment of the present invention is shownFigure, includes the following steps:
S301: obtaining configuration information associated with form component, generates allocation list based on configuration information;Wherein, it configuresInformation includes the proof rule of form component.
S302: parsing allocation list generates corresponding form component, shows list option associated with form component.
S303: receiving the data input request to list option, obtains inputted data information.
S304: when data information does not meet proof rule, determining corresponding exception information, and transmission abnormality information is to describedIn form component, to be shown in list option.
In above embodiment, step S302 can be found in the description of step S102 shown in Fig. 1, and step S303 can be found in Fig. 2The description of shown step S203, details are not described herein.
In above embodiment, for step S301, list option, can be based on component to the data before showing dataIt is verified, judges whether to meet the requirement shown in list option.The proof rule equally can store in option configuration tableIn, and it is corresponding to the list option, for example, validation group corresponding to the type type of validation attribute in option configuration tablePart modifies to it convenient for subsequent.
The proof rule include but is not limited to be following rule:
(1) to the length limitation rule of inputted information, for example, password is formed by 16 when login page inputs password;
(2) to the type restriction rule of inputted information, for example, input frame can only input number, letter, punctuation mark orA combination thereof form;
(3) to the size restriction rule of inputted information, the rule is mainly in picture, for example, institute's uploading picturesSize is necessary for 100*100;
(4) to the sequence restriction rule of inputted information, for example, password is formed by 16, first four and four lastIt is made of letter, intermediate eight are made of number.
For step S304, when data information is unsatisfactory for corresponding proof rule, data information can be analyzed from the background and is not inconsistentThe reason of closing proof rule, and corresponding exception information is generated according to the reason, to be shown in forms pages.Exception informationIt can store in the wrong pond in data pool;Wherein, which is used to store the exception information of all components.And by mistakePond, which issues, transmits the exception information to corresponding form component, triggers the rendering again of the form component, is finally presented in the pageOn, to inform user's error reason, improve user's input efficiency.
Further, when data information meets proof rule, subsequent processes can be carried out, but when data information is unsatisfactory forWhen proof rule, which is still stored in data pool, is only based on exception information frame, can prevent afterflow after continuingJourney, so that user can not log in, except non-user is modified the information inputted according to the prompt of exception information.
For example, Password Input frame only allows to input number, but user has input letter, will show " number can only be inputted,Please re-enter " exception information prompt;When user changes inputted letter as number, and passes through verifying, can carry outSubsequent processes, while synchronous proper password is modified the content in data pool.
After user is modified the information inputted, such as change option A is option B, input Password Operations, at this timeThe content after input frame changes it can be triggered to be rendered again, that is, re-start verifying.
It should be noted that the verifying logic that allocation list is supported can cover most proof rule, such as above-mentionedThe length limitation mentioned, type limitation, size require etc., but the form component more complicated there is always some verifying logics,Such as needed there are two input frame while meeting some requirements, corresponding proof rule just can not be at this time configured in allocation list,It needs to verify it using the service for checking credentials (for example, code).
Method provided by above-described embodiment provides the configurable thinking of data verification, so that list option in the pageGeneration it is integrated with verifying, simplify service logic, reduce list code quantity;In addition, the prompt based on exception information,The input efficiency for improving user, accelerates subsequent processes.
Referring to fig. 4, another optional allocation list radio button method flow signal according to an embodiment of the present invention is shownFigure, includes the following steps:
S401: obtaining configuration information associated with form component, generates allocation list based on configuration information;Wherein, it configuresInformation includes the type of form component;Wherein, type is one of dynamic or static state.
S402: parsing allocation list generates corresponding form component, shows list option associated with form component.
S403: receiving the data input request to list option, obtains inputted data information.
S404: when the type of form component is regime type, and receives the display request to data information, number is transmittedIt is believed that ceasing into form component, to be shown in list option.
S404 ': when the type of form component is static types, transmitting data information is into form component, in listIt is shown in option.
In above embodiment, step S402 can be found in the description of step S102 shown in Fig. 1, and step S403 can be found in Fig. 2The description of shown step S203, details are not described herein.
In above embodiment, can have aobvious for step S401 for the content that user is inputted in list optionPoint for showing and not showing, thus, it is possible to corresponding regime type and static types be arranged, for developer's selection, extensionThe selectivity of form component exploitation.
It can be current form group by switching at runtime component if current form option is dynamic for step S404Part is plus switching switch so that the list option can have the function of display and non-display when showing on the page, forFamily selection.
For dynamic list option, there can be following display on the page, such as: whether shows;Wherein, is one multipleFrame is selected, is the equal of a switching switch, data information will be shown after choosing, is chosen if cancelling, does not show data information.
But for static table radio button, data information is directly shown, will not be decided whether by switching switchIt shows.
Method provided by above-described embodiment provides the configurable thinking of display information, so that in list optionMiddle inputted data, can there is the selection of display and non-display, improve user for the usage experience of page table list.
Method provided by the embodiment of the present invention, the thinking of coupling unit carry out height pumping on the basis of modularizationAs proposing a kind of collection option configuration, option generation, Data Format Transform, the integrated implementation of data verification.Pass through the partyCase assembles required function, quickly generates the forms pages for having authentication function, greatly improves the multiplexing of componentProperty and flexibility, avoid repetition and write similar code and code redundancy, while being convenient for the access of third party code, simplifyForm logic, so that list is easily managed, convenient for the maintenance and expansion of list.
Referring to Fig. 5, the main modular for showing a kind of device 600 of allocation list radio button provided in an embodiment of the present invention is shownIt is intended to, comprising:
Module 501 is obtained, for obtaining configuration information associated with form component, is matched based on configuration information generationSet table;
Display module 502 generates corresponding form component, display and the form component for parsing the allocation listAssociated list option.
In implementing device of the present invention, the configuration information includes the reception of beacons rule of the form component;
The display module 502, is also used to:
The data input request to the list option is received, inputted data information is obtained;
When the format of the data information does not meet the reception of beacons rule, according to scheduled format transformation rule,The data information is formatted, the data information after transformat conversion is into the form component, describedIt is shown in list option.
In implementing device of the present invention, the configuration information includes the proof rule of the form component;
The display module 502, is also used to:
The data input request to the list option is received, inputted data information is obtained;
When the data information does not meet the proof rule, corresponding exception information is determined, transmit the abnormal letterBreath is into the form component, to show in the list option.
In implementing device of the present invention, the configuration information includes the type of the form component;Wherein, the type isOne of state or static state;
The display module 502, is also used to:
The data input request to the list option is received, inputted data information is obtained;
When the type of the form component is regime type, and receives the request of the display to the data information, passThe defeated data information is into the form component, to show in the list option;Or
When the type of the form component is static types, the data information is transmitted into the form component, withIt is shown in the list option.
In implementing device of the present invention, the configuration information includes the format display rule of the form component;
The display module 502, is also used to:
Rule is shown according to the format, and format rendering is carried out to the form component, it is described after display format renderingList option.
Device provided by the embodiment of the present invention, the thinking of coupling unit carry out height pumping on the basis of modularizationAs proposing a kind of collection option configuration, option generation, Data Format Transform, the integrated implementation of data verification.Pass through the partyCase assembles required function, quickly generates the forms pages for having authentication function, greatly improves the multiplexing of componentProperty and flexibility, avoid repetition and write similar code and code redundancy, while being convenient for the access of third party code, simplifyForm logic, so that list is easily managed, convenient for the maintenance and expansion of list.
In addition, the specific implementation content of the allocation list radio button device described in embodiments of the present invention, described aboveIt has been described in detail in allocation list radio button method, therefore has no longer illustrated in this duplicate contents.
The allocation list radio button method or allocation list radio button device that can apply the embodiment of the present invention are shown referring to Fig. 6Exemplary system architecture 600.
As shown in fig. 6, system architecture 600 may include terminal device 601,602,603, network 604 and server 605.Network 604 between terminal device 601,602,603 and server 605 to provide the medium of communication link.Network 604 can be withIncluding various connection types, such as wired, wireless communication link or fiber optic cables etc..
User can be used terminal device 601,602,603 and be interacted by network 604 with server 605, to receive or send outSend message etc..Various telecommunication customer end applications, such as the application of shopping class, net can be installed on terminal device 601,602,603(merely illustrative) such as the application of page browsing device, searching class application, instant messaging tools, mailbox client, social platform softwares.
Terminal device 601,602,603 can be the various electronic equipments with display screen and supported web page browsing, packetInclude but be not limited to smart phone, tablet computer, pocket computer on knee and desktop computer etc..
Server 605 can be to provide the server of various services, such as utilize terminal device 601,602,603 to userThe shopping class website browsed provides the back-stage management server (merely illustrative) supported.Back-stage management server can be to receptionTo the data such as information query request analyze etc. processing, and by processing result (such as target push information, product letterBreath -- merely illustrative) feed back to terminal device.
It should be noted that monitoring system safety method provided by the embodiment of the present invention is generally executed by server 605,Correspondingly, monitoring system safety devices are generally positioned in server 605.
It should be understood that the number of terminal device, network and server in Fig. 6 is only schematical.According to realization needIt wants, can have any number of terminal device, network and server.
Referring to Fig. 7, it illustrates the knots of the computer system 700 for the terminal device for being suitable for being used to realize the embodiment of the present inventionStructure schematic diagram.Terminal device shown in Fig. 7 is only an example, should not function and use scope band to the embodiment of the present inventionCarry out any restrictions.
As shown in fig. 7, computer system 700 includes central processing unit (CPU) 701, it can be read-only according to being stored inProgram in memory (ROM) 702 or be loaded into the program in random access storage device (RAM) 703 from storage section 708 andExecute various movements appropriate and processing.In RAM 703, also it is stored with system 700 and operates required various programs and data.CPU 701, ROM 702 and RAM 703 are connected with each other by bus 704.Input/output (I/O) interface 705 is also connected to alwaysLine 704.
I/O interface 705 is connected to lower component: the importation 706 including keyboard, mouse etc.;It is penetrated including such as cathodeThe output par, c 707 of spool (CRT), liquid crystal display (LCD) etc. and loudspeaker etc.;Storage section 708 including hard disk etc.;And the communications portion 709 of the network interface card including LAN card, modem etc..Communications portion 709 via such as becauseThe network of spy's net executes communication process.Driver 710 is also connected to I/O interface 705 as needed.Detachable media 711, such asDisk, CD, magneto-optic disk, semiconductor memory etc. are mounted on as needed on driver 710, in order to read from thereonComputer program be mounted into storage section 708 as needed.
Particularly, disclosed embodiment, the process described above with reference to flow chart may be implemented as counting according to the present inventionCalculation machine software program.For example, embodiment disclosed by the invention includes a kind of computer program product comprising be carried on computerComputer program on readable medium, the computer program include the program code for method shown in execution flow chart.?In such embodiment, which can be downloaded and installed from network by communications portion 709, and/or from canMedium 711 is dismantled to be mounted.When the computer program is executed by central processing unit (CPU) 701, system of the invention is executedThe above-mentioned function of middle restriction.
It should be noted that computer-readable medium shown in the present invention can be computer-readable signal media or meterCalculation machine readable storage medium storing program for executing either the two any combination.Computer readable storage medium for example can be --- but notBe limited to --- electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor system, device or device, or any above combination.MeterThe more specific example of calculation machine readable storage medium storing program for executing can include but is not limited to: have the electrical connection, just of one or more conducting wiresTaking formula computer disk, hard disk, random access storage device (RAM), read-only memory (ROM), erasable type may be programmed read-only storageDevice (EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), light storage device, magnetic memory device,Or above-mentioned any appropriate combination.In the present invention, computer readable storage medium can be it is any include or storage journeyThe tangible medium of sequence, the program can be commanded execution system, device or device use or in connection.And at thisIn invention, computer-readable signal media may include in a base band or as carrier wave a part propagate data-signal,Wherein carry computer-readable program code.The data-signal of this propagation can take various forms, including but unlimitedIn electromagnetic signal, optical signal or above-mentioned any appropriate combination.Computer-readable signal media can also be that computer canAny computer-readable medium other than storage medium is read, which can send, propagates or transmit and be used forBy the use of instruction execution system, device or device or program in connection.Include on computer-readable mediumProgram code can transmit with any suitable medium, including but not limited to: wireless, electric wire, optical cable, RF etc. are above-mentionedAny appropriate combination.
Flow chart and block diagram in attached drawing are illustrated according to the system of various embodiments of the invention, method and computer journeyThe architecture, function and operation in the cards of sequence product.In this regard, each box in flowchart or block diagram can generationA part of one module, program segment or code of table, a part of above-mentioned module, program segment or code include one or moreExecutable instruction for implementing the specified logical function.It should also be noted that in some implementations as replacements, institute in boxThe function of mark can also occur in a different order than that indicated in the drawings.For example, two boxes succeedingly indicated are practicalOn can be basically executed in parallel, they can also be executed in the opposite order sometimes, and this depends on the function involved.Also it wantsIt is noted that the combination of each box in block diagram or flow chart and the box in block diagram or flow chart, can use and execute ruleThe dedicated hardware based systems of fixed functions or operations is realized, or can use the group of specialized hardware and computer instructionIt closes to realize.
Being described in module involved in the embodiment of the present invention can be realized by way of software, can also be by hardThe mode of part is realized.Described module also can be set in the processor, for example, can be described as: a kind of processor packetIt includes and obtains module, display module.Wherein, the title of these modules does not constitute the limit to the module itself under certain conditionsIt is fixed, for example, display module is also described as " list option display module ".
As on the other hand, the present invention also provides a kind of computer-readable medium, which be can beIncluded in equipment described in above-described embodiment;It is also possible to individualism, and without in the supplying equipment.Above-mentioned calculatingMachine readable medium carries one or more program, when said one or multiple programs are executed by the equipment, makesObtaining the equipment includes:
Configuration information associated with form component is obtained, allocation list is generated based on the configuration information;
The allocation list is parsed, corresponding form component is generated, shows list option associated with the form component.
Technical solution according to an embodiment of the present invention, the thinking of coupling unit carry out height on the basis of modularizationIt is abstract, propose a kind of collection option configuration, option generation, Data Format Transform, the integrated implementation of data verification.By thisScheme assembles required function, quickly generates the forms pages for having authentication function, greatly improves answering for componentIt with property and flexibility, avoids repetition and writes similar code and code redundancy, while being convenient for the access of third party code, simplifyForm logic, so that list is easily managed, convenient for the maintenance and expansion of list.
Above-mentioned specific embodiment, does not constitute a limitation on the scope of protection of the present invention.Those skilled in the art should be brightIt is white, design requirement and other factors are depended on, various modifications, combination, sub-portfolio and substitution can occur.It is anyMade modifications, equivalent substitutions and improvements etc. within the spirit and principles in the present invention, should be included in the scope of the present inventionWithin.