CN116821539A - Page generation method, device and system, electronic equipment and storage medium - Google Patents

Page generation method, device and system, electronic equipment and storage medium Download PDF

Info

Publication number
CN116821539A
CN116821539A CN202310810788.1A CN202310810788A CN116821539A CN 116821539 A CN116821539 A CN 116821539A CN 202310810788 A CN202310810788 A CN 202310810788A CN 116821539 A CN116821539 A CN 116821539A
Authority
CN
China
Prior art keywords
page
resources
server
resource
display
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310810788.1A
Other languages
Chinese (zh)
Inventor
殷世茹
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Kangjian Information Technology Shenzhen Co Ltd
Original Assignee
Kangjian Information Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Kangjian Information Technology Shenzhen Co Ltd filed Critical Kangjian Information Technology Shenzhen Co Ltd
Priority to CN202310810788.1A priority Critical patent/CN116821539A/en
Publication of CN116821539A publication Critical patent/CN116821539A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Transfer Between Computers (AREA)

Abstract

The application discloses a page generation method, a device, a system, electronic equipment and a storage medium, and relates to the field of computer pages and the field of digital medical treatment, wherein the method comprises the following steps: responding to a page display instruction, and acquiring a page identifier of a display page included in the page display instruction; judging whether the plurality of cache resources comprise a plurality of first page resources according to the page identification, wherein the plurality of first page resources are all page resources required for generating the display page; if yes, generating a display page according to the plurality of first page resources; if not, acquiring a plurality of second page resources from the server according to the page identification; and generating a display page according to the plurality of second page resources. By caching the page resources to the local browser, the speed of acquiring the page resources from the cache is higher than that of acquiring the page resources from the server, so that the loading speed of the page is effectively improved by adopting the mode.

Description

