A page generation method, device and computer readable storage medium

By obtaining interface metadata and generating page configuration files, the problem of low page generation efficiency in the prior art is solved, and the rapid and efficient generation of functional pages is achieved.

CN114491354BActive Publication Date: 2025-04-18TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202011276120.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-13
Publication Date
2025-04-18
Estimated Expiration
2040-11-13

AI Technical Summary

Technical Problem

The prior art requires learning and understanding of diverse configuration rules when generating pages, resulting in additional learning costs and inefficiency.

Method used

By obtaining the interface metadata of the target interface, determining the page type, and generating a page configuration file based on the interface metadata and page type, the configuration file is finally used to generate the target page, including page layout and interactive logic.

Benefits of technology

It realizes direct generation of functional pages, saving time and cost of development configuration and improving page generation efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114491354B_ABST
    Figure CN114491354B_ABST
Patent Text Reader

Abstract

The embodiment of the present application proposes a page generation method, device and computer-readable storage medium. The method includes: obtaining interface metadata of the target interface, the interface metadata includes one or more of basic interface information, parameters and return values; determining the page type of the target page to be generated according to the interface metadata; generating a page configuration file of the target page according to the interface metadata and the page type; generating the target page using the page configuration file, the target page includes page layout and data, and page interaction logic. Through the present application, the corresponding function page can be directly generated through the interface metadata, thereby improving the efficiency of page generation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of Internet technology, and in particular to a page generation method, device and computer-readable storage medium. Background Art

[0002] With the rapid development of Internet technology, the page design of Internet products such as applications and websites usually directly affects the user's acceptance or preference for Internet products. Web pages are a visual information carrier that presents text, graphics and other information, and are often used to spread and promote various products or businesses. Therefore, it is crucial for Internet products to provide users with pages that meet their preferences.

[0003] At present, the corresponding pages are mainly generated through configuration, which requires learning and understanding the configuration rules related to the page. Due to the different pages to be generated, the corresponding configuration rules will also be diverse, which will lead to additional learning costs. Therefore, how to improve the efficiency of page generation is a technical problem that needs to be solved urgently. Summary of the invention

[0004] The embodiments of the present application propose a page generation method, apparatus, computer device, and computer-readable storage medium, which can directly generate corresponding function pages through interface metadata, thereby improving the efficiency of page generation.

[0005] On the one hand, an embodiment of the present application provides a page generation method, which specifically includes:

[0006] Obtaining interface metadata of the target interface, wherein the interface metadata includes one or more of basic interface information, parameters, and return values;

[0007] Determine the page type of the target page to be generated according to the interface metadata;

[0008] Generate a page configuration file of the target page according to the interface metadata and the page type;

[0009] The target page is generated using the page configuration file, and the target page includes page layout and data, and page interaction logic.

[0010] On one hand, the present application provides a page generation device, which has the function of implementing the above-mentioned model training method. The function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes:

[0011] An acquisition unit, used to acquire interface metadata of a target interface, wherein the interface metadata includes one or more of basic interface information, parameters, and return values;

[0012] A determination unit, configured to determine a page type of a target page to be generated according to the interface metadata;

[0013] A generating unit, configured to generate a page configuration file of the target page according to the interface metadata and the page type;

[0014] The generating unit is further used to generate the target page using the page configuration file, and the target page includes page layout and data, and page interaction logic.

[0015] On one hand, an embodiment of the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the methods in the above embodiments.

[0016] On the one hand, an embodiment of the present application provides a computer storage medium, which stores a computer program. The computer program includes program instructions. When the program instructions are executed by a processor, the methods in the above embodiments are executed.

[0017] On the one hand, an embodiment of the present application provides a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. When the computer instructions are executed by a processor of a computer device, the methods in the above embodiments are executed.

[0018] Through the page generation method of the embodiment of the present application, the computer device can obtain the interface metadata of the target interface, wherein the interface metadata includes one or more of the basic information of the interface, parameters, and return values; then, the computer device can determine the page type of the target page to be generated according to the interface metadata; then, the computer device can generate a page configuration file of the target page according to the interface metadata and the page type; finally, the computer device can directly generate the target page including the page layout, page data, and page interaction logic using the page configuration file. The present application can directly generate the corresponding function page according to the page configuration file through the interface metadata obtained, saving the time cost of development configuration, thereby improving the efficiency of page generation. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0020] Figure 1 It is a schematic diagram of the architecture of a page generation system provided in an embodiment of the present application;

[0021] Figure 2a is a structural diagram of another page generation system provided in an embodiment of the present application;

[0022] Figure 2b It is a code schematic diagram of an interface configuration provided in an embodiment of the present application;

[0023] Figure 2c This is a schematic diagram of a trigger operation for page generation provided in an embodiment of the present application;

[0024] Figure 2d It is a code schematic diagram of a page layout provided in an embodiment of the present application;

[0025] Figure 2e It is a code schematic diagram of a page interaction logic provided in an embodiment of the present application;

[0026] Figure 3 It is a flow chart of a page generation method provided in an embodiment of the present application;

[0027] Figure 4 It is a schematic diagram of a process of generating a page configuration file provided in an embodiment of the present application;

[0028] Figure 5 It is a schematic diagram of a process of generating a page configuration file provided in an embodiment of the present application;

[0029] Figure 6a It is a schematic diagram of a mapping relationship table between field types and controls provided by the implementation of this application;

[0030] Figure 6b It is a schematic diagram of a binding relationship table between fields and controls provided in an embodiment of the present application;

[0031] Figure 7 It is another schematic diagram of a process of generating a page configuration file provided in an embodiment of the present application;

[0032] Figure 8 It is a structural schematic diagram of a page generating device provided in an embodiment of the present application;

[0033] Fig. 9 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0034] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0035] It should be noted that, in this article, the terms "include", "comprises" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element. In addition, components, features, and elements with the same name in different embodiments of the present application may have the same meaning or different meanings, and their specific meanings need to be determined by their explanation in the specific embodiment or further combined with the context of the specific embodiment.

[0036] It should be understood that although the terms first, second, third, etc. may be used herein to describe various information, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of this article, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0037] This application can be applied to the following scenarios: development scenarios with separated front-end and back-end. Specifically, the back-end is responsible for logic development, writing specific functional logic, and providing corresponding functional interfaces for the front-end to call; the front-end directly calls the page configuration file according to the interface definition to generate a target page including page layout, page data, and page interaction logic. Specifically, when the front-end is responsible for obtaining the interface metadata of the target interface, it determines the page type of the target page to be generated according to the interface metadata, and generates the page configuration file of the target page according to the page type and interface metadata. Through this method, after the interface definition is completed, the interface metadata can be obtained, the corresponding functional page can be generated, and the functional page development time can be saved.

[0038] See also Figure 1 , Figure 11 is a schematic diagram of a data processing system architecture provided by an embodiment of the present application. The data processing system architecture diagram includes: a server 140 and a computer device cluster, wherein the computer device cluster may include: computer device 110, computer device 120, ..., computer device 130, etc. The computer device cluster and the server 140 may be directly or indirectly connected via wired or wireless communication, and the present application does not limit this.

[0039] Figure 1 The server 140 shown can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), as well as big data and artificial intelligence platforms.

[0040] Figure 1 The computer device 110, computer device 120, computer device 130, etc. shown in the figure can be a mobile phone, a tablet computer, a laptop computer, a PDA, a mobile Internet device (MID), a vehicle, a roadside device, an aircraft, a wearable device such as a smart watch, a smart bracelet, a pedometer, etc., and other smart devices with a page generation function.

[0041] In a possible implementation, taking computer device 110 as an example, computer device 110 obtains interface metadata of a target interface, wherein the interface metadata includes one or more of basic interface information, parameters, and return values; computer device 110 determines the page type of a target page to be generated according to the interface metadata; computer device 110 generates a page configuration file of the target page according to the interface metadata and the page type; computer device 110 generates the target page using the page configuration file, wherein the target page includes page layout and data, and page interaction logic.

[0042] In one possible implementation, after the computer device 110 obtains the interface metadata of the target interface, wherein the interface metadata includes one or more of basic interface information, parameters, and return values; the computer device 110 sends the interface metadata to the server 140, and the server 140 determines the page type of the target page to be generated according to the interface metadata; the server 140 generates a page configuration file of the target page according to the interface metadata and the page type; then, the server 140 sends the page configuration file to the computer device 110, so that the computer device 110 generates the target page including the page layout, page data, and page interaction logic using the page configuration file.

[0043] It should be noted that the present application can be applied to development scenarios where the front-end and back-end are separated. Specifically, the back-end can be specifically a server 140, and the front-end can be specifically any computer device in a computer device cluster, such as computer device 110. Server 140 is responsible for determining the page type of the target page to be generated based on the interface metadata, and generating a page configuration file for the target page based on the page type and interface metadata. That is, server 140 is responsible for logic development, writing specific functional logic, and providing corresponding functional interfaces for computer device 110 to call; computer device 110 directly calls the page configuration file according to the interface definition to generate a target page including page layout, page data, and page interaction logic.

[0044] It can be understood that the system architecture diagram described in the embodiment of the present application is for more clearly illustrating the technical solution of the embodiment of the present application, and does not constitute a limitation on the technical solution provided in the embodiment of the present application. A person of ordinary skill in the art can know that with the evolution of the system architecture and the emergence of new business scenarios, the technical solution provided in the embodiment of the present application is also applicable to similar technical problems.

[0045] See also Figure 2a-2e , Figure 2a-2e Schematic diagram of a page generation method provided by an embodiment of the present application. Figure 2a As shown, Figure 2a 1 is a schematic diagram of another page generation system provided in an embodiment of the present application. The page generation system may include a document center, a configuration generator, and a code generator.

[0046] In a possible implementation, first, the document center is mainly used to obtain interface metadata, and the document center includes an Api Json tool. The specific method is to call the target interface by calling the Api Json tool to obtain the interface metadata. Then, the interface metadata is sent to the configuration generator, wherein the configuration generator is mainly used to generate a page configuration file. The configuration generator includes a text format converter, which can specifically include: using a text format converter, such as ApiJson Parser, to convert the interface metadata obtained by the document center to a format that can generate a page configuration file. Specifically, the configuration generator can also determine the page type of the page to be generated based on the interface metadata. The page type can specifically include forms and lists. The configuration generator can generate a corresponding page configuration file based on the corresponding page type. Finally, the code generator obtains the page configuration file generated by the configuration generator, and the code generator can generate page layout and page data (Hypertext Markup Language, Html) and interactive logic code (Js) based on the configuration generation file.

[0047] For example, if Figure 2b As shown, Figure 2b It is a code diagram of an interface configuration provided by an embodiment of the present application. Specifically, according to the page generation method provided by the present application, an editor plug-in is implemented, and the vscode plug-in is used here. Figure 2b As shown, first, the computer device obtains the interface call request submitted by the user, wherein the interface call request carries the interface identifier of the target interface, such as Figure 2b , the interface identifier is "800a01c3f81d5320d4c5e7320f08743d"; then, the computer device responds to the interface call request and obtains the interface metadata of the target interface through code annotation or reflection according to the interface identifier, such as Figure 2c , Figure 2c This is a trigger operation diagram of page generation provided by the embodiment of the present application. The user clicks "QfCodeBuilder" to trigger the vscode plug-in to automatically display the interface document. Finally, the computer device can generate the page layout with one click according to the interface document. Figure 2d , Figure 2d It is a code schematic diagram of a page layout provided in an embodiment of the present application, which can generate page interaction logic with one click, such as Figure 2e , Figure 2e It is a code diagram of a page interaction logic provided in an embodiment of the present application.

[0048] Through the page generation method involved in the embodiment of the present application, after the document center obtains the interface metadata, the configuration generator can generate a page configuration file corresponding to the form or the page configuration file corresponding to the list according to the interface metadata. Finally, the code generator generates a page including the page layout and page interaction logic according to the page configuration file with one click. Compared with the existing method that needs to learn and understand the configuration rules to generate the corresponding page, the present application can generate a functional page with one click according to the interface metadata, thereby improving the page generation efficiency.

[0049] See also Figure 3 , Figure 3 is a flow chart of a page generation method provided by an embodiment of the present application. The page generation method is applied to a computer device, such as Figure 3 As shown, the page generation method may include steps S310 to S340. Among them:

[0050] Step S310: Acquire interface metadata of the target interface, where the interface metadata includes one or more of basic interface information, parameters, and return values.

[0051] In a possible implementation, the user packages the interface identifier carrying the target interface into an interface call request, and the user sends the interface call request to the computer device through the user terminal, and the computer device receives the interface call request sent by the user terminal. Then, the computer device responds to the interface call request and obtains the interface metadata of the target interface through code annotation or reflection according to the interface identifier.

[0052] In specific implementation, the computer device can obtain the interface metadata corresponding to the target interface through reflection or with the help of existing third-party components. In computer science, reflection refers to the ability of a computer program to access, detect and modify its own state or behavior at run time. Metaphorically speaking, reflection means that the program can "observe" and modify its own behavior when running. Third-party components include but are not limited to: swagger, javadoc, etc. Interface metadata includes but is not limited to: basic interface information, parameters and return values.

[0053] a. The basic information of the interface may include the following as shown in Table 1.1:

[0054] Interface Information illustrate Example name Interface Name xx query interface Request method GET / POST POST URL Interface call address / xx / xxx

[0055] Table 1.1 Basic information of the interface b. Parameter information may include the following as shown in Table 1.2:

[0056]

[0057] Table 1.2. Parameter information c. The return value may include the following as shown in Table 1.3:

[0058]

[0059] Table 1.3. Return values

[0060] Step S320: determining the page type of the target page to be generated according to the interface metadata.

[0061] In specific implementation, the computer device can determine the page type of the target page to be generated based on the parameters included in the interface metadata, or the computer device can determine the page type of the target page to be generated based on the return value included in the interface metadata, or the computer device can determine the page type of the target page to be generated based on the interface naming rules.

[0062] In one possible implementation, the page type may include a form and a list. The computer device determines the page type of the target page to be generated based on the keywords in the interface naming rule. For example, if the interface naming rule includes the keyword "form", the computer device determines that the page type of the target page to be generated is a form. For another example, if the interface naming rule includes the keyword "list", the computer device determines that the page type of the target page to be generated is a list. For another example, the program developer can define the mapping relationship between the page type and the page identifier in advance, such as "1: list" and "2: form". When the computer device calls the target interface, if the user enters "1", it indicates that the page type of the target page to be generated is a list. Similarly, if the user enters "2", it indicates that the page type of the target page to be generated is a form.

[0063] In a possible implementation, the page type may include a form and a list. The computer device obtains a preset attribute set, wherein the preset attribute set includes a first attribute set and a second attribute set, the first attribute set may include necessary attributes corresponding to the form, and the second attribute set may include necessary attributes corresponding to the list. It should be noted that the necessary attributes are determined according to the corresponding parameter base class or return value base class.

[0064] In specific implementation, the first attribute set may include a form return value base class, wherein the form return value base class may include a newly added form return value base class and a modified form return value base class.

[0065] Among them, the return value base class BaseResponse corresponding to the new form contains the necessary properties as shown in Table 2.1:

[0066] name type illustrate Success bool Indicates whether the call is successful Msg String Tips

[0067] Table 2.1 New form return value base class BaseResponse

[0068] Among them, modify the return value base class BaseResponse corresponding to the form <t>, including the necessary attributes as shown in Table 2.2:

[0069] name type illustrate Success bool Indicates whether the call is successful Msg String Tips Data T(Object) Generic (object type), with all the fields you need

[0070] Table 2.2 Modify the form return value base class BaseResponse <t>

[0071] In specific implementation, the second attribute set may include a list parameter base class and a list return value base class.

[0072] Among them, the list parameter base class ListBaseRequest contains the necessary properties as shown in Table 3.1:

[0073] name type illustrate PageIndex Int List paging properties, which page is currently displayed PageSize Int List paging properties, how many items are displayed per page AllowPaging Bool List paging properties, whether to allow and display paging

[0074] Table 3.1 List parameter base class ListBaseRequest Among them, the list return value base class ListBaseResponse contains the necessary properties as shown in Table 3.2:

[0075] name type illustrate TotalCount Int Total number of data Result Array Data Collection

[0076] Table 3.2 List return value base class ListBaseRequest

[0077] In one possible implementation, if the interface metadata includes each attribute in the first attribute set, the computer device determines that the page type of the target page of the page to be generated is a form. If the interface metadata includes each attribute in the second attribute set, the computer device determines that the page type of the target page of the page to be generated is a list. For example, if the interface metadata includes Success, Msg, or Success, Msg, and Data in the interface metadata, the computer device can determine that the page type of the target page of the page to be generated is a form. For another example, if the interface metadata includes PageIndex, PageSize, and AllowPaging, or the interface metadata includes TotalCount and Result, the computer device can determine that the page type of the target page of the page to be generated is a list.

[0078] Step S330: Generate a page configuration file of the target page according to the interface metadata and the page type.

[0079] In specific implementation, the page configuration file may include: presentation form, data binding and interactive behavior. Among them, the presentation form may include page type, control type, location, name, etc., data binding may include the mapping relationship between page controls and interface parameters or return values, and interactive behavior may include submitting or obtaining data, as well as corresponding interface information.

[0080] like Figure 4 As shown, Figure 4 This is a flow chart of generating a page configuration file provided by an embodiment of the present application. In specific implementation, the computer device first determines the page type of the target page to be generated based on the interface metadata obtained, specifically, whether the page type is a list or a form. Further, the computer device determines the page configuration file of the target page based on the page type and the interface metadata.

[0081] In a possible implementation, the page type includes a form. Generally speaking, for a form page, a general operation includes modifying or adding a function, that is, the computer device determines the function type corresponding to the target page, where the function type may include adding new data and updating data. The computer device generates a page configuration file of the target page according to the interface metadata and the function type.

[0082] In specific implementation, if the function type is to add new data, the computer device generates the field configuration of the target page based on the parameters included in the interface metadata; if the function type is to update data, the computer device generates the field configuration of the target page based on the return value included in the interface metadata.

[0083] For example, if the page type is a form, the interface metadata may include "name", "gender" and "age". If the computer device determines that the function type corresponding to the target page is new data, which means that the interface metadata needs to be added to the form, then the computer device directly uses the "name", "gender" and "age" in the interface metadata as the field configuration of the target page. For another example, if the computer device determines that the function type corresponding to the target page is update data, which means that there are already parameters corresponding to "name", "gender" and "age" in the target page, then the computer device needs to call the interface parameters corresponding to "name", "gender" and "age" respectively, obtain the return value, and generate the field configuration of the target page with the return value included in the interface metadata (such as "name XXX", "gender X" and "age XX").

[0084] In a possible implementation, the page type includes a list. Generally speaking, for a list page, a general operation is a query function, and the computer device determines the query field configuration in the field configuration of the target page based on the parameters included in the interface metadata; the computer device determines the list field configuration in the field configuration of the target page based on the return value included in the interface metadata.

[0085] For example, if the page type is a form, the interface metadata may include "school", "grade", "major", "XXXX university", "XXXX grade" and "XXXX major". Then the computer device may take "school", "grade" and "major" as parameters, and determine "school", "grade" and "major" as query field configurations in the field configuration of the target page; and the computer device may take "XXXX university", "XXXX grade" and "XXXX major" as return values, and determine "XXXX university", "XXXX grade" and "XXXX major" as list field configurations in the field configuration of the target page.

[0086] In a possible implementation, the computer device generates a page configuration file of the target page according to the field configuration of the target page and the mapping relationship between the field type and the control. In a specific implementation, first, the computer device obtains the field type of each field included in the field configuration of the target page; then, the computer device determines the control corresponding to each field according to the field type of each field and the mapping relationship between the field type and the control, wherein the number of controls is at least one; finally, the computer device establishes a binding relationship between each field and the corresponding control. The computer device generates a page configuration file of the target page according to each field, control, and binding relationship.

[0087] Step S340: Generate the target page using the page configuration file, where the target page includes page layout and data, and page interaction logic.

[0088] Specifically, since the page configuration file already contains complete page layout and control type information, the code generation process is just a simple parsing, translation and generation process, that is, the computer device can generate a target page including page layout, page data and page interaction logic through page rendering based on the page configuration file, combined with design specifications and code specifications.

[0089] Among them, the computer device can generate page layout and page data through presentation form and data binding, and the data format of the page data can specifically be HTML format. Furthermore, since the interactive process involved in this method only involves obtaining data display and submitting data, the computer device can use a fixed template to generate page interaction logic. It should be noted that the page generation method involved in this application can also generate code directly without generating a page configuration file, so as to generate a target page according to the code. This solution can have better scalability by generating a page configuration file and then generating a target page, that is, different types of application functions can be generated by parsing the page configuration file, thereby generating different types of function pages.

[0090] Finally, taking the query function of the complaint inquiry list as an example, after completing the query interface, the page generation method provided in the embodiment of this application generates a total of more than 200 lines of code. Since this method is generated with one click, the presentation order or style of some fields needs to be fine-tuned, or some fields do not need to be displayed, and the developer needs to make fine adjustments to the generated code. In the embodiment of this application, the developer needs to make adjustments for less than 50 lines, and the time spent is 1 / 4 of the previous time.

[0091] Through the page generation method provided by the embodiment of the present application, the computer device can obtain the interface metadata of the target interface and determine the page type of the target page to be generated according to the interface metadata, and the page type may include a form and a list; then, the computer device can generate a page configuration file corresponding to the form and a page configuration file corresponding to the list according to the interface metadata and the page type; finally, the computer device can directly generate a target page including a page layout, page data, and page interaction logic using the page configuration file. The present application can directly generate the corresponding target page according to the page configuration file through the interface metadata obtained, saving the time cost of development configuration, thereby improving the efficiency of page generation.

[0092] See also Figure 5 , Figure 5 is a flow chart of generating a page configuration file provided by an embodiment of the present application. The method is applied to a computer device, such as Figure 5 As shown, the embodiment of the present application is specifically Figure 3 In a specific embodiment of step S330 in the embodiment, the process of generating a page configuration file may include steps S510 to S550. Among them:

[0093] Step S510: Obtain the mapping relationship between field types and controls.

[0094] In a possible implementation, after generating the field configuration of the target page, the computer device obtains the mapping relationship between the field type and the control. The mapping relationship between the field type and the control may be pre-defined and directly obtained in the computer device, and the data structure of the mapping relationship may be a table. Figure 6a , Figure 6a This is a schematic diagram of a mapping relationship table between field types and controls provided by the present application. Figure 6a As shown in the figure, if the field type is "String", the corresponding control is the "input box control", if the field type is "Int", the corresponding control is the "input box control", if the field type is "Datetime", the corresponding control is the "time selection control", and if the field type is "Enum", the corresponding control is the "drop-down selection control". Among them, for the field type of "String", a single-line input box or a multi-line input box can be generated according to the maximum length of the field. For the field type of "Enum", the corresponding interface metadata will additionally obtain all elements in the Enum type.

[0095] Step S520: Acquire the field type of each field included in the field configuration of the target page.

[0096] For example, if the field configuration of the target page includes 5 fields, namely field 1, field 2, field 3, field 4 and field 5. The computer device Figure 6a The mapping relationship table between field types and controls shown in the figure can determine the field type of each field. Assume that the field type of field 1 is "String", the field type of field 2 is "Int", the field type of field 3 is "Datetime", the field type of field 4 is "Datetime", and the field type of field 5 is "String".

[0097] Step S530: Determine the control corresponding to each field according to the field type of each field and the mapping relationship between the field type and the control, and the number of the control is at least one.

[0098] For example, the computer device determines that the control corresponding to field 1 is an "input box control", the control corresponding to field 2 is an "input box control", the control corresponding to field 3 is a "time selection control", the control corresponding to field 4 is a "drop-down selection control", and the control corresponding to field 5 is an "input box control".

[0099] Step S540: Establish a binding relationship between each field and the corresponding control.

[0100] For example, since the same type of space may correspond to multiple fields, such as "input box control" corresponds to 3 fields, namely field 1, field 2 and field 5, the computer device needs to establish a binding relationship between each field and the corresponding control, so that each field can correspond to the corresponding control one by one. The data structure of the binding relationship can include a table, for example, see Figure 6b , Figure 6b It is a schematic diagram of a binding relationship table between a field and a control provided in an embodiment of the present application. The binding relationship may specifically include: "field 1" and "input box control s1", "field 2" and "input box control s2", "field 3" and "time selection control t1", "field 4" and "drop-down selection control d1", "field 5" and "input box control s3". It should be noted that "s1", "s2", "t1", "d1" and "s3" can be understood as the unique identifier of each control, thereby establishing a binding relationship between each field and the corresponding control.

[0101] Step S550: Generate a page configuration file of the target page according to each field, the control, and the binding relationship.

[0102] In specific implementation, if the page type of the target page is a form, the computer device obtains the number of fields included in the field configuration of the target page; if the number of fields is less than a preset number threshold, the computer device generates a page configuration file including a single-column form according to each field, control, and binding relationship; if the number of fields is greater than or equal to the preset number threshold, the computer device generates a page configuration file including a multi-column form according to each field, control, and binding relationship.

[0103] For example, if Figure 7 As shown, Figure 7 It is a flow chart of another method for generating a page configuration file of a target page provided by an embodiment of the present application. Specifically, a computer device obtains an existing configuration, wherein the existing configuration includes all the configurations generated according to the interface metadata, and the existing configuration includes each field in the field configuration of the target page, the field type of each field, the mapping relationship between the field type and the control, and the control corresponding to each field, etc. If the page type of the target page is a list, the computer device can generate a page configuration file including a search list. If the page type of the target page is a form, the computer device determines the size relationship between the number of fields included in the field configuration of the target page and the preset number threshold. Specifically, if the preset number threshold is 6 and the number of fields is 8, the computer device generates a page configuration file including a multi-column form according to each field, control, and binding relationship. For a multi-column form, a multi-row input box occupies a single row. For another example, if the number of fields is 3, the computer device generates a page configuration file including a single-column form according to each field, control, and binding relationship.

[0104] Through the method for generating a page configuration file provided in the embodiment of the present application, when the page type of the target page is a form, a page configuration file including a multi-column form or a single-column form can be generated according to the size relationship between the number of fields included in the field configuration and a preset number threshold. In the subsequent page rendering process, the generated target page can meet the user's aesthetic taste and improve the generated user experience.

[0105] See also Figure 8 , Figure 8 It is a structural schematic diagram of a page generating device provided in an embodiment of the present application. Figure 8 The page generation device shown can be used to perform the above Figure 3 to Figure 7 The device may be a computer device, or a device in a computer device, or a device that can be used in conjunction with a computer device. Furthermore, the computer device may be a user terminal or a server.

[0106] In the several embodiments provided in the present application, it should be understood that the disclosed methods, devices and systems can be implemented in other ways. For example, the device embodiments described above are merely schematic; for example, the division of the units is only a logical function division, and there may be other division methods in actual implementation; for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms. The page generation device may include:

[0107] The acquisition unit 810 is used to acquire interface metadata of the target interface, where the interface metadata includes one or more of basic interface information, parameters, and return values;

[0108] A determination unit 820, configured to determine a page type of a target page to be generated according to the interface metadata;

[0109] A generating unit 830, configured to generate a page configuration file of the target page according to the interface metadata and the page type;

[0110] The generating unit 830 is further configured to generate the target page using the page configuration file, wherein the target page includes a page layout and data, and a page interaction logic.

[0111] In a possible implementation, the page type includes a form; the generating unit 830 generates a page configuration file of the target page according to the interface metadata and the page type, including:

[0112] Determine the function type corresponding to the target page, the function type including adding new data and updating data;

[0113] A page configuration file of the target page is generated according to the interface metadata and the function type.

[0114] In a possible implementation, the generating unit 830 generates a page configuration file of the target page according to the interface metadata and the function type, including:

[0115] If the function type is new data, generating the field configuration of the target page based on the parameters included in the interface metadata;

[0116] If the function type is to update data, generating the field configuration of the target page based on the return value included in the interface metadata;

[0117] After generating the field configuration of the target page, obtaining the mapping relationship between the field type and the control;

[0118] A page configuration file of the target page is generated according to the field configuration of the target page and the mapping relationship between the field type and the control.

[0119] In a possible implementation, the page type includes a list; the generating unit 830 generates a page configuration file of the target page according to the interface metadata and the page type, including:

[0120] Determining a query field configuration in the field configuration of the target page based on parameters included in the interface metadata;

[0121] Determine a list field configuration in the field configuration of the target page based on a return value included in the interface metadata;

[0122] Get the mapping relationship between field types and controls;

[0123] A page configuration file of the target page is generated according to the field configuration of the target page and the mapping relationship between the field type and the control.

[0124] In a possible implementation, the page type includes a form and a list; the generating unit 830 determines the page type of the target page to be generated according to the interface metadata, including:

[0125] Obtain a preset attribute set, the preset attribute set including a first attribute set and a second attribute set, the first attribute set including necessary attributes corresponding to the form, the second attribute set including necessary attributes corresponding to the list, the necessary attributes being data determined according to a corresponding parameter base class or a return value base class;

[0126] If the interface metadata includes each attribute in the first attribute set, determining that the page type of the target page to be generated is a form;

[0127] If the interface metadata includes each attribute in the second attribute set, it is determined that the page type of the target page of the to-be-generated page is a list.

[0128] In a possible implementation, the generating unit 830 generates a page configuration file of the target page according to the field configuration of the target page and the mapping relationship between the field type and the control, including:

[0129] Obtaining the field type of each field included in the field configuration of the target page;

[0130] Determine, according to the field type of each field and the mapping relationship between the field type and the control, the control corresponding to each field, where the number of the control is at least one;

[0131] Establishing a binding relationship between each field and a corresponding control;

[0132] A page configuration file of the target page is generated according to each of the fields, the controls, and the binding relationship.

[0133] In a possible implementation, the generating unit 830 generates a page configuration file of the target page according to each field, the control, and the binding relationship, including:

[0134] If the page type of the target page is a form, then obtaining the number of fields included in the field configuration of the target page;

[0135] If the number of the fields is less than a preset number threshold, generating a page configuration file including a single-column form according to each of the fields, the controls, and the binding relationship;

[0136] If the number of the fields is greater than or equal to the preset number threshold, a page configuration file including a multi-column form is generated according to each of the fields, the controls, and the binding relationship.

[0137] In a possible implementation, the acquiring unit 810 acquires the interface metadata of the target interface, including:

[0138] Obtaining an interface call request, wherein the interface call request carries an interface identifier of a target interface;

[0139] In response to the interface call request, the interface metadata of the target interface is obtained according to the interface identifier through code annotation or reflection.

[0140] See also Fig. 9 , Fig. 9 is a schematic diagram of a computer device provided in an embodiment of the present application, the computer device is used to execute Figure 3 to Figure 7 The steps performed by the computer device in the corresponding method embodiment, the server includes: one or more processors 910; one or more input devices 920, one or more output devices 930 and a memory 940. The processor 910, the input device 920, the output device 930 and the memory 940 are connected via a bus 950. The memory 940 is used to store a computer program, the computer program includes program instructions, and the processor 910 is used to execute the program instructions stored in the memory 940 to perform the following operations:

[0141] Obtaining interface metadata of the target interface, wherein the interface metadata includes one or more of basic interface information, parameters, and return values;

[0142] Determine the page type of the target page to be generated according to the interface metadata;

[0143] Generate a page configuration file of the target page according to the interface metadata and the page type;

[0144] The target page is generated using the page configuration file, and the target page includes page layout and data, and page interaction logic.

[0145] In a possible implementation, the page type includes a form; the processor 910 generates a page configuration file of the target page according to the interface metadata and the page type, including:

[0146] Determine the function type corresponding to the target page, the function type including adding new data and updating data;

[0147] A page configuration file of the target page is generated according to the interface metadata and the function type.

[0148] In a possible implementation, the processor 910 generates a page configuration file of the target page according to the interface metadata and the function type, including:

[0149] If the function type is new data, generating the field configuration of the target page based on the parameters included in the interface metadata;

[0150] If the function type is to update data, generating the field configuration of the target page based on the return value included in the interface metadata;

[0151] After generating the field configuration of the target page, obtaining the mapping relationship between the field type and the control;

[0152] A page configuration file of the target page is generated according to the field configuration of the target page and the mapping relationship between the field type and the control.

[0153] In a possible implementation, the page type includes a list; the processor 910 generates a page configuration file of the target page according to the interface metadata and the page type, including:

[0154] Determining a query field configuration in the field configuration of the target page based on parameters included in the interface metadata;

[0155] Determine a list field configuration in the field configuration of the target page based on a return value included in the interface metadata;

[0156] Get the mapping relationship between field types and controls;

[0157] A page configuration file of the target page is generated according to the field configuration of the target page and the mapping relationship between the field type and the control.

[0158] In a possible implementation, the page type includes a form and a list; the processor 910 determines the page type of the target page to be generated according to the interface metadata, including:

[0159] Obtain a preset attribute set, the preset attribute set including a first attribute set and a second attribute set, the first attribute set including necessary attributes corresponding to the form, the second attribute set including necessary attributes corresponding to the list, the necessary attributes being data determined according to a corresponding parameter base class or a return value base class;

[0160] If the interface metadata includes each attribute in the first attribute set, determining that the page type of the target page to be generated is a form;

[0161] If the interface metadata includes each attribute in the second attribute set, it is determined that the page type of the target page of the to-be-generated page is a list.

[0162] In a possible implementation, the processor 910 generates a page configuration file of the target page according to the field configuration of the target page and the mapping relationship between the field type and the control, including:

[0163] Obtaining the field type of each field included in the field configuration of the target page;

[0164] Determine, according to the field type of each field and the mapping relationship between the field type and the control, the control corresponding to each field, where the number of the control is at least one;

[0165] Establishing a binding relationship between each field and a corresponding control;

[0166] A page configuration file of the target page is generated according to each of the fields, the controls, and the binding relationship.

[0167] In a possible implementation, the processor 910 generates a page configuration file of the target page according to each field, the control, and the binding relationship, including:

[0168] If the page type of the target page is a form, then obtaining the number of fields included in the field configuration of the target page;

[0169] If the number of the fields is less than a preset number threshold, generating a page configuration file including a single-column form according to each of the fields, the controls, and the binding relationship;

[0170] If the number of the fields is greater than or equal to the preset number threshold, a page configuration file including a multi-column form is generated according to each of the fields, the controls, and the binding relationship.

[0171] In a possible implementation, the processor 910 obtains the interface metadata of the target interface, including:

[0172] Obtaining an interface call request, wherein the interface call request carries an interface identifier of a target interface;

[0173] In response to the interface call request, the interface metadata of the target interface is obtained according to the interface identifier through code annotation or reflection.

[0174] It should be understood that the computer device described in the embodiments of the present application can execute the above Figure 3 to Figure 7 The description of the data processing method in the corresponding embodiment can also be performed as described above. Figure 8 The description of the page generation device in the corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of adopting the same method will not be repeated here.

[0175] In addition, it should be pointed out here that: the embodiment of the present application also provides a computer storage medium, and the computer storage medium stores a computer program executed by the page generating device mentioned above, and the computer program includes program instructions. When the processor executes the above program instructions, it can execute the above Figure 3 to Figure 7 The method in the corresponding embodiment, therefore, will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated. For technical details not disclosed in the computer storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application. As an example, the program instructions can be deployed on a computer device, or executed on multiple computer devices located in one location, or, executed on multiple computer devices distributed in multiple locations and interconnected by a communication network, and multiple computer devices distributed in multiple locations and interconnected by a communication network can constitute a blockchain system.

[0176] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program comprising computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device can perform the above Figure 3 to Figure 7 The method in the corresponding embodiment will therefore not be described in detail here.

[0177] A person skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the above-mentioned program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The above-mentioned storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.

[0178] The above disclosure is only the preferred embodiment of the present application, which certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.< / t> < / t>

Claims

1. A page generation method, characterized in that: The method comprises: Obtaining interface metadata of the target interface, wherein the interface metadata includes one or more of basic interface information, parameters, and return values; Obtain a preset attribute set, the preset attribute set including a first attribute set and a second attribute set, the first attribute set including necessary attributes corresponding to the form, the second attribute set including necessary attributes corresponding to the list, the necessary attributes being determined according to a corresponding parameter base class or a return value base class; If the interface metadata includes each attribute in the first attribute set, determining that the page type of the target page to be generated is a form; If the interface metadata includes each attribute in the second attribute set, determining that the page type of the target page to be generated is a list; Generate a page configuration file of the target page according to the interface metadata and the page type; The target page is generated using the page configuration file, and the target page includes page layout and data, and page interaction logic.

2. The method according to claim 1, characterized in that The page type includes a form; and the page configuration file of the target page is generated according to the interface metadata and the page type, including: Determine the function type corresponding to the target page, the function type including adding new data and updating data; A page configuration file of the target page is generated according to the interface metadata and the function type.

3. The method according to claim 2, characterized in that The step of generating a page configuration file of the target page according to the interface metadata and the function type includes: If the function type is new data, generating the field configuration of the target page based on the parameters included in the interface metadata; If the function type is to update data, generating the field configuration of the target page based on the return value included in the interface metadata; After generating the field configuration of the target page, obtaining the mapping relationship between the field type and the control; A page configuration file of the target page is generated according to the field configuration of the target page and the mapping relationship between the field type and the control.

4. The method according to claim 1, characterized in that: The page type includes a list; the page configuration file of the target page is generated according to the interface metadata and the page type, including: Determining a query field configuration in the field configuration of the target page based on parameters included in the interface metadata; Determine a list field configuration in the field configuration of the target page based on a return value included in the interface metadata; Get the mapping relationship between field types and controls; A page configuration file of the target page is generated according to the field configuration of the target page and the mapping relationship between the field type and the control.

5. The method according to claim 3 or 4, characterized in that: The step of generating a page configuration file of the target page according to the field configuration of the target page and the mapping relationship between the field type and the control includes: Obtaining the field type of each field included in the field configuration of the target page; Determine, according to the field type of each field and the mapping relationship between the field type and the control, the control corresponding to each field, where the number of the control is at least one; Establishing a binding relationship between each field and a corresponding control; A page configuration file of the target page is generated according to each of the fields, the controls, and the binding relationship.

6. The method according to claim 5, characterized in that The step of generating a page configuration file of the target page according to each field, the control, and the binding relationship includes: If the page type of the target page is a form, then obtaining the number of fields included in the field configuration of the target page; If the number of the fields is less than a preset number threshold, generating a page configuration file including a single-column form according to each of the fields, the controls, and the binding relationship; If the number of the fields is greater than or equal to the preset number threshold, a page configuration file including a multi-column form is generated according to each of the fields, the controls, and the binding relationship.

7. The method according to claim 1, characterized in that The step of obtaining the interface metadata of the target interface includes: Obtaining an interface call request, wherein the interface call request carries an interface identifier of a target interface; In response to the interface call request, the interface metadata of the target interface is obtained according to the interface identifier through code annotation or reflection.

8. A page generating device, characterized in that: include: An acquisition unit, used to acquire interface metadata of a target interface, wherein the interface metadata includes one or more of basic interface information, parameters, and return values; The acquisition unit is further used to acquire a preset attribute set, the preset attribute set includes a first attribute set and a second attribute set, the first attribute set includes necessary attributes corresponding to the form, the second attribute set includes necessary attributes corresponding to the list, and the necessary attributes are determined according to the corresponding parameter base class or return value base class; a determining unit, configured to determine that the page type of the target page to be generated is a form if the interface metadata includes each attribute in the first attribute set; The determining unit is further configured to determine that the page type of the target page to be generated is a list if the interface metadata includes each attribute in the second attribute set; A generating unit, configured to generate a page configuration file of the target page according to the interface metadata and the page type; The generating unit is further used to generate the target page using the page configuration file, and the target page includes page layout and data, and page interaction logic.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and the program instructions are executed by a processor to perform the method according to any one of claims 1 to 7.

10. A computer program product, characterized in that The computer program product comprises computer instructions, which are stored in a computer-readable storage medium. When the computer instructions are executed by a processor of a computer device, they are used to execute the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Application program page generation method and device, computer equipment and storage medium

    CN108446116A