CN113760276A - Method and device for generating page code - Google Patents

Method and device for generating page code Download PDF

Info

Publication number
CN113760276A
CN113760276A CN202011097900.4A CN202011097900A CN113760276A CN 113760276 A CN113760276 A CN 113760276A CN 202011097900 A CN202011097900 A CN 202011097900A CN 113760276 A CN113760276 A CN 113760276A
Authority
CN
China
Prior art keywords
component
text
page
generating
code
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011097900.4A
Other languages
Chinese (zh)
Inventor
魏珊珊
王圆圆
杨艳春
范佳宇
董英姿
王小梅
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Wodong Tianjun Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Wodong Tianjun Information Technology Co Ltd
Priority to CN202011097900.4A priority Critical patent/CN113760276A/en
Publication of CN113760276A publication Critical patent/CN113760276A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Human Computer Interaction (AREA)
  • Data Mining & Analysis (AREA)
  • Document Processing Apparatus (AREA)

Abstract

The invention discloses a method and a device for generating a page code, and relates to the technical field of computers. One embodiment of the method comprises: the method comprises the steps of acquiring a corresponding component library and components according to an original page designed by a designer, determining a corresponding second format text according to a set text contained in the first format text by using a first format text description component, and generating component codes based on the first format text and the second format text; and generating a page according to the component codes, calculating the matching degree of the page and the original page, and determining the target code of the generated page according to a set matching degree threshold value. Because different component libraries are selected, including the self-defined component library, the flexibility and the expandability of the generated page are improved; by generating page codes according to the designed page and calculating the matching value, the development time of the project is shortened, and the development efficiency is improved.

Description

