Page preview method and device, computer equipment, storage medium and computer program product
By compiling and processing each page of the project, obtaining static resources and dynamic resource proxy addresses, processing them separately and quickly responding to generate page preview results, the problem of low preview efficiency in traditional page preview methods is solved, and efficient page preview is achieved .
Patent Information
- Application Number
- CN202411018089.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-29
- Publication Date
- 2024-12-03
AI Technical Summary
The traditional page preview method is inefficient in the preview due to overall loading during the development of the project. As the project volume increases, the page preview time increases, resulting in low preview efficiency.
By compiling and processing each page of the project, we obtain static resources and dynamic resource proxy addresses, process static resources and dynamic resources separately, and when receiving page preview requests, we determine the target resource address from the proxy server and quickly respond to generate pages. Preview results.
It improves the efficiency and accuracy of page preview, reduces waiting time, ensures that the preview side obtains accurate and complete page resources, avoids the problem of excessive time caused by overall loading, and improves the preview efficiency.
Smart Images

Figure CN119066281A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a page preview method, device, computer equipment, computer-readable storage medium, and computer program product. Background Art
[0002] In the process of project development, it is very important to preview the project page in order to timely discover the problems in the project development.
[0003] In traditional technology, when previewing a project page, a whole loading method is generally adopted; however, as the size of the project increases over time, the page preview consumes more time, resulting in lower preview efficiency of the page preview. Summary of the invention
[0004] Based on this, it is necessary to provide a page preview method, apparatus, computer device, computer-readable storage medium and computer program product that can improve the preview efficiency of page preview in response to the above technical problems.
[0005] In a first aspect, the present application provides a page preview method, which is applied to a page compilation end, comprising:
[0006] Compile each page under the project to obtain the static resources of each page and the dynamic resource proxy address of each page, and send the dynamic resources associated with the dynamic resource proxy address of each page to the proxy server of each page; the proxy server of each page is used to represent the proxy server corresponding to the dynamic resource proxy address of each page;
[0007] Receiving a page preview request for a page to be previewed in each of the pages sent by the page preview end;
[0008] According to the page preview request, determining the target static resource and target dynamic resource proxy address of the page to be previewed from the static resource and dynamic resource proxy address of each page;
[0009] Determine a target proxy server corresponding to the target dynamic resource proxy address from each of the proxy servers, and send the page preview request to the target proxy server;
[0010] Receive the target dynamic resource of the page to be previewed returned by the target proxy server according to the page preview request, and send the target static resource and the target dynamic resource corresponding to the page to be previewed to the page preview end, so that the page preview end generates a target page preview result corresponding to the page to be previewed according to the target static resource and the target dynamic resource corresponding to the page to be previewed.
[0011] In one embodiment, compiling each page under the project to obtain the static resources of each page and the dynamic resource proxy address of each page includes:
[0012] Compile each page of the project through the compilation instruction to obtain the sub-static resource of the preset format corresponding to each page;
[0013] The sub-static resource in the preset format corresponding to each page is used as the static resource of each page.
[0014] In one embodiment, the step of compiling each page under the project to obtain the static resources of each page and the dynamic resource proxy address of each page further includes:
[0015] Obtaining the page address and proxy identifier of each page;
[0016] According to the page address of each page and the proxy identifier, the dynamic resource proxy address of each page is obtained.
[0017] In one embodiment, obtaining the dynamic resource proxy address of each page according to the page address of each page and the proxy identifier includes:
[0018] Select candidate proxy servers that meet preset conditions from the initial proxy servers;
[0019] Determine a proxy server for each page from the candidate proxy servers; obtain the server address of the proxy server for each page;
[0020] The server address of the proxy server of each page, the page address and the proxy identifier are combined to obtain the dynamic resource proxy address of each page.
[0021] In one embodiment, sending the dynamic resources associated with the dynamic resource proxy address of each page to the proxy server of each page includes:
[0022] Identifying the page address of each page from the dynamic resource proxy address of each page;
[0023] Establishing a network path for each page according to the page address of each page and the dynamic resource proxy address of each page;
[0024] According to the network path of each page, the dynamic resource associated with the dynamic resource proxy address of each page is sent to the proxy server of each page.
[0025] In one embodiment, determining the target static resource and the target dynamic resource proxy address of the page to be previewed from the static resource and the dynamic resource proxy address of each page according to the page preview request includes:
[0026] Parsing the page preview request to obtain parsing information;
[0027] According to the parsing information, the static resource and dynamic resource proxy address corresponding to the parsing information are determined from the static resource and dynamic resource proxy address of each page, and the corresponding target static resource and target dynamic resource proxy address are used as the page to be previewed.
[0028] In a second aspect, the present application further provides a page preview device, which is applied to a page compilation end, comprising:
[0029] The page compilation module is used to compile each page under the engineering project, obtain the static resources of each page and the dynamic resource proxy address of each page, and send the dynamic resources associated with the dynamic resource proxy address of each page to the proxy server of each page; the proxy server of each page is used to indicate the proxy server corresponding to the dynamic resource proxy address of each page;
[0030] A request receiving module, used for receiving a page preview request for a page to be previewed in each of the pages sent by the page preview end;
[0031] A target determination module, configured to determine, according to the page preview request, a target static resource and a target dynamic resource proxy address of the page to be previewed from the static resource and dynamic resource proxy address of each page;
[0032] A request sending module, used to determine a target proxy server corresponding to the target dynamic resource proxy address from each of the proxy servers, and send the page preview request to the target proxy server;
[0033] The resource sending module is used to receive the target dynamic resource of the page to be previewed returned by the target proxy server according to the page preview request, and send the target static resource and target dynamic resource corresponding to the page to be previewed to the page preview end, so that the page preview end generates the target page preview result corresponding to the page to be previewed according to the target static resource and target dynamic resource corresponding to the page to be previewed.
[0034] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0035] Compile each page under the project to obtain the static resources of each page and the dynamic resource proxy address of each page, and send the dynamic resources associated with the dynamic resource proxy address of each page to the proxy server of each page; the proxy server of each page is used to represent the proxy server corresponding to the dynamic resource proxy address of each page;
[0036] Receiving a page preview request for a page to be previewed in each of the pages sent by the page preview end;
[0037] According to the page preview request, determining the target static resource and target dynamic resource proxy address of the page to be previewed from the static resource and dynamic resource proxy address of each page;
[0038] Determine a target proxy server corresponding to the target dynamic resource proxy address from each of the proxy servers, and send the page preview request to the target proxy server;
[0039] Receive the target dynamic resource of the page to be previewed returned by the target proxy server according to the page preview request, and send the target static resource and the target dynamic resource corresponding to the page to be previewed to the page preview end, so that the page preview end generates a target page preview result corresponding to the page to be previewed according to the target static resource and the target dynamic resource corresponding to the page to be previewed.
[0040] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:
[0041] Compile each page under the project to obtain the static resources of each page and the dynamic resource proxy address of each page, and send the dynamic resources associated with the dynamic resource proxy address of each page to the proxy server of each page; the proxy server of each page is used to represent the proxy server corresponding to the dynamic resource proxy address of each page;
[0042] Receiving a page preview request for a page to be previewed in each of the pages sent by the page preview end;
[0043] According to the page preview request, determining the target static resource and target dynamic resource proxy address of the page to be previewed from the static resource and dynamic resource proxy address of each page;
[0044] Determine a target proxy server corresponding to the target dynamic resource proxy address from each of the proxy servers, and send the page preview request to the target proxy server;
[0045] Receive the target dynamic resource of the page to be previewed returned by the target proxy server according to the page preview request, and send the target static resource and the target dynamic resource corresponding to the page to be previewed to the page preview end, so that the page preview end generates a target page preview result corresponding to the page to be previewed according to the target static resource and the target dynamic resource corresponding to the page to be previewed.
[0046] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:
[0047] Compile each page under the project to obtain the static resources of each page and the dynamic resource proxy address of each page, and send the dynamic resources associated with the dynamic resource proxy address of each page to the proxy server of each page; the proxy server of each page is used to represent the proxy server corresponding to the dynamic resource proxy address of each page;
[0048] Receiving a page preview request for a page to be previewed in each of the pages sent by the page preview end;
[0049] According to the page preview request, determining the target static resource and target dynamic resource proxy address of the page to be previewed from the static resource and dynamic resource proxy address of each page;
[0050] Determine a target proxy server corresponding to the target dynamic resource proxy address from each of the proxy servers, and send the page preview request to the target proxy server;
[0051] Receive the target dynamic resource of the page to be previewed returned by the target proxy server according to the page preview request, and send the target static resource and the target dynamic resource corresponding to the page to be previewed to the page preview end, so that the page preview end generates a target page preview result corresponding to the page to be previewed according to the target static resource and the target dynamic resource corresponding to the page to be previewed.
[0052] The page preview method, device, computer equipment, storage medium and computer program product first compile and process each page under the engineering project to obtain the static resources of each page and the dynamic resource proxy address of each page, and respectively send the dynamic resources associated with the dynamic resource proxy address of each page to the proxy server corresponding to the dynamic resource proxy address of each page, and then receive the page preview request for the page to be previewed in each page sent by the page preview end, and then, according to the page preview request, determine the target static resource and target dynamic resource proxy address of the page to be previewed from the static resources and dynamic resource proxy address of each page, and then determine the target proxy server corresponding to the target dynamic resource proxy address from each proxy server, and send the page preview request to the target proxy server, and finally receive the target dynamic resource of the page to be previewed returned by the target proxy server according to the page preview request, and send the target static resource and target dynamic resource corresponding to the page to be previewed to the page preview end, so that the page preview end generates the target page preview result corresponding to the page to be previewed according to the target static resource and target dynamic resource corresponding to the page to be previewed. In this way, in the process of page preview for the engineering project, the page is compiled in advance, and static resources and dynamic resources are processed separately, so that a quick response can be made when a preview request is received later, thereby reducing waiting time, improving the timeliness of the preview, and ensuring that the preview end can obtain accurate and complete page resources, and generate a preview result that is highly consistent with the actual effect, which is conducive to improving the efficiency and accuracy of the page preview; moreover, the method can preview a single page, avoiding the defect of low preview efficiency caused by the excessive time consumed by the overall loading method for page preview, thereby improving the preview efficiency of the page preview. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0054] Figure 1A diagram of an application environment of a page preview method in an embodiment;
[0055] Figure 2 A schematic diagram of a flow chart of a page preview method in one embodiment;
[0056] Figure 3 A flowchart of the steps of obtaining the dynamic resource proxy address of each page in one embodiment;
[0057] Figure 4 A schematic diagram of a flow chart of a page preview method in another embodiment;
[0058] Figure 5 is a structural block diagram of a page preview device in one embodiment;
[0059] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0060] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0061] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0062] The page preview method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown in FIG. 1 , the page compilation end 104 communicates with the page preview end 102 and the proxy server 106 through the network. Figure 1The page compiling end 104 compiles each page under the project to obtain the static resources of each page and the dynamic resource proxy address of each page, and sends the dynamic resources associated with the dynamic resource proxy address of each page to the proxy server 106 of each page respectively; the page compiling end 104 receives the page preview request for the page to be previewed in each page sent by the page preview end 102; the page compiling end 104 determines the target static resources and target dynamic resource proxy address of the page to be previewed from the static resources and dynamic resource proxy address of each page according to the page preview request; the page compiling end 104 determines the target proxy server corresponding to the target dynamic resource proxy address from each proxy server 106, and sends the page preview request to the target proxy server; the page compiling end 104 receives the target dynamic resource of the page to be previewed returned by the target proxy server according to the page preview request, and sends the target static resource and target dynamic resource corresponding to the page to be previewed to the page preview end 102, so that the page preview end 102 generates the target page preview result corresponding to the page to be previewed according to the target static resource and target dynamic resource corresponding to the page to be previewed. The page preview terminal 102 may be a terminal or a server; the page compilation terminal 104 may be a terminal or a server; the proxy server 106 of each page is used to indicate the server corresponding to the dynamic resource proxy address of each page. The terminal may be, but is not limited to, various personal computers, laptops, smart phones, and tablet computers. The server may be implemented as an independent server or a server cluster consisting of multiple servers.
[0063] In an exemplary embodiment, Figure 2 As shown, a page preview method is provided, which is applied to Figure 1 The page compilation end in the example is used to illustrate, which specifically includes the following steps:
[0064] Step S201, compile each page under the project to obtain the static resources of each page and the dynamic resource proxy address of each page, and send the dynamic resources associated with the dynamic resource proxy address of each page to the proxy server of each page; the proxy server of each page is used to represent the proxy server corresponding to the dynamic resource proxy address of each page.
[0065] Among them, engineering projects are used to represent a collection of related tasks and activities carried out using computer technology to achieve specific goals, such as software development projects, network engineering projects, etc.
[0066] Among them, each page under the project refers to a specific interface displayed in the software, system or application, such as a function page, information display page, etc.
[0067] The compilation process refers to the process of obtaining the corresponding static resources and dynamic resource proxy addresses of each page under the project. It should be noted that the compilation process is also called single-page compilation.
[0068] Among them, static resources refer to the resources that can be statically accessed in each page.
[0069] The dynamic resource proxy address refers to the address where the dynamic resource is located.
[0070] Among them, dynamic resources refer to resources whose content in each page changes in real time according to different conditions and user operations.
[0071] Exemplarily, the page compilation end obtains the compilation instruction, and determines the project corresponding to the compilation instruction from the candidate project according to the compilation instruction; then, the page compilation end obtains each page under the project corresponding to the compilation instruction, and compiles each page under the project corresponding to the compilation instruction to obtain the static resources of each page and the dynamic resource proxy address of each page; then, the page compilation end sends the dynamic resources associated with the dynamic resource proxy address of each page to the proxy server corresponding to the dynamic resource proxy address of each page.
[0072] Step S202: receiving a page preview request for each page to be previewed sent by the page preview terminal.
[0073] The page to be previewed refers to a page that needs to be previewed. In an actual scenario, the page to be previewed is a single page.
[0074] The page preview request refers to request information corresponding to previewing the page to be previewed.
[0075] Exemplarily, the page compiling end builds a network path with the page previewing end, and receives a page preview request for each page to be previewed in the page sent by the page previewing end through the network path.
[0076] Step S203: According to the page preview request, the target static resource and the target dynamic resource proxy address of the page to be previewed are determined from the static resource and the dynamic resource proxy address of each page.
[0077] The target static resource refers to the static resource of the page to be previewed.
[0078] The target dynamic resource proxy address refers to the target dynamic resource proxy address of the page to be previewed.
[0079] Exemplarily, the page compilation end determines, based on the page preview request, from the static resources of each page, the static resource corresponding to the page preview request as the target static resource of the page to be previewed; then, the page compilation end determines, based on the page preview request, from the dynamic resource proxy address of each page, the dynamic resource proxy address corresponding to the page preview request as the target dynamic resource proxy address of the page to be previewed.
[0080] Step S204: determine a target proxy server corresponding to the target dynamic resource proxy address from among the proxy servers, and send the page preview request to the target proxy server.
[0081] The target proxy server refers to the proxy server corresponding to the target dynamic resource proxy address.
[0082] Exemplarily, the page compiling end determines a proxy server corresponding to the target dynamic resource proxy address from various proxy servers as the target proxy server; then, the page compiling end sends the page preview request to the target proxy server.
[0083] Step S205, receiving the target dynamic resources of the page to be previewed returned by the target proxy server according to the page preview request, and sending the target static resources and target dynamic resources corresponding to the page to be previewed to the page preview end, so that the page preview end generates a target page preview result corresponding to the page to be previewed according to the target static resources and target dynamic resources corresponding to the page to be previewed.
[0084] The target dynamic resource refers to the dynamic resource of the page to be previewed.
[0085] The target page preview result is used to represent the page preview status corresponding to the page to be previewed.
[0086] Exemplarily, the page compilation end receives the target dynamic resources of the page to be previewed returned by the target proxy server according to the page preview request, and sends the target static resources and target dynamic resources corresponding to the page to be previewed to the page preview end; the page preview end generates a page preview result corresponding to the target static resources and target dynamic resources of the page to be previewed according to the target static resources and target dynamic resources corresponding to the page to be previewed, as the target page preview result corresponding to the page to be previewed; for example, the page preview end integrates the target static resources and target dynamic resources corresponding to the page to be previewed to obtain the initial page preview result corresponding to the page to be previewed; then, the page preview end identifies the error information (such as resource loading problems, code logic errors, compatibility problems, etc.) appearing in the initial page preview result corresponding to the page to be previewed, and processes the error information to obtain the processed initial page preview result as the target page preview result corresponding to the page to be previewed.
[0087] In the above page preview method, each page under the project is first compiled and processed to obtain the static resources of each page and the dynamic resource proxy address of each page, and the dynamic resources associated with the dynamic resource proxy address of each page are sent to the proxy server corresponding to the dynamic resource proxy address of each page, and then a page preview request for the page to be previewed in each page sent by the page preview end is received. Then, according to the page preview request, the target static resources and target dynamic resource proxy address of the page to be previewed are determined from the static resources and dynamic resource proxy address of each page, and then, the target proxy server corresponding to the target dynamic resource proxy address is determined from each proxy server, and the page preview request is sent to the target proxy server. Finally, the target dynamic resource of the page to be previewed returned by the target proxy server according to the page preview request is received, and the target static resource and target dynamic resource corresponding to the page to be previewed are sent to the page preview end, so that the page preview end generates a target page preview result corresponding to the page to be previewed according to the target static resource and target dynamic resource corresponding to the page to be previewed. In this way, in the process of page preview for the engineering project, the page is compiled in advance, and static resources and dynamic resources are processed separately, so that a quick response can be made when a preview request is received later, thereby reducing waiting time, improving the timeliness of the preview, and ensuring that the preview end can obtain accurate and complete page resources, and generate a preview result that is highly consistent with the actual effect, which is conducive to improving the efficiency and accuracy of the page preview; moreover, the method can preview a single page, avoiding the defect of low preview efficiency caused by the excessive time consumed by the overall loading method for page preview, thereby improving the preview efficiency of the page preview.
[0088] In an exemplary embodiment, the above step S201 compiles each page under the project to obtain the static resources of each page and the dynamic resource proxy address of each page, and specifically includes the following contents: compile each page under the project through compilation instructions to obtain the sub-static resources in a preset format corresponding to each page; use the sub-static resources in a preset format corresponding to each page as the static resources of each page.
[0089] The compile instruction refers to the instruction information corresponding to the compile process of each page under the project. It should be noted that the compile instruction is also called the project command.
[0090] The sub-static resources of preset formats refer to a variety of static resources with preset formats, such as HTML (HyperText Markup Language), CSS (Cascading Style Sheets), and JS (JavaScript, a scripting language) files.
[0091] Exemplarily, the page compiler compiles each page under the project through compilation instructions and a single-page template (a compilation script), as well as the path of the vue (a progressive framework for building user interfaces) page relative to the project, and obtains the HTML, CSS, and JS files corresponding to each page as sub-static resources in a preset format corresponding to each page; then, the page compiler uses the sub-static resources in the preset format corresponding to each page as the static resources of each page.
[0092] In this embodiment, the static resources of each page are obtained by compiling in advance, without the need to generate them in real time when a request is received, thereby greatly improving the efficiency of obtaining the static resources of each page; moreover, the preset format ensures that the static resources of each page have unified specifications, which is convenient for management, maintenance and subsequent processing.
[0093] In an exemplary embodiment, Figure 3 As shown, the above step S201 compiles each page under the project to obtain the static resources of each page and the dynamic resource proxy address of each page, which specifically includes the following steps:
[0094] Step S301, obtaining the page address and proxy identifier of each page.
[0095] Step S302, obtaining the dynamic resource proxy address of each page according to the page address and proxy identifier of each page.
[0096] The page address refers to the path information of each page relative to the project.
[0097] The proxy identifier is used to represent the identifier of the dynamic resource that needs to be obtained. In actual scenarios, the proxy identifier is a fixed string of characters defined by the system by default. It should be noted that the proxy identifier is also called the proxy prefix.
[0098] Exemplarily, the page compilation end obtains the page address and proxy identifier of each page; then, the page compilation end obtains the dynamic resource proxy address corresponding to the page address and proxy identifier of each page according to the page address and proxy identifier of each page, and the correspondence between the page address, the proxy identifier and the dynamic resource proxy address, as the dynamic resource proxy address of each page.
[0099] In this embodiment, by clarifying the page address and proxy identifier of each page, the corresponding dynamic resource proxy address can be accurately obtained, avoiding confusion and errors in resource requests and improving the accuracy of resource access; moreover, accurate resource positioning and management can reduce the risk of system failures caused by resource access errors and enhance the stability of the system.
[0100] In an exemplary embodiment, the above step S302 obtains the dynamic resource proxy address of each page based on the page address and proxy identifier of each page, and specifically includes the following contents: screening out candidate proxy servers that meet preset conditions from the initial proxy servers; determining the proxy server for each page from the candidate proxy servers; obtaining the server address of the proxy server for each page; combining the server address, page address and proxy identifier of the proxy server for each page to obtain the dynamic resource proxy address of each page.
[0101] The initial proxy server refers to all servers that can perform proxy operations.
[0102] The preset condition refers to a pre-set screening condition, such as a preset load.
[0103] The candidate proxy server refers to an initial proxy server that meets preset conditions.
[0104] The server address refers to the IP (Internet Protocol) address of the proxy server of each page.
[0105] Exemplarily, the page compiling end selects the initial proxy servers that meet the preset conditions from the initial proxy servers as candidate proxy servers; for example, the page compiling end obtains the load corresponding to each initial proxy server, and selects the initial proxy servers whose corresponding load is less than the preset load from the initial proxy servers as candidate proxy servers; then, the page compiling end sorts the candidate proxy servers according to the order of the loads corresponding to the candidate proxy servers from large to small, and obtains the sorted candidate proxy servers; then, the page compiling end obtains the page sequence corresponding to each page, and determines the proxy server of each page from the candidate proxy servers according to the page sequence corresponding to each page and the sorted candidate proxy servers; then, the page compiling end obtains the server address of the proxy server of each page; then, the page compiling end combines the server address of the proxy server of each page, the page address and the proxy identifier in a combination order (such as the server address of the proxy server of each page + the proxy identifier + the page address) to obtain the combined address as the dynamic resource proxy address of each page.
[0106] In this embodiment, by screening candidate proxy servers that meet preset conditions, it is possible to ensure that the selected proxy servers have sufficient performance, thereby improving the quality of dynamic resource proxy address allocation; moreover, by combining the server address, page address and proxy identifier of the proxy server of each page, the accurate dynamic resource proxy address of each page can be obtained, providing data support for subsequent processing processes.
[0107] In an exemplary embodiment, the above step S201, respectively sending the dynamic resources associated with the dynamic resource proxy address of each page to the proxy server of each page, specifically includes the following contents: identifying the page address of each page from the dynamic resource proxy address of each page; establishing a network path for each page according to the page address of each page and the dynamic resource proxy address of each page; respectively sending the dynamic resources associated with the dynamic resource proxy address of each page to the proxy server of each page according to the network path of each page.
[0108] The network path refers to a path established based on the page address of each page and the dynamic resource proxy address.
[0109] Exemplarily, the page compilation end identifies the page address of each page from the dynamic resource proxy address of each page; for example, the page compilation end determines the page address of each page from the dynamic resource proxy address of each page according to the location information of the proxy identifier; then, the page compilation end establishes a network path corresponding to the page address and the dynamic resource proxy address of each page according to the page address of each page and the dynamic resource proxy address of each page, as the network path of each page; then, the page compilation end sends the dynamic resources associated with the dynamic resource proxy address of each page to the proxy server of each page according to the network path of each page.
[0110] In this embodiment, a dedicated network path is established for each page, which can reduce congestion and interference during data transmission and ensure that dynamic resources can be sent to the proxy server quickly and accurately. Moreover, by establishing a network path, the risk of data loss and transmission errors caused by network fluctuations or other factors is reduced, thereby ensuring the security of dynamic resources during transmission.
[0111] In an exemplary embodiment, the above step S203, according to the page preview request, determines the target static resource and target dynamic resource proxy address of the page to be previewed from the static resource and dynamic resource proxy address of each page, and specifically includes the following contents: parsing the page preview request to obtain parsing information; according to the parsing information, determining the static resource and dynamic resource proxy address corresponding to the parsing information from the static resource and dynamic resource proxy address of each page, which correspond to the target static resource and target dynamic resource proxy address of the page to be previewed.
[0112] The parsing information refers to a specific field obtained by parsing the page preview request.
[0113] Exemplarily, the page compiler reads the cookie (a computer file) information in the request through Nginx (engine x, a high-performance HTTP and reverse proxy web server) dynamic proxy technology; then, the page compiler parses the cookie information in the request to obtain parsing information; then, the page compiler determines the static resource corresponding to the parsing information from the static resources of each page according to the parsing information, as the target static resource of the page to be previewed; then, the page compiler determines the dynamic resource proxy address corresponding to the parsing information from the dynamic resource proxy address of each page according to the parsing information, as the target dynamic resource proxy address of the page to be previewed.
[0114] In this embodiment, by parsing the page preview request, the content that the user needs to preview can be accurately determined, so that the corresponding static resources and dynamic resource proxy addresses can be accurately obtained, avoiding unnecessary resource loading and processing, and thus improving the accuracy of the page preview.
[0115] In an exemplary embodiment, Figure 4 As shown, another page preview method is provided, which is applied to Figure 1 The following steps are used as an example to illustrate the page compilation end in :
[0116] Step S401, compile each page under the project through compile instructions to obtain a sub-static resource in a preset format corresponding to each page; use the sub-static resource in the preset format corresponding to each page as the static resource of each page.
[0117] Step S402, obtain the page address and proxy identifier of each page; filter out candidate proxy servers that meet preset conditions from the initial proxy servers; determine the proxy server for each page from the candidate proxy servers; obtain the server address of the proxy server for each page; combine the server address, page address and proxy identifier of the proxy server for each page to obtain the dynamic resource proxy address of each page.
[0118] Step S403: identifying the page address of each page from the dynamic resource proxy address of each page.
[0119] Step S404, establishing a network path for each page according to the page address of each page and the dynamic resource proxy address of each page.
[0120] Step S405, sending the dynamic resources associated with the dynamic resource proxy address of each page to the proxy server of each page according to the network path of each page; the proxy server of each page is used to represent the proxy server corresponding to the dynamic resource proxy address of each page.
[0121] Step S406: receiving a page preview request for each page to be previewed sent by the page preview terminal.
[0122] Step S407, parse the page preview request to obtain parsing information; according to the parsing information, determine the static resource and dynamic resource proxy address corresponding to the parsing information from the static resource and dynamic resource proxy address of each page, and the corresponding target static resource and target dynamic resource proxy address of the page to be previewed.
[0123] Step S408: determining a target proxy server corresponding to the target dynamic resource proxy address from among the proxy servers, and sending the page preview request to the target proxy server.
[0124] Step S409, receiving the target dynamic resources of the page to be previewed returned by the target proxy server according to the page preview request, and sending the target static resources and target dynamic resources corresponding to the page to be previewed to the page preview end, so that the page preview end generates a target page preview result corresponding to the page to be previewed according to the target static resources and target dynamic resources corresponding to the page to be previewed.
[0125] In the above page preview method, in the process of page previewing for the engineering project, the page is compiled in advance, and the static resources and dynamic resources are processed separately, so that a quick response can be made when a preview request is received later, thereby reducing the waiting time, improving the timeliness of the preview, and ensuring that the preview end can obtain accurate and complete page resources, and generate a preview result that is highly consistent with the actual effect, which is conducive to improving the efficiency and accuracy of the page preview; moreover, the method can preview a single page, avoiding the defect of low preview efficiency caused by the excessive time consumed by the overall loading method for page preview, thereby improving the preview efficiency of the page preview.
[0126] In an exemplary embodiment, in order to more clearly illustrate the page preview method provided in the embodiment of the present application, the page preview method is specifically described below with reference to a specific embodiment. In one embodiment, the present application also provides a preview technology of vue single page static resources based on nginx dynamic forwarding. In the process of page previewing of the project, each page under the project is first compiled and processed to obtain the static resources of each page and the dynamic resource proxy address of each page, and the dynamic resources associated with the dynamic resource proxy address of each page are sent to the proxy server corresponding to the dynamic resource proxy address of each page, and then the page preview request for the page to be previewed in each page sent by the page preview end is received. Then, according to the page preview request, the target static resources and target dynamic resource proxy address of the page to be previewed are determined from the static resources and dynamic resource proxy address of each page, and then, from each proxy server, the target proxy server corresponding to the target dynamic resource proxy address is determined, and the page preview request is sent to the target proxy server. Finally, the target dynamic resources of the page to be previewed returned by the target proxy server according to the page preview request are received, and the target static resources and target dynamic resources corresponding to the page to be previewed are sent to the page preview end, so that the page preview end generates the target page preview result corresponding to the page to be previewed according to the target static resources and target dynamic resources corresponding to the page to be previewed. Specifically including the following contents:
[0127] 1. Vue single page compilation
[0128] According to the page currently developed by the developer, the path of the page relative to the project is determined. Through project commands and single-page templates, according to the path of the Vue page relative to the project, the page under the project is compiled into a static resource that can be statically accessed and accessed through the access entry HTML. When compiling the page, according to the template, a unified proxy prefix is added to the API (Application Programming Interface) request to facilitate single-page API interface identification and forwarding.
[0129] 2. Vue single page static resource proxy and API interface dynamic proxy
[0130] According to the path of the static resources compiled by the single page relative to the project, the static resource page compiled by the single page is proxied, and the backend project request data is proxied through a unified API proxy prefix.
[0131] 3. Nginx dynamic forwarding
[0132] When requesting a single page preview, based on the backend configuration query, the static resource proxy address and the page API request proxy address are set in the cookie. Through the Nginx dynamic proxy technology, the cookie information in the request is read, the target proxy address in the page request is parsed, and the proxy is dynamically proxied to the target resource, thereby realizing the dynamic proxy of requests and external resources.
[0133] 4. Realize single page preview effect
[0134] In the page designer, select the page currently being developed, and through the page preview, compile the current page and automatically proxy it to the single-page static resource address. You can view the preview effect of the current page by logging in, and it is compatible with the single-page preview of H5 (HyperText Markup Language 5, the fifth major revision of Hypertext Markup Language) projects on both mobile and web (network) ends. You can select any page under the project for single-page preview, and you can load form data, etc. At the same time, the interactive behavior and click events of the page can take effect and be operated. In this way, the single-page preview effect is achieved.
[0135] In the above-mentioned embodiment, during the page preview of the engineering project, the page is compiled in advance, and the static resources and dynamic resources are processed separately, so that a quick response can be given when a preview request is received subsequently, thereby reducing the waiting time, improving the timeliness of the preview, and ensuring that the preview end can obtain accurate and complete page resources, and generate a preview result that is highly consistent with the actual effect, which is conducive to improving the efficiency and accuracy of the page preview; moreover, the method can preview a single page, avoiding the defect of low preview efficiency caused by the excessive time consumed by the overall loading method for page preview, thereby improving the preview efficiency of the page preview. At the same time, during collaborative development, even if different pages under an application have different developers, even if the project cannot be started, it will not affect the developer's debugging of their own development page. The current page effect can also be previewed, and the data display effect can be previewed; the compilation time of single-page preview is shorter, and fewer dependencies need to be loaded. It does not need to rely on public project resources that are not related to the current page. It is lighter and simpler, can quickly compile and preview the effect, and will not affect the compilation time as the project resources increase; when the preview fails, it is more convenient and accurate to locate the problem. You only need to troubleshoot the problem from the current development page, and can quickly locate whether it is a problem caused by the developer during the development process, effectively reducing the debugging cost.
[0136] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0137] Based on the same inventive concept, the embodiment of the present application also provides a page preview device for implementing the page preview method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in one or more page preview device embodiments provided below can refer to the limitations of the page preview method above, and will not be repeated here.
[0138] In an exemplary embodiment, Figure 5As shown, a page preview device is provided, including: a page compilation module 501, a request receiving module 502, a target determination module 503, a request sending module 504 and a resource sending module 505, wherein:
[0139] The page compilation module 501 is used to compile each page under the engineering project, obtain the static resources of each page, and the dynamic resource proxy address of each page, and send the dynamic resources associated with the dynamic resource proxy address of each page to the proxy server of each page; the proxy server of each page is used to represent the proxy server corresponding to the dynamic resource proxy address of each page.
[0140] The request receiving module 502 is used to receive a page preview request for each page to be previewed sent by the page preview terminal.
[0141] The target determination module 503 is used to determine the target static resource and target dynamic resource proxy address of the page to be previewed from the static resource and dynamic resource proxy address of each page according to the page preview request.
[0142] The request sending module 504 is used to determine the target proxy server corresponding to the target dynamic resource proxy address from each proxy server, and send the page preview request to the target proxy server.
[0143] The resource sending module 505 is used to receive the target dynamic resources of the page to be previewed returned by the target proxy server according to the page preview request, and send the target static resources and target dynamic resources corresponding to the page to be previewed to the page preview end, so that the page preview end generates the target page preview result corresponding to the page to be previewed according to the target static resources and target dynamic resources corresponding to the page to be previewed.
[0144] In an exemplary embodiment, the page compilation module 501 is also used to compile each page under the project through compilation instructions to obtain a sub-static resource in a preset format corresponding to each page; and use the sub-static resource in a preset format corresponding to each page as the static resource of each page.
[0145] In an exemplary embodiment, the page compilation module 501 is further used to obtain the page address and proxy identifier of each page; and obtain the dynamic resource proxy address of each page according to the page address and proxy identifier of each page.
[0146] In an exemplary embodiment, the page compilation module 501 is also used to screen out candidate proxy servers that meet preset conditions from the initial proxy servers; determine the proxy server for each page from the candidate proxy servers; obtain the server address of the proxy server for each page; and combine the server address of the proxy server for each page, the page address, and the proxy identifier to obtain the dynamic resource proxy address of each page.
[0147] In an exemplary embodiment, the page compilation module 501 is also used to identify the page address of each page from the dynamic resource proxy address of each page; establish a network path for each page based on the page address of each page and the dynamic resource proxy address of each page; and send the dynamic resources associated with the dynamic resource proxy address of each page to the proxy server of each page according to the network path of each page.
[0148] In an exemplary embodiment, the target determination module 503 is also used to parse the page preview request to obtain parsing information; based on the parsing information, the static resources and dynamic resource proxy addresses corresponding to the parsing information are determined from the static resources and dynamic resource proxy addresses of each page, which correspond to the target static resources and target dynamic resource proxy addresses of the page to be previewed.
[0149] Each module in the page preview device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0150] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Figure 6As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data such as static resources and dynamic resource proxy addresses. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a page preview method is implemented.
[0151] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0152] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0153] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0154] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0155] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0156] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0157] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A page preview method, characterized in that: Applied to the page compilation end, the method includes: Compile each page under the project to obtain the static resources of each page and the dynamic resource proxy address of each page, and send the dynamic resources associated with the dynamic resource proxy address of each page to the proxy server of each page; the proxy server of each page is used to represent the proxy server corresponding to the dynamic resource proxy address of each page; Receiving a page preview request for a page to be previewed in each of the pages sent by the page preview end; According to the page preview request, determining the target static resource and target dynamic resource proxy address of the page to be previewed from the static resource and dynamic resource proxy address of each page; Determine a target proxy server corresponding to the target dynamic resource proxy address from each of the proxy servers, and send the page preview request to the target proxy server; Receive the target dynamic resource of the page to be previewed returned by the target proxy server according to the page preview request, and send the target static resource and the target dynamic resource corresponding to the page to be previewed to the page preview end, so that the page preview end generates a target page preview result corresponding to the page to be previewed according to the target static resource and the target dynamic resource corresponding to the page to be previewed.
2. The method according to claim 1, characterized in that The process of compiling each page under the project to obtain the static resources of each page and the dynamic resource proxy address of each page includes: Compile each page of the project through the compilation instruction to obtain the sub-static resource of the preset format corresponding to each page; The sub-static resource in the preset format corresponding to each page is used as the static resource of each page.
3. The method according to claim 1, characterized in that The step of compiling each page under the engineering project to obtain the static resources of each page and the dynamic resource proxy address of each page also includes: Obtaining the page address and proxy identifier of each page; According to the page address of each page and the proxy identifier, the dynamic resource proxy address of each page is obtained.
4. The method according to claim 3, characterized in that The step of obtaining the dynamic resource proxy address of each page according to the page address of each page and the proxy identifier includes: Select candidate proxy servers that meet preset conditions from the initial proxy servers; Determine a proxy server for each page from the candidate proxy servers; obtain the server address of the proxy server for each page; The server address of the proxy server of each page, the page address and the proxy identifier are combined to obtain the dynamic resource proxy address of each page.
5. The method according to claim 1, characterized in that The step of sending the dynamic resources associated with the dynamic resource proxy address of each page to the proxy server of each page includes: Identifying the page address of each page from the dynamic resource proxy address of each page; Establishing a network path for each page according to the page address of each page and the dynamic resource proxy address of each page; According to the network path of each page, the dynamic resource associated with the dynamic resource proxy address of each page is sent to the proxy server of each page.
6. The method according to any one of claims 1 to 5, characterized in that The step of determining the target static resource and the target dynamic resource proxy address of the page to be previewed from the static resource and the dynamic resource proxy address of each page according to the page preview request includes: Parsing the page preview request to obtain parsing information; According to the parsing information, the static resource and dynamic resource proxy address corresponding to the parsing information are determined from the static resource and dynamic resource proxy address of each page, and the corresponding target static resource and target dynamic resource proxy address are used as the page to be previewed.
7. A page preview device, characterized in that: Applied to the page compilation end, the device includes: The page compilation module is used to compile each page under the engineering project, obtain the static resources of each page and the dynamic resource proxy address of each page, and send the dynamic resources associated with the dynamic resource proxy address of each page to the proxy server of each page; the proxy server of each page is used to indicate the proxy server corresponding to the dynamic resource proxy address of each page; A request receiving module, used for receiving a page preview request for a page to be previewed in each of the pages sent by the page preview end; A target determination module, configured to determine, according to the page preview request, a target static resource and a target dynamic resource proxy address of the page to be previewed from the static resource and dynamic resource proxy address of each page; A request sending module, used to determine a target proxy server corresponding to the target dynamic resource proxy address from each of the proxy servers, and send the page preview request to the target proxy server; The resource sending module is used to receive the target dynamic resource of the page to be previewed returned by the target proxy server according to the page preview request, and send the target static resource and target dynamic resource corresponding to the page to be previewed to the page preview end, so that the page preview end generates the target page preview result corresponding to the page to be previewed according to the target static resource and target dynamic resource corresponding to the page to be previewed.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