Page generation method, device and system, electronic equipment and storage medium
Technical Field
The present application relates to the field of computer pages and the field of digital medical treatment, and in particular, to a page generation method, apparatus, system, electronic device, and storage medium.
Background
With the continuous development of computer technology, numerous Web applications (Web APPs) are presented through which people can perform a wide variety of services. These web applications need to generate pages, such as healthcare pages, and present the pages to users, so that the users can perform corresponding services through the presented pages.
In the prior art, when a page is loaded, the page is generally constructed based on frames such as exact and Vue. Specifically, the frames of exact, vue, and the like need to load and parse a large amount of JavaScript code and components, which can result in a slower first screen rendering speed. In addition, as the application of the frames such as the act and the Vue generally needs to perform server rendering, when the access amount is too large, the pressure of the server may be too large, the loading speed and the stability of the page are affected, and further the physical examination of the user is poor.
Disclosure of Invention
In view of this, the application provides a method, a device, a system, an electronic device and a storage medium for generating pages, and mainly aims to solve the technical problems that in the prior art, a large number of page resources need to be acquired from a server to generate pages based on frames such as practice and Vue, and the first screen rendering speed is low and stability is poor.
According to a first aspect of the present application, there is provided a page generation method applied to a client, where the client is communicatively connected to a server, the method including:
responding to a page display instruction, and acquiring a page identifier of a display page included in the page display instruction;
judging whether the plurality of cache resources comprise a plurality of first page resources according to the page identification, wherein the plurality of first page resources are all page resources required for generating the display page;
if yes, generating a display page according to the plurality of first page resources;
if not, acquiring a plurality of second page resources from the server according to the page identification;
and generating a display page according to the plurality of second page resources.
Optionally, the step of acquiring a plurality of second page resources from the server according to the page identifier specifically includes:
generating a page resource request according to the page identification;
sending a page resource request to a server for the server to generate a plurality of second page resources based on the page identification;
and receiving a plurality of second page resources sent by the server.
Optionally, after obtaining the plurality of second page resources from the server according to the page identifier, the method further includes:
creating a webworkbench instance object to realize simultaneous operation of a plurality of threads;
Storing a plurality of second page resources to a preset cache;
determining an HTML file in a plurality of second page resources;
and pre-rendering the HTML file to generate a pre-rendering file.
Optionally, the method further comprises:
judging whether the plurality of cache resources comprise at least one third page resource according to the page identification, wherein the third page resource is a page resource required for generating a display page;
if yes, determining page data of at least one fourth page resource required to be acquired from the server according to the page identification and the at least one third page resource;
generating a resource acquisition instruction according to the page data, and sending the resource acquisition instruction to the server, so that the server acquires at least one fourth page resource based on the page data contained in the received resource acquisition instruction;
receiving at least one fourth page resource sent by a server;
generating a display page according to at least one third page resource and at least one fourth page resource;
if not, acquiring a plurality of second page resources from the server according to the page identification.
According to a second aspect of the present application, there is provided a page generation method applied to a server, where the server is communicatively connected to a client, the method including:
Responding to a resource acquisition instruction sent by a client, and acquiring a page identifier included in the resource acquisition instruction;
acquiring page definition data according to the page identification, wherein the page definition data comprises page template data and components;
generating an HTML file according to the page template data;
pre-rendering the HTML file to generate a pre-rendering file;
packaging the components to generate JS files;
and sending the prerendered file and the JS file to the client.
According to a third aspect of the present application, there is provided a page generating apparatus applied to a client, the client being communicatively connected to a server, the apparatus comprising:
the first acquisition module is used for responding to the page display instruction and acquiring the page identification of the display page included in the page display instruction;
the judging module is used for judging whether the plurality of cache resources comprise a plurality of first page resources according to the page identification, wherein the plurality of first page resources are all page resources required for generating the display page;
the first generation module is used for generating a display page according to a plurality of first page resources if yes;
the second acquisition module is used for acquiring a plurality of second page resources from the server according to the page identification if not;
And the second generation module is used for generating a display page according to the plurality of second page resources.
According to a fourth aspect of the present application, there is provided a page generating apparatus applied to a server, the server being communicatively connected to a client, the apparatus comprising:
the first acquisition module is used for responding to a resource acquisition instruction sent by the client and acquiring a page identifier included in the resource acquisition instruction;
the second acquisition module is used for acquiring page definition data according to the page identification, wherein the page definition data comprises page template data and components;
the first generation module is used for generating an HTML file according to the page template data;
the second generation module is used for pre-rendering the HTML file and generating a pre-rendering file;
the third generating module is used for packaging the components and generating JS files;
and the sending module is used for sending the prerendered file and the JS file to the client.
According to a fifth aspect of the present application, there is provided a page generation system comprising: the client is used for realizing the method of the first aspect; the server is configured to implement the method described in the second aspect.
According to a sixth aspect of the present application there is provided an electronic device comprising a memory storing a computer program and a processor implementing the steps of the method of any of the first aspects when the processor executes the computer program.
According to a seventh aspect of the present application there is provided a readable storage medium having stored thereon a computer program which when executed by a processor implements the steps of the method of any of the first aspects.
By means of the technical scheme, the page generation method, the device, the system, the electronic equipment and the storage medium can be applied to the field of digital medical treatment, and particularly, after a page display instruction is received, whether page resources with display pages are cached in a client side or not is judged based on page identifiers of the pages to be displayed, so that the client side can directly call the cached first page resources for displaying when the pages are displayed. Further, if the web page application displays the web page for the first time, the web page resource is not cached in the client, and a plurality of second web page resources are acquired from the server to load the display web page. By caching the page resources to the local browser, and further acquiring the page resources from the local browser cache in the page loading process to generate the page, the page loading speed is effectively improved by adopting the mode because the speed of acquiring the page resources from the cache is higher than that of acquiring the page resources from the server.
The foregoing description is only an overview of the present application, and is intended to be implemented in accordance with the teachings of the present application in order that the same may be more clearly understood and to make the same and other objects, features and advantages of the present application more readily apparent.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the application. Also, like reference numerals are used to designate like parts throughout the figures. In the drawings:
fig. 1 shows a schematic flow chart of a page generating method according to an embodiment of the present application;
FIG. 2 is a schematic diagram illustrating another page generation method according to an embodiment of the present application;
FIG. 3 is a schematic diagram illustrating a further page generation method according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a page generating apparatus according to an embodiment of the present application;
fig. 5 shows a schematic structural diagram of another page generating apparatus according to an embodiment of the present application.
Detailed Description
Exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the application to those skilled in the art.
The embodiment of the application provides a page generation method, which is applied to a client, wherein the client is in communication connection with a server, as shown in fig. 1, and the method comprises the following steps:
s101, responding to a page display instruction, and acquiring a page identification of a display page included in the page display instruction.
In this step, page presentation instructions may be used to instruct the client to present the page, which are typically received by the client of the web application after some operation of the web application by the user. The page may be a page presented to the user in a Web application (Web APP). After receiving a page display instruction of a user, a client acquires a page identifier of a page to be displayed, which is contained in the page display instruction. Wherein page identification may be used to identify the page. The page identity may be URL (Uniform Resource Locator), although the page identity may also be other characters that may uniquely identify the page.
It can be understood that the execution body of the present invention may be a client of a web application, where the client is communicatively connected to a server. The client typically needs to run in a browser, which may be a browser of a mobile terminal or a browser of a Personal Computer (PC). The server may be a Web server cluster.
In practical application, the page may be a medical service page, and the medical service page is displayed for the user based on an access request of the user to access the medical service page. The medical service page of the medical enterprise comprises page data such as different page components, page contents and the like in the page.
S102, judging whether a plurality of first page resources are contained in the plurality of cache resources according to the page identification, wherein the plurality of first page resources are all page resources required for generating the display page, if so, entering S103, and if not, entering S104.
In this step, after receiving the page display instruction, whether the plurality of cache resources in the cache of the local browser exist in the plurality of first page resources corresponding to the page identifier may be determined according to the page identifier of the page to be displayed. It will be appreciated that the first plurality of page resources are all the page resources required to generate the presentation page, i.e. may be understood to be the complete page result, which may be the page result of HTML (Hypertext Marked Language). Where HTML is a language that constitutes a web document.
Specifically, the plurality of cache resources refer to resource files that are cached in the client, so that in order to increase the speed of acquiring page resources, for a web page application, when the client first displays a certain page, the page resources acquired from the server for displaying the page can be cached, so that when the client displays the page again, the client can display according to the cached page resources. After the page data of the page to be displayed are obtained, according to the page data, the first page resource corresponding to the page to be displayed can be determined. And further judging whether all the first page resources are contained in the plurality of cache resources stored in the client, and further determining whether the cache resources can be directly called in the local browser to generate the target page according to the judging result.
Optionally, the page resource includes: HTML files, JS (JavaScript) files, and other files, such as picture files, CSS (Cascading Style Sheets) files, and the like.
S103, generating a display page according to a plurality of first page resources;
in the step, after determining that the local browser has cached all the first page resources of the display page to be displayed at this time, loading the display page through a plurality of first page resources. And further displaying the generated display page to a user.
By the method, the page resources are cached in the local browser, so that when the display page is generated, cache data can be directly called in the cache of the local browser, time consumption caused by resource request of the server is reduced, the response speed of loading the page is faster, and the operation pressure of the corresponding server can be reduced due to the fact that the page resources acquired from the server are reduced.
S106, acquiring a plurality of second page resources from the server according to the page identification.
And S107, generating a display page according to the plurality of second page resources.
In steps S106 and S107, when the plurality of cache resources of the local browser do not include the page resources corresponding to the display page, a plurality of second page resources required for displaying the page need to be acquired from the server. And then loading the acquired multiple second page resources to obtain the display page.
Optionally, after the plurality of second page resources sent by the server are obtained, the plurality of second page resources are cached in the client, so that when the page is loaded again later, the cached resources can be directly called in the client to load and display the page.
According to the page generation method provided by the embodiment of the application, after the page display instruction is received, based on the page identification of the page to be displayed, whether the page resource with the display page is cached in the client is judged, so that the cached first page resources can be directly called for display when the client displays the page. Further, if the web page application displays the web page for the first time, the web page resource is not cached in the client, and a plurality of second web page resources are acquired from the server to load the display web page. By caching the page resources to the local browser, and further acquiring the page resources from the local browser cache in the page loading process to generate the page, the page loading speed is effectively improved by adopting the mode because the speed of acquiring the page resources from the cache is higher than that of acquiring the page resources from the server.
Further, as a refinement and extension of the foregoing embodiment, in order to fully describe a specific implementation procedure of the embodiment, an embodiment of the present application provides another page generating method, as shown in fig. 2, where the method includes:
s201, responding to a page display instruction, and acquiring a page identification of a display page included in the page display instruction.
In this step, page presentation instructions may be used to instruct the client to present the page, which are typically received by the client of the web application after some operation of the web application by the user. The page may be a page presented to the user in a Web application (Web APP). After receiving a page display instruction of a user, a client acquires a page identifier of a page to be displayed, which is contained in the page display instruction. Wherein page identification may be used to identify the page. The page identity may be URL (Uniform Resource Locator), although the page identity may also be other characters that may uniquely identify the page.
In practical application, the page may be a medical service page, and the medical service page is displayed for the user based on an access request of the user to access the medical service page. The medical service page of the medical enterprise comprises page data such as different page components, page contents and the like in the page.
S202, judging whether a plurality of first page resources are contained in the plurality of cache resources according to the page identification, wherein the plurality of first page resources are all page resources required for generating the display page, if so, entering S203, and if not, entering S204.
In this step, after receiving the page display instruction, whether the plurality of cache resources in the cache of the local browser exist in the plurality of first page resources corresponding to the page identifier may be determined according to the page identifier of the page to be displayed. It will be appreciated that the first plurality of page resources are all the page resources required to generate the presentation page, i.e. may be understood to be the complete page result, which may be the page result of HTML (Hypertext Marked Language). Where HTML is a language that constitutes a web document.
Specifically, the plurality of cache resources refer to resource files that are cached in the client, so that in order to increase the speed of acquiring page resources, for a web page application, when the client first displays a certain page, the page resources acquired from the server for displaying the page can be cached, so that when the client displays the page again, the client can display according to the cached page resources. After the page data of the page to be displayed are obtained, according to the page data, the first page resource corresponding to the page to be displayed can be determined. And further judging whether all the first page resources are contained in the plurality of cache resources stored in the client, and further determining whether the cache resources can be directly called in the local browser to generate the target page according to the judging result.
Optionally, the page resource includes: HTML files, JS (JavaScript) files, and other files, such as picture files, CSS (Cascading Style Sheets) files, and the like.
S203, generating a display page according to the plurality of first page resources.
In the step, after determining that the local browser has cached all the first page resources of the display page to be displayed at this time, loading the display page through a plurality of first page resources. And further displaying the generated display page to a user.
By the method, the page resources are cached in the local browser, so that when the display page is generated, cache data can be directly called in the cache of the local browser, time consumption caused by resource request of the server is reduced, the response speed of loading the page is faster, and the operation pressure of the corresponding server can be reduced due to the fact that the page resources acquired from the server are reduced.
S204, generating a page resource request according to the page identification.
S205, sending the page resource request to the server side so that the server side generates a plurality of second page resources based on the page identification.
S206, receiving a plurality of second page resources sent by the server side.
In steps S204 to S206, after determining that the page resources required for the present presentation page are not cached in the client, the page resources need to be acquired from the server. And therefore, sending a page resource request containing the page identifier to the server side, so that after the server side receives the page resource request, acquiring a plurality of second page resources based on the page identifier included in the request. And returning the acquired plurality of second page resources to the client so that the client can display the page based on the plurality of second page resources.
In practical application, when a user logs in a dependent service page, if the user accesses the medical service page for the first time, the page resource corresponding to the medical service page is not cached in the client, and at the moment, the page identifier needs to be sent to the server, so that the server obtains a resource request path (path) according to the page identifier, and further obtains a plurality of second page resources according to the path, so that the client downloads a plurality of second page resource display pages.
S207, creating a webworkbench instance object to enable a plurality of threads to run simultaneously.
In this step, a WebWorker instance object is created, when a new Worker (i.e., webWorker) is created, the code runs a completely new javascript environment (workbench) and is completely isolated from the script for creating the Worker, and at this time, the script for creating the new Worker can be called a main thread, and the created new Worker is called a sub-thread. So that the client can create multi-threaded split threads to run simultaneously to address the problem. The loading speed of the page is greatly improved, and further user experience is improved.
S208, storing the second page resources into a preset cache.
In this step, when obtaining the plurality of second page data ohms downloaded from the server, webWorker may be started, and the downloaded plurality of second page resources, such as JS component files, picture files or HTML files, are cached by using one sub-thread, so as to achieve fast multiplexing of the plurality of second page resources, reduce the time for the server to obtain the page resources, and improve the page loading rate.
S209, determining the HTML file in the plurality of second page resources.
S210, pre-rendering is carried out on the HTML file, and a pre-rendering file is generated.
In steps S209 and S210, in order to attract more and more users, a complex and cool interaction effect is often adopted for the pages browsed by the users. However, as the complexity of the page increases, the data volume required to be loaded by the page increases, and the page loading performance gradually decreases, especially when the page loading time is too long, the user is unwilling to wait and abandon browsing the page, which causes loss of the user. In order to improve the loading performance of the page, the application provides pre-rendering of the static page. In particular, page resources may be divided into static page resources and dynamic page resources based on real-time, personalized needs, etc. The static page resource refers to a page resource, such as an HTML file, which has low change frequency and has no requirements on real-time performance and individuation. The dynamic page resource is the page resource with high change frequency and high real-time and individuation requirements. After the plurality of second page resources are acquired, static HTML files are partitioned from the plurality of second page resources, and prerendering is performed. The client can directly load the prerendered file, so that a user of the client can quickly see the static page, the problem of overlong user time caused by page loading is avoided, and the user experience is improved.
In practical application, taking a medical service page to be loaded as an example, the page is composed of department information, a picture of a doctor in the department, doctor information, charging information and the like. Because the frequency of page content changes such as department information, department doctor pictures and the like is low, the real-time requirement is not high, and the medical service page can be used for a long time, and can be divided into static page resources for prerendering. Furthermore, the medical service page also has the visit information, and the visit information is changed frequently and needs to be updated on time, so that the medical service page can be divided into dynamic page resources, and the dynamic page resources are acquired from the server side in real time when the page is actually loaded without pre-rendering, so that the timeliness of displaying the page content is ensured.
Optionally, the WebWorker is started to create a multithreaded split thread processing cache file to cache a plurality of second page resources, such as JS component, pictures, HTML files, etc., obtained from the server, and at the same time, prerendering the received HTML files. In addition, the sub-thread is utilized to fill water into the subsequent page so as to perfect the subsequent page into a complete page, and the display page can be used rapidly in the subsequent process. And finally, drawing a complete page in the browser for viewing by a user.
In practical application, an HTML file is obtained from a server, after the HTML file is prerendered, the prerendered HTML file is injected into a browser, wherein the injection comprises external picture downloading, non-page emergency component JS downloading and page binding event, so that things which are preferentially displayed are rapidly displayed for a user, the use experience of the user is improved, and the user is prevented from waiting for the page loading time to lose the patience and replacing the page for a long time.
Through the mode, the webworkbench multithreading is used for simultaneously processing a plurality of problems, so that the loading speed of the page is improved, and the user experience is further improved.
In the embodiment of the application, in order to ensure the integrity of the page and display the timeliness of the page, the cache resources in the client side and the resources acquired by the server side can be combined to generate the page, specifically, whether at least one third page resource is contained in a plurality of cache resources is judged according to the page identification, wherein the third page resource is the page resource required for generating the display page; if yes, determining page data of at least one fourth page resource required to be acquired from the server according to the page identification and the at least one third page resource; generating a resource acquisition instruction according to the page data of at least one fourth page resource, and sending the resource acquisition instruction to the server, so that the server acquires the at least one fourth page resource based on the page data contained in the received resource acquisition instruction; receiving at least one fourth page resource sent by a server; generating a display page according to at least one third page resource and at least one fourth page resource; if not, acquiring a plurality of second page resources from the server according to the page identification.
In this embodiment, during the loading of the page, the page resources that are not acquired in the local browser cache need to be additionally acquired through the server. Specifically, if it is determined that the client does not cache all the first page resources required by the display page, matching with the plurality of cache resources according to the page identifier again, and determining whether the plurality of cache resources include page resources available to the display page. If the data is included, at least one third page resource is called, and at this time, other page resources except the at least one third page resource need to be obtained from the server. Therefore, after determining the page data of at least one fourth page resource to be downloaded from the server according to the page identifier and at least one third page resource in the cache, sending a resource acquisition request to the server, so that the server acquires the at least one fourth page resource based on the received page data, and returns the at least one fourth page resource to the client.
Further, after the client receives at least one fourth page resource, summarizing the at least one third page resource and the at least one fourth page resource, determining an HTML file corresponding to the static page in the summarized page resources, pre-rendering the HTML file, and combining other page resources based on the pre-rendered HTML file, so that the client can quickly display a complete page result.
Optionally, after determining that the page resources required by the display page are not cached in the client based on the matching result of the page identifier and the plurality of cache files, a page resource request may be sent to the server, so that the server determines a resource request path based on the page resource request, and further obtains a plurality of second page resources required by the display page.
Optionally, the page data is used to provide data about information about a resource, where the page data may include page template data (i.e., page content), components, data source information, and the like. The page template data may be understood as HTML code with placeholders. A component is a simple package of data and methods. The components may have their own properties and methods. The attributes are simple visitors to the component data, and the methods are some simple and visible functions of the component. Drag-and-drop programming, fast property handling, and true object-oriented design can be achieved using components. The components may include component identification, component template data, component data, and the like. Component identification may also be referred to as component program name, e.g., list component. The component identification may identify components by which it may be determined which components are included in the page accordingly. Complete page results may be generated based on the page template data and components included in the page. Further, the data source information may be understood as data source information needed in the component, which may include a data source URL and a data source name. The data source name is an identification of the data source.
S211, generating a display page according to the plurality of second page resources.
In the step, after a plurality of second page resources sent by a server are obtained, determining an HTML file corresponding to a static page in the plurality of second page resources, pre-rendering the HTML file, and loading the pre-rendered plurality of second page resources to obtain a display page.
According to the page generation method provided by the embodiment of the application, after the page display instruction is received, based on the page identification of the page to be displayed, whether the page resource with the display page is cached in the client is judged, so that the cached first page resources can be directly called for display when the client displays the page. Further, if the web page application displays the web page for the first time, the web page resource is not cached in the client, and a plurality of second web page resources are acquired from the server to load the display web page. By caching the page resources to the local browser, and further acquiring the page resources from the local browser cache in the page loading process to generate the page, the page loading speed is effectively improved by adopting the mode because the speed of acquiring the page resources from the cache is higher than that of acquiring the page resources from the server.
Further, an embodiment of the present application provides a page generating method, which is applied to a server, where the server is communicatively connected to a client, as shown in fig. 3, and the method includes:
s301, responding to a resource acquisition instruction sent by a client, and acquiring a page identifier included in the resource acquisition instruction.
In the step, the server receives a resource acquisition instruction sent by the client, and acquires a page identifier included in the instruction. In particular, the page identifier may be used to identify the page, and the page identifier may be URL (Uniform Resource Locator), and of course, the page identifier may also be other characters that may uniquely identify the page. And acquiring a resource request path through the page identifier, and further acquiring a plurality of second page resources according to the resource request path.
S302, acquiring page definition data according to the page identification, wherein the page definition data comprises page template data and components.
In this step, a resource request path is determined according to the page identifier, and page definition data is acquired according to the resource request path. Specifically, page template data (i.e., page content), components, data source information, and the like are included. The page template data may be understood as HTML code with placeholders. A component is a simple package of data and methods. The components may have their own properties and methods. The attributes are simple visitors to the component data, and the methods are some simple and visible functions of the component. Drag-and-drop programming, fast property handling, and true object-oriented design can be achieved using components. The components may include component identification, component template data, component data, and the like. Component identification may also be referred to as component program name, e.g., list component. The component identification may identify components by which it may be determined which components are included in the page accordingly. Complete page results may be generated based on the page template data and components included in the page. Further, the data source information may be understood as data source information needed in the component, which may include a data source URL and a data source name. The data source name is an identification of the data source.
S303, generating an HTML file according to the page template data.
S304, pre-rendering is carried out on the HTML file, and a pre-rendering file is generated.
In steps S303 and S304, after extracting the page template data from the page definition data, the HTML file is compiled from the page template data.
Optionally, in the page generation process, when the page resources are acquired from the server based on the resource acquisition instruction, a plurality of page resources are generally acquired as a whole, so that the number of page resources acquired from the server is large, and the response speed of page loading is slow. Therefore, in order to increase the page loading speed, the server performs the server prerendering processing on the HTML file based on the configuration file to generate prerendered files, wherein the configuration file describes components needing prerendering in each HTML static page. And the static page resource sent to the client can be displayed to the user preferentially and rapidly.
In practical application, before the page definition data is acquired according to the page identifier, the page definition data may be acquired in a page publishing database according to the page identifier, where the page publishing database may be a database cluster, and is used for storing pages, components, data sources and other related data.
S305, packaging the components to generate JS files.
S306, sending the prerendered file and the JS file to the client.
In steps S305 and S306, after extracting the component identifier from the page definition data, the component is packetized and packaged into a corresponding JS file. And then, the rendered prerendered file and JS file are released on line, so that the client can start the WebWorker, and obtain the corresponding HTML file, the corresponding assembly JS file, the corresponding picture file and the like according to the path.
In practical application, the server creates a plurality of sub-threads, and compiles an HTML file and a J file respectively. Further, if other data, pictures or other data are also included in the page definition data, the sub-thread may be used to process the pictures or other files, for example, converting some small-volume icons into base64 character codes, and directly placing the base64 character codes into the HTML file for rendering. In addition, if the file is large, the file can be directly put into a static library and introduced into the client through an external chain.
Through the mode, the server side is used for prerendering the HTML file, so that the SEO search engine is more friendly, the page display time of the client side is greatly shortened, and the page loading speed is improved. Meanwhile, the components are packaged in a subpackage mode, so that the components which are common to the server side are rapidly reused by other pages, the operation pressure of the server side is reduced, and page resources are fully utilized.
Further, as a specific implementation of the method shown in fig. 1, an embodiment of the present application provides a page generating apparatus 400, which is applied to a client, where the client is communicatively connected to a server, as shown in fig. 4, and the apparatus includes:
a first obtaining module 401, configured to obtain, in response to a page display instruction, a page identifier of a display page included in the page display instruction;
a judging module 402, configured to judge whether a plurality of cache resources include a plurality of first page resources according to a page identifier, where the plurality of first page resources are all page resources required for generating a display page;
a first generating module 403, configured to generate, if yes, a display page according to the plurality of first page resources;
a second obtaining module 404, configured to obtain, if not, a plurality of second page resources from the server according to the page identifier;
and the second generating module 405 is configured to generate a presentation page according to the plurality of second page resources.
Optionally, the second obtaining module 404 is specifically configured to:
generating a page resource request according to the page identification;
sending a page resource request to a server for the server to generate a plurality of second page resources based on the page identification;
And receiving a plurality of second page resources sent by the server.
Optionally, the apparatus further comprises:
a creating module 406, configured to create a webworkbench instance object, so as to implement simultaneous running of multiple threads;
a storage module 407, configured to store a plurality of second page resources to a preset cache;
a first determining module 408, configured to determine an HTML file among the plurality of second page resources;
and a third generating module 409, configured to pre-render the HTML file, and generate a pre-rendered file.
Optionally, the determining module 402 is further configured to determine whether at least one third page resource is included in the plurality of cache resources according to the page identifier, where the third page resource is a page resource required for generating the presentation page.
Optionally, the apparatus further comprises:
a second determining module 410, configured to determine, if yes, page data of at least one fourth page resource that needs to be acquired from the server according to the page identifier and at least one third page resource;
a third obtaining module 411, configured to generate a resource obtaining instruction according to the page data, and send the resource obtaining instruction to the server, so that the server obtains at least one fourth page resource based on the page data included in the received resource obtaining instruction;
A receiving module 412, configured to receive at least one fourth page resource sent by the server;
a fourth generating module 413, configured to generate a presentation page according to at least one third page resource and at least one fourth page resource;
and a fourth obtaining module 414, configured to obtain, if not, a plurality of second page resources from the server according to the page identifier.
According to the page generation device 400 provided by the embodiment of the application, after receiving the page display instruction, based on the page identification of the page to be displayed, whether the page resource with the display page is cached in the client is judged, so that the cached first page resources can be directly called for display when the client displays the page. Further, if the web page application displays the web page for the first time, the web page resource is not cached in the client, and a plurality of second web page resources are acquired from the server to load the display web page. By caching the page resources to the local browser, and further acquiring the page resources from the local browser cache in the page loading process to generate the page, the page loading speed is effectively improved by adopting the mode because the speed of acquiring the page resources from the cache is higher than that of acquiring the page resources from the server.
Further, an embodiment of the present application provides a page generating apparatus 500, which is applied to a server, where the server is communicatively connected to a client, as shown in fig. 5, and the apparatus includes:
a first obtaining module 501, configured to obtain a page identifier included in a resource obtaining instruction in response to the resource obtaining instruction sent by the client;
a second obtaining module 502, configured to obtain page definition data according to a page identifier, where the page definition data includes page template data and a component;
a first generating module 503, configured to generate an HTML file according to the page template data;
a second generating module 504, configured to pre-render the HTML file, and generate a pre-rendered file;
the third generating module 505 is configured to package the components to generate a JS file;
and a sending module 506, configured to send the prerendered file and the JS file to the client.
According to the page generation device 500 provided by the embodiment of the application, the server side is used for prerendering the HTML file, so that the device is more friendly to the SEO search engine, the page display time of the client side is greatly shortened, and the page loading speed is improved. Meanwhile, the components are packaged in a subpackage mode, so that the components which are common to the server side are rapidly reused by other pages, the operation pressure of the server side is reduced, and page resources are fully utilized.
In an exemplary embodiment, the embodiment of the application provides a page generation system, which comprises a client and a server.
According to the page generation system provided by the embodiment of the application, after the client receives the page display instruction, based on the page identification of the page to be displayed, whether the page resource with the display page is cached in the client is judged, so that the client can directly call a plurality of cached first page resources to display when the page is displayed. Further, if the web page application displays the web page for the first time, the web page resource is not cached in the client, and a plurality of second web page resources are acquired from the server to load the display web page. By caching the page resources to the local browser, and further acquiring the page resources from the local browser cache in the page loading process to generate the page, the page loading speed is effectively improved by adopting the mode because the speed of acquiring the page resources from the cache is higher than that of acquiring the page resources from the server. Furthermore, the server side is used for prerendering the HTML file, so that the SEO search engine is more friendly, the page display time of the client side is greatly shortened, and the page loading speed is improved. Meanwhile, the components are packaged in a subpackage mode, so that the components which are common to the server side are rapidly reused by other pages, the operation pressure of the server side is reduced, and page resources are fully utilized.
In an exemplary embodiment, the application also provides an electronic device including a memory and a processor. The memory stores a computer program, and a processor executes the program stored in the memory to perform the page generation method in the above embodiment.
In an exemplary embodiment, the application also provides a readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the page generation method.
From the above description of the embodiments, it will be clear to those skilled in the art that the present application may be implemented in hardware, or may be implemented by means of software plus necessary general hardware platforms. Based on such understanding, the technical solution of the present application may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (may be a CD-ROM, a U-disk, a mobile hard disk, etc.), and includes several instructions for causing an electronic device (may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective implementation scenario of the present application.
Those skilled in the art will appreciate that the drawing is merely a schematic illustration of a preferred implementation scenario and that the modules or flows in the drawing are not necessarily required to practice the application.
Those skilled in the art will appreciate that modules in an apparatus in an implementation scenario may be distributed in an apparatus in an implementation scenario according to an implementation scenario description, or that corresponding changes may be located in one or more apparatuses different from the implementation scenario. The modules of the implementation scenario may be combined into one module, or may be further split into a plurality of sub-modules.
The above-mentioned inventive sequence numbers are merely for description and do not represent advantages or disadvantages of the implementation scenario.
The foregoing disclosure is merely illustrative of some embodiments of the application, and the application is not limited thereto, as modifications may be made by those skilled in the art without departing from the scope of the application.

Claims (10)

1. A method for generating a page, the method being applied to a client, the client being communicatively connected to a server, the method comprising:
responding to a page display instruction, and acquiring a page identifier of a display page included in the page display instruction;
judging whether a plurality of cache resources comprise a plurality of first page resources according to the page identification, wherein the plurality of first page resources are all page resources required for generating a display page;
if yes, generating the display page according to the plurality of first page resources;
If not, acquiring a plurality of second page resources from the server according to the page identification;
and generating the display page according to the plurality of second page resources.
2. The method of claim 1, wherein the step of obtaining a plurality of second page resources from the server according to the page identifier specifically includes:
generating a page resource request according to the page identifier;
the page resource request is sent to a server side, so that the server side generates a plurality of second page resources based on the page identification;
and receiving the plurality of second page resources sent by the server.
3. The method of claim 1, wherein after the obtaining a plurality of second page resources from the server according to the page identifier, further comprises:
creating a webworkbench instance object to realize simultaneous operation of a plurality of threads;
storing the plurality of second page resources to a preset cache;
determining an HTML file in the plurality of second page resources;
and pre-rendering the HTML file to generate a pre-rendering file.
4. A method according to any one of claims 1 to 3, further comprising:
Judging whether the plurality of cache resources comprise at least one third page resource according to the page identification, wherein the third page resource is a page resource required for generating a display page;
if yes, determining page data of at least one fourth page resource required to be acquired from the server according to the page identifier and the at least one third page resource;
generating a resource acquisition instruction according to the page data, and sending the resource acquisition instruction to the server side, so that the server side acquires the at least one fourth page resource based on the received page data contained in the resource acquisition instruction;
receiving the at least one fourth page resource sent by the server;
generating the display page according to the at least one third page resource and the at least one fourth page resource;
if not, acquiring the plurality of second page resources from the server according to the page identification.
5. The page generation method is characterized by being applied to a server, wherein the server is in communication connection with a client, and the method comprises the following steps:
responding to a resource acquisition instruction sent by the client, and acquiring a page identifier included in the resource acquisition instruction;
Acquiring page definition data according to the page identification, wherein the page definition data comprises page template data and components;
generating an HTML file according to the page template data;
pre-rendering the HTML file to generate a pre-rendering file;
packaging the components to generate JS files;
and sending the prerendered file and the JS file to the client.
6. A page generation apparatus, for application to a client, the client being communicatively coupled to a server, the apparatus comprising:
the first acquisition module is used for responding to the page display instruction and acquiring the page identification of the display page included in the page display instruction;
the judging module is used for judging whether the plurality of cache resources comprise a plurality of first page resources or not according to the page identification, wherein the plurality of first page resources are all page resources required for generating the display page;
the first generation module is used for generating the display page according to the plurality of first page resources if yes;
the second acquisition module is used for acquiring a plurality of second page resources from the server according to the page identification if not;
And the second generation module is used for generating the display page according to the plurality of second page resources.
7. A page generation device, characterized by being applied to a server, where the server is communicatively connected to a client, and the device includes:
the first acquisition module is used for responding to a resource acquisition instruction sent by the client and acquiring a page identifier included in the resource acquisition instruction;
the second acquisition module is used for acquiring page definition data according to the page identification, wherein the page definition data comprises page template data and components;
the first generation module is used for generating an HTML file according to the page template data;
the second generation module is used for pre-rendering the HTML file and generating a pre-rendering file;
the third generating module is used for packaging the components and generating JS files;
and the sending module is used for sending the prerendered file and the JS file to the client.
8. A page generation system, comprising:
a client for implementing the page generation method according to any one of claims 1 to 4;
the server is configured to implement the page generation method of claim 5.
9. An electronic device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any one of claims 1 to 7 when executing the computer program.
10. A readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
CN202310810788.1A 2023-07-04 2023-07-04 Page generation method, device and system, electronic equipment and storage medium Pending CN116821539A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310810788.1A CN116821539A (en) 2023-07-04 2023-07-04 Page generation method, device and system, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310810788.1A CN116821539A (en) 2023-07-04 2023-07-04 Page generation method, device and system, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116821539A true CN116821539A (en) 2023-09-29

Family

ID=88114329

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310810788.1A Pending CN116821539A (en) 2023-07-04 2023-07-04 Page generation method, device and system, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116821539A (en)

Similar Documents

Publication Publication Date Title
CN108984714B (en) Page rendering method and device, electronic equipment and computer readable medium
CN110309451B (en) Method and device for generating web preloading page
WO2017206626A1 (en) Network resource access apparatus, mixed apparatus, and method
CN106294658B (en) Webpage quick display method and device
CN107040584B (en) Method and device for downloading picture by client
US8689099B1 (en) Cross-domain communication
CN110020329B (en) Method, device and system for generating webpage
CN109558323B (en) System, method and apparatus for debugging pages
CN108874922B (en) Client device, webpage rendering method based on single page application and storage medium
CN112256990B (en) Image processing method and device and computer readable storage medium
US20150317405A1 (en) Web Page Variation
US10594764B2 (en) Request cache to improve web applications performance
CN111880790A (en) Page rendering method, page rendering system, and computer-readable storage medium
CN109582317B (en) Method and apparatus for debugging hosted applications
CN110795649A (en) Target page display method, device and system and electronic equipment
CN111880788A (en) Page rendering method, device, client and computer readable storage medium
CN112612982A (en) Webpage preloading method and device and computer equipment
CN112015485A (en) Page display method and device, electronic equipment and storage medium
CN110968314A (en) Page generation method and device
CN113760283A (en) Text rendering method and device
CN117390326A (en) Page management method, device, equipment and storage medium
CN110807162A (en) Method and device for loading occupation bitmap
CN113094612A (en) Method and device for loading webpage at client, electronic equipment and medium
CN111880789A (en) Page rendering method, device, server and computer-readable storage medium
CN112926002A (en) Service request processing method and device

Legal Events

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