Method and device for generating page code
Technical Field
The invention relates to the technical field of computers, in particular to a method and a device for generating page codes.
Background
With the rapid development of the internet technology, in the development process of internet application, high-efficiency and high-quality iterative development needs to be carried out according to new requirements, in the current development process, a user page designer firstly carries out page design on a product, and then the developer carries out development according to the designed page; and finally, page designers carry out reduction degree verification on the developed pages to form a serial work flow, and when the interface is repeatedly changed and the times are more, the project time is prolonged, and the workload of the designers and the developers is increased. In development, some tools can be used for realizing the conversion from page design draft to code, but most of the realized code is based on the basic tag of the document object model, and the code which contains the custom tag, is extensible, can not be maintained and is used for secondary development cannot be generated.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:
in the development process, a developer needs to write a code of a page according to a design draft of a page designer, and the development period is long due to the dependency relationship of the development sequence; the page designer needs to spend time on the verification of the page restoration degree, and meanwhile, the developer modifies the codes based on the verification result of the page designer, so that the development time of the project is prolonged, and the workload of the page designer and the developer is increased; the mode of realizing codes by using the existing tool based on the page design draft has the problem of lacking flexibility and expansibility because a user-defined label, an extensible and maintainable code cannot be generated.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for generating a page code, which can obtain a corresponding component library and a component according to an original page designed by a designer, determine a corresponding second format text according to a set text included in the first format text by using a first format text description component, and generate a component code based on the first format text and the second format text; and generating a page according to the component codes, calculating a matching value of the page and the original page, and determining a target code of the generated page according to a set threshold value. Because different component libraries are selected, including the self-defined component library, the flexibility and the expandability of the generated page are improved; by generating page codes according to the designed page and calculating the matching value, the development time of the project is shortened, and the development efficiency is improved.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided a method for generating page code, including: acquiring a component corresponding to an original page in a component library according to the designed original page, wherein the identifier of the component library and the identifier of the component comprise the same set text; generating component text describing the component in a first format, wherein the component type defined by the component text contains the setting text; determining an intermediate text defining a second format based on the setting text; generating component code based on the component text and the intermediate text; and generating a target page based on the component codes, and taking the component codes as target codes of the generated page when the matching value of the target page and the original page is not less than a set threshold value.
Optionally, the method of generating page code, wherein,
the first format is a JSON structure.
Optionally, the method of generating page code, wherein,
and searching the matched intermediate text according to the set text.
Optionally, the method of generating page code, wherein,
when the intermediate text matching the set text is found, the second format is associated with the component type.
Optionally, the method of generating page code, wherein,
when there is no intermediate text matching the setting text, using a predefined text as the intermediate text, wherein the predefined text defines the second format.
Optionally, the method of generating page code, wherein,
and when the matching value of the target page and the original page is smaller than a set threshold value, modifying the intermediate text, and generating a component code based on the component text and the modified intermediate text.
Optionally, the method of generating page code, wherein,
based on the component code, changing business code corresponding to the component, and generating the target code of the page.
To achieve the above object, according to a second aspect of the embodiments of the present invention, there is provided an apparatus for generating page code, including: the system comprises a component acquisition module, a component text generation module and an object code generation module; wherein the content of the first and second substances,
the component acquisition module is used for acquiring a component corresponding to an original page in a component library according to the designed original page, and the identifier of the component library and the identifier of the component contain the same set text;
the component text generation module is used for generating a component text which describes the component by using a first format, and the component type defined by the component text contains the setting text; determining an intermediate text defining a second format based on the setting text;
the object code generation module is used for generating component codes based on the component texts and the intermediate texts; and generating a target page based on the component codes, and taking the component codes as target codes of the generated page when the matching value of the target page and the original page is not less than a set threshold value.
Optionally, the apparatus for generating page code is characterized in that,
the first format is a JSON structure.
Optionally, the apparatus for generating page code is characterized in that,
and searching the matched intermediate text according to the set text.
Optionally, the apparatus for generating page code is characterized in that,
when the intermediate text matching the set text is found, the second format is associated with the component type.
Optionally, the apparatus for generating page code is characterized in that,
when there is no intermediate text matching the setting text, using a predefined text as the intermediate text, wherein the predefined text defines the second format.
Optionally, the apparatus for generating page code is characterized in that,
and when the matching value of the target page and the original page is smaller than a set threshold value, modifying the intermediate text, and generating a component code based on the component text and the modified intermediate text.
Optionally, the apparatus for generating page code is characterized in that,
based on the component code, changing business code corresponding to the component, and generating the target code of the page.
To achieve the above object, according to a third aspect of the embodiments of the present invention, there is provided an electronic device for generating a page code, including: one or more processors; storage means for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to carry out a method as claimed in any one of the above methods of generating page code.
To achieve the above object, according to a fourth aspect of the embodiments of the present invention, there is provided a computer readable medium having a computer program stored thereon, wherein the program, when executed by a processor, implements any one of the methods of generating page code as described above.
One embodiment of the above invention has the following advantages or benefits: the method comprises the steps that components in a corresponding component library can be obtained according to an original page designed by a designer, a first format text description component is used, a corresponding second format text is determined according to a set text contained in the first format text, and a component code is generated based on the first format text and the second format text; and generating a page according to the component codes, calculating the matching degree of the page and the original page, and determining the component codes of the generated page according to a set matching degree threshold value. Because different component libraries are selected, including the self-defined component library, the flexibility and the expandability of the generated page are improved; by generating page codes according to the designed page and calculating the matching value, the development time of the project is shortened, and the development efficiency is improved.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a flowchart illustrating a method for generating page code according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a process for generating page code according to an embodiment of the present invention;
FIG. 3A is an exemplary diagram of a component text provided by one embodiment of the invention;
FIG. 3B is an exemplary diagram of a second format text provided by one embodiment of the invention;
FIG. 3C is an exemplary diagram of component code provided by one embodiment of the invention;
FIG. 4 is a schematic structural diagram of an apparatus for generating page code according to an embodiment of the present invention;
FIG. 5 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 6 is a schematic block diagram of a computer system suitable for use in implementing a terminal device or server of an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as 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.
As shown in fig. 1, an embodiment of the present invention provides a method for generating page code, where the method may include the following steps:
step S101: according to a designed original page, acquiring a component corresponding to the original page in a component library, wherein the identifier of the component library and the identifier of the component contain the same set text.
Specifically, in a development process of developing an application, a designer is first required to design a page (i.e., an original page) of the application or a web page, where the page may include one or more components, and the components may be of various types, for example: image, view, text, button, etc.; it is understood that when the designer designs the original page, it can also design according to the style and style of the components contained in the component library; further, acquiring components in a component library according to a designed original page, wherein the component library is customized according to the style of application and can also be acquired from a third party; wherein the identifier of the component library and the identifier of the component contain the same setting text. The set Text may be a component library identifier or a prefix of the component identifier, or may also be a suffix of the component library identifier or the component identifier, or a Text of another location, for example, the component library identifier is AAA-lib, and the component identifiers included therein are AAA-Button, AAA-Text, and the like; wherein AAA is the setting text, and it can be understood that the association between the component library and each component is established by the identifier of the component library and the identifier of the component containing the same setting text, so as to further generate the first format text.
The invention does not limit the concrete content and style of the component library, the component library mark, the component mark and the concrete content of the setting text.
Step S102: generating component text describing the component in a first format, wherein the component type defined by the component text contains the setting text; based on the set text, an intermediate text defining a second format is determined.
Specifically, according to the description in step S101, a component in the component library is acquired, and according to the acquired component, a component text is generated, where the component text is described using a first format, for example, the first format is a JSON structure, that is, the first format is a JSON structure. The following illustrates the component text described in the JSON structure (i.e., the first format) with a button component, as shown in FIG. 3A; the type is a component type, the content of the type is AAA-button, and if the component is obtained from a component library AAA-lib, the AAA is a set text; furthermore, the tips is indicated as the attribute of the component, including the self-defined attributes of id, type1, innerText, etc., and the specific content of the component text is not limited by the present invention.
Further, an intermediate text defining the second format is determined based on the set text. Wherein the second format is a set domain specific language format. Specifically, still taking the setting text "AAA" as an example, the present step will be described below with reference to the intermediate text shown in fig. 3B as an example. As shown in fig. 3B, the used intermediate text described in the second format is found and determined according to 'AAA' (AAA is a setting text) in type. indexof ('AAA'), that is, according to the setting text, the matched intermediate text is found. The second format is a self-defined domain specific language format, and a self-defined label can be defined according to the requirement of page design; when the intermediate text matching 'AAA' is found, then the steps as described in B301 in FIG. 3B are performed, where $ { type } indicates the component type; that is, when the intermediate text matching the set text is found, the second format is associated with the component type.
Further, when there is no intermediate text matching the setting text, a predefined text is used as the intermediate text, wherein the predefined text defines the second format. Specifically, when there is no intermediate text matching the set text, the step as described in B302 in fig. 3B is performed, wherein the predefined text defines the second format, and preferably, the predefined format may be a format containing a DOM (Document Object Model) tag. An example is that the intermediate text as described in B302 is' < div $ { classtring } $ { prop } > $ { transform (schema. Where < div … > and </div > are examples of DOM tags.
Step S103: generating component code based on the component text and the intermediate text; and generating a target page based on the component codes, and taking the component codes as target codes of the generated page when the matching value of the target page and the original page is not less than a set threshold value.
Specifically, still describing the present step with the component text example in step S101 (as shown in fig. 3A) and the intermediate text example in step S102 (as shown in fig. 3B), generating a component code based on the component text and the intermediate text, and an example of the component code is shown in fig. 3C, it can be understood that, by the business logic containing the intermediate text, reading the content of the component text, further generating the component code, and based on the component text example in fig. 3A and the intermediate text example shown in B301 in fig. 3B, generating the component code of button as shown in fig. 3C; wherein, C301 shown in fig. 3C is "AAA-button" in the component code, i.e., type in fig. 3A, and is also based on "$ { type }" in fig. 3B; c302 "class" ("AAA-bbb-ccc") shown in fig. 3C is "type" ("AAA-button") in fig. 3A, and is also based on "$ { class string }" in fig. 3B; c303 "id" shown in fig. 3C is "button-1", i.e., id included in the props in fig. 3A; also based on "$ { prop }" in FIG. 3B; c304 "type 1" ("primary") shown in fig. 3C is type1 included in the props in fig. 3A; also based on "$ { prop }" in FIG. 3B; c305 "lnertext" shown in fig. 3C is "button 1", i.e., lnertext included in the pops in fig. 3A; also based on "$ { prop }" in FIG. 3B; c306 shown in fig. 3C, corresponding to type in fig. 3A, is based on '> $ { transform (schema. child) } </$ { type } >' in fig. 3B, and it can be seen that the information in the component code shown in fig. 3C comes from the component text shown in fig. 3A, whose language format follows the intermediate text shown in fig. 3B. That is, based on the component text and the intermediate text, component code is generated.
Further, generating a target page according to the generated component codes; it is to be understood that the target page may be displayed by a browser, and further a matching value between the generated target page and the designed original page is calculated, when the matching value is greater than a set threshold (e.g., 95%), the generated component code is used as the target code of the generated page, and since the rendering of the target page is based on information in the component text (e.g., the "tips" part in fig. 3A) and the information of the component text is related to the requirement of the original page, the matching value may be calculated by comparing images of the target page and the original page, and the specific method for calculating the matching value between the target page and the original page is not limited in the present invention.
It is understood that the above example is based on a button component, a page may contain a plurality of components, the component codes of the components are generated respectively according to similar steps, and the object codes of the page are generated by collecting the component codes. Further, a page is generated according to the target code, the matching value of the generated target page and the designed original page is calculated, and when the matching value is larger than a set threshold (for example: 95%), the generated component code is taken as the target code of the generated page.
Further, when the matching value of the target page and the original page is smaller than the set threshold, the intermediate text is modified, a new component code is generated by modifying the intermediate text (i.e., the text based on the domain specific language format), a new page is generated according to the new component code, and the matching value of the new page and the original page is further calculated.
And further, changing the business code corresponding to the component based on the component code, and generating the target code of the page. Specifically, business logic code associated with a component is altered (which may be added, modified, deleted) based on the generated component code. For example: change (add, modify, delete) the respective services executed by button pressing, and the like. And putting the generated target code into a project used for development, and completing the development of the application related to the page.
Preferably, a visualization platform can be built based on the method described in steps S101-S103, and the visualization platform is input as a designed original page file and output as target code for assisting the development of the application of the page.
As shown in fig. 2, an embodiment of the present invention provides a method for generating page codes, where the method may include the following steps:
step S201: and acquiring a design draft of the original page.
Specifically, regarding the designer designing the original page, the description of acquiring the design draft of the original page is consistent with step S101, and is not described herein again.
Step S202: and determining a component library according to the design draft, and acquiring components in the component library.
Specifically, regarding determining the component library according to the design draft of the original page, and the description of obtaining the components included in the component library is consistent with step S101, which is not described herein again.
Step S203: first format text for each component is generated.
Specifically, the description about generating the text in the first format (i.e., JSON structure) based on the component (i.e., component text) is consistent with step S102, and is not repeated here.
Step S204: a corresponding second format text is determined.
Specifically, the description of determining the second format text (i.e., the intermediate text) according to the setting text included in the component identifier is consistent with step S102, and is not repeated here.
Step S205: component code is generated.
Specifically, the description of generating the component code based on the component text described in step S203 and the intermediate text described in step S204 is consistent with step S103, and is not repeated here.
Step S206: and generating a target page and calculating a matching value with the original page.
Specifically, the page is generated according to the component code, and the description of calculating the matching value between the target page and the original page is consistent with step S103, which is not described herein again.
Step S207: and judging that the matching value is greater than a set threshold value.
If the threshold value is larger than the set threshold value, executing step S209; otherwise, step S208 is performed. Specifically, the description of calculating the matching value between the target page and the original page is consistent with step S103, and is not repeated here.
Step S208: the second format text is modified.
Specifically, when the matching value between the target page and the original page is smaller than the set threshold, the second format text (i.e., the intermediate text) is modified, step S204 is further executed, the component code is generated again in combination with step S203, and the loop judgment is performed until the matching value between the generated target page and the original page is greater than the set threshold. That is, when the matching value between the target page and the original page is smaller than a set threshold, the intermediate text is modified, and a component code is generated based on the component text and the modified intermediate text.
Step S209: the component code is object code that generates the page.
Specifically, the description about generating the object code is consistent with step S103, and is not repeated here.
As shown in fig. 4, an embodiment of the present invention provides an apparatus 400 for generating a page code, including: the method comprises the following steps: a component acquisition module 401, a component text generation module 402 and an object code generation module 403; wherein the content of the first and second substances,
the component obtaining module 401 is configured to obtain, according to a designed original page, a component corresponding to the original page in a component library, where an identifier of the component library and an identifier of the component contain the same setting text;
the component text generation module 402 is configured to generate a component text describing the component in a first format, where a component type defined by the component text includes the setting text; determining an intermediate text defining a second format based on the setting text;
the object code generation module 403 is configured to generate a component code based on the component text and the intermediate text; and generating a target page based on the component codes, and taking the component codes as target codes of the generated page when the matching value of the target page and the original page is not less than a set threshold value.
Optionally, the component text generation module 402 includes that the first format is a JSON structure.
Optionally, the component text generating module 402 is configured to search the matched intermediate text according to the setting text.
Optionally, the component text generating module 402 is configured to, when the intermediate text matching the setting text is found, associate the second format with the component type.
Optionally, the component text generating module 402 is configured to use a predefined text as the intermediate text when there is no intermediate text matching the setting text, where the predefined text defines the second format.
Optionally, the target code generating module 403 is configured to modify the intermediate text when a matching value between the target page and the original page is smaller than a set threshold, and generate a component code based on the component text and the modified intermediate text.
Optionally, the object code generating module 403 is configured to add a business code corresponding to the component based on the component code, and generate the object code of the page.
An embodiment of the present invention further provides an electronic device for generating a page code, including: one or more processors; the storage device is used for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors are enabled to realize the method provided by any one of the above embodiments.
Embodiments of the present invention further provide a computer-readable medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the method provided in any of the above embodiments.
Fig. 5 illustrates an exemplary system architecture 500 to which a method of generating page code or an apparatus for generating page code of an embodiment of the present invention may be applied.
As shown in fig. 5, the system architecture 500 may include terminal devices 501, 502, 503, a network 504, and a server 505. The network 504 serves to provide a medium for communication links between the terminal devices 501, 502, 503 and the server 505. Network 504 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal devices 501, 502, 503 to interact with a server 505 over a network 504 to receive or send messages or the like. The terminal devices 501, 502, 503 may have various client applications installed thereon, such as a web browser application, a search-type application, an instant messaging tool, a mailbox client, and the like.
The terminal devices 501, 502, 503 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 505 may be a server providing various services, such as a background management server providing support for pages designed by users using the terminal devices 501, 502, 503. The background management server can process the received page design draft, generate codes and feed back pages generated according to the codes to the terminal equipment.
It should be noted that the method for generating page codes provided by the embodiment of the present invention is generally executed by the server 505, and accordingly, the apparatus for generating page codes is generally disposed in the server 505.
It should be understood that the number of terminal devices, networks, and servers in fig. 5 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 6, a block diagram of a computer system 600 suitable for use with a terminal device implementing an embodiment of the invention is shown. The terminal device shown in fig. 6 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 6, the computer system 600 includes a Central Processing Unit (CPU)601 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data necessary for the operation of the system 600 are also stored. The CPU 601, ROM 602, and RAM 603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
The following components are connected to the I/O interface 605: an input portion 606 including a keyboard, a mouse, and the like; an output portion 607 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The driver 610 is also connected to the I/O interface 605 as needed. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 610 as necessary, so that a computer program read out therefrom is mounted in the storage section 608 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the 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 illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 609, and/or installed from the removable medium 611. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 601.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination 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 present invention, 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, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. 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 flowchart 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 and/or units described in the embodiments of the present invention may be implemented by software, and may also be implemented by hardware. The described modules and/or units may also be provided in a processor, and may be described as: a processor includes a component acquisition module, a component text generation module, and an object code generation module. The names of these modules do not constitute a limitation to the module itself in some cases, and for example, the component acquisition module may be further described as "a component library and a module of components are determined to be used according to an original page of design".
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 separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: acquiring a component corresponding to an original page in a component library according to the designed original page, wherein the identifier of the component library and the identifier of the component comprise the same set text; generating component text describing the component in a first format, wherein the component type defined by the component text contains the setting text; determining an intermediate text defining a second format based on the setting text; generating component code based on the component text and the intermediate text; and generating a target page based on the component codes, and taking the component codes as target codes of the generated page when the matching value of the target page and the original page is not less than a set threshold value. According to the technical scheme of the embodiment of the invention, the components in the corresponding component library can be obtained according to the original page designed by a designer, the first format text is used for describing the components, the corresponding second format text is determined according to the set text contained in the first format text, and the component codes are generated based on the first format text and the second format text; and generating a page according to the component codes, calculating the matching degree of the page and the original page, and determining the component codes of the generated page according to a set matching degree threshold value. Because different component libraries are selected, including the self-defined component library, the flexibility and the expandability of the generated page are improved; by generating page codes according to the designed page and calculating the matching degree, the development time and workload are reduced, and the development efficiency is improved.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A method of generating page code, comprising:
acquiring a component corresponding to an original page in a component library according to the designed original page, wherein the identifier of the component library and the identifier of the component comprise the same set text;
generating component text describing the component in a first format, wherein the component type defined by the component text contains the setting text; determining an intermediate text defining a second format based on the setting text;
generating component code based on the component text and the intermediate text; and generating a target page based on the component codes, and taking the component codes as target codes of the generated page when the matching value of the target page and the original page is not less than a set threshold value.
2. The method of claim 1,
the first format is a JSON structure.
3. The method of claim 1,
and searching the matched intermediate text according to the set text.
4. The method of claim 3,
when the intermediate text matching the set text is found, the second format is associated with the component type.
5. The method of claim 3,
when there is no intermediate text matching the setting text, using a predefined text as the intermediate text, wherein the predefined text defines the second format.
6. The method of claim 1,
and when the matching value of the target page and the original page is smaller than a set threshold value, modifying the intermediate text, and generating a component code based on the component text and the modified intermediate text.
7. The method according to any one of claims 1 to 6,
based on the component code, changing business code corresponding to the component, and generating the target code of the page.
8. An apparatus for generating page code, comprising: the system comprises a component acquisition module, a component text generation module and an object code generation module; wherein the content of the first and second substances,
the component acquisition module is used for acquiring a component corresponding to an original page in a component library according to the designed original page, and the identifier of the component library and the identifier of the component contain the same set text;
the component text generation module is used for generating a component text which describes the component by using a first format, and the component type defined by the component text contains the setting text; determining an intermediate text defining a second format based on the setting text;
the object code generation module is used for generating component codes based on the component texts and the intermediate texts; and generating a target page based on the component codes, and taking the component codes as target codes of the generated page when the matching value of the target page and the original page is not less than a set threshold value.
9. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-7.
10. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-7.
CN202011097900.4A 2020-10-14 2020-10-14 Method and device for generating page code Pending CN113760276A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011097900.4A CN113760276A (en) 2020-10-14 2020-10-14 Method and device for generating page code

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011097900.4A CN113760276A (en) 2020-10-14 2020-10-14 Method and device for generating page code

Publications (1)

Publication Number Publication Date
CN113760276A true CN113760276A (en) 2021-12-07

Family

ID=78785952

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011097900.4A Pending CN113760276A (en) 2020-10-14 2020-10-14 Method and device for generating page code

Country Status (1)

Country Link
CN (1) CN113760276A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114185531A (en) * 2021-12-17 2022-03-15 北京字节跳动网络技术有限公司 Interface code generation method and device, computer equipment and storage medium
CN116610304A (en) * 2023-07-18 2023-08-18 腾讯科技(深圳)有限公司 Page code generation method, device, equipment and storage medium
CN117331561A (en) * 2023-11-28 2024-01-02 之江实验室 Intelligent low-code page development system and method

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8775559B1 (en) * 2012-01-11 2014-07-08 Amazon Technologies, Inc. Generating network pages using customer-supplied generation code
CN111324352A (en) * 2020-02-27 2020-06-23 中国平安人寿保险股份有限公司 Code generation method of application page and related equipment
CN111367507A (en) * 2020-03-11 2020-07-03 上海东普信息科技有限公司 Page code generation method, device, equipment and storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8775559B1 (en) * 2012-01-11 2014-07-08 Amazon Technologies, Inc. Generating network pages using customer-supplied generation code
CN111324352A (en) * 2020-02-27 2020-06-23 中国平安人寿保险股份有限公司 Code generation method of application page and related equipment
CN111367507A (en) * 2020-03-11 2020-07-03 上海东普信息科技有限公司 Page code generation method, device, equipment and storage medium

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114185531A (en) * 2021-12-17 2022-03-15 北京字节跳动网络技术有限公司 Interface code generation method and device, computer equipment and storage medium
CN114185531B (en) * 2021-12-17 2024-03-29 抖音视界有限公司 Interface code generation method, device, computer equipment and storage medium
CN116610304A (en) * 2023-07-18 2023-08-18 腾讯科技(深圳)有限公司 Page code generation method, device, equipment and storage medium
CN116610304B (en) * 2023-07-18 2024-01-02 腾讯科技(深圳)有限公司 Page code generation method, device, equipment and storage medium
CN117331561A (en) * 2023-11-28 2024-01-02 之江实验室 Intelligent low-code page development system and method
CN117331561B (en) * 2023-11-28 2024-02-13 之江实验室 Intelligent low-code page development system and method

Similar Documents

Publication Publication Date Title
CN107832045B (en) Method and apparatus for cross programming language interface conversion
CN109597617B (en) Method and device for quickly generating service page based on template
CN100444158C (en) Web page rendering mechanism using external programmatic themes
CN107402746B (en) Method and device for automatically generating code file
CN113760276A (en) Method and device for generating page code
CN110780874B (en) Method and device for generating information
CN111104479A (en) Data labeling method and device
CN112487331A (en) Page generation method and device, storage medium and electronic equipment
CN110308907B (en) Data conversion method and device, storage medium and electronic equipment
CN113495730A (en) Resource package generation and analysis method and device
CN110647327A (en) Method and device for dynamic control of user interface based on card
CN112486482A (en) Page display method and device
US20220284371A1 (en) Method, device and medium for a business function page
CN112181408A (en) Method and device for displaying view list on front page of application program
CN115756452A (en) Target page code generation method, device, storage medium and program product
CN109857838B (en) Method and apparatus for generating information
CN114115855A (en) Code multiplexing method and device, computer readable storage medium and electronic equipment
CN113626747A (en) Method and device for generating breadcrumb navigation
CN113110829A (en) Multi-UI component library data processing method and device
CN113110837A (en) Method and device for processing page information
US9052906B2 (en) Modularized customization of a model in a model driven development environment
CN109725932B (en) Method and device for generating description document of application component
CN112882698A (en) Development environment generation method and device, computer storage medium and electronic device
CN113448960A (en) Method and device for importing form file
CN108664535B (en) Information output method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination