A page rendering method, device, electronic device and storage medium
By obtaining the service identity and routing information of the shared page, obtaining the system access address and page information, updating the routing table and rendering the page, the problems of excessive page rendering resources occupied and poor interactivity in the existing technology are solved, and the sharing of page code is realized and efficient rendering.
Patent Information
- Application Number
- CN202310677826.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-08
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2043-06-08
AI Technical Summary
The prior art has problems of excessive resource usage and poor interactivity when rendering pages, especially when loading pages of the same business, the code cannot be effectively shared, resulting in an increase in development and maintenance workload.
By obtaining the service identification and routing information of the shared page to be called, obtaining the system access address, and obtaining the page information of the alternative shared page from the address, updating the routing table, and rendering the shared page to be called based on the routing table and routing information.
It realizes code sharing for the same business page, reduces resource waste, improves page performance, and does not need to create a new window to display shared pages, and can perform page interactions without barriers.
Smart Images

Figure CN116578801B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a page rendering method, device, electronic device and storage medium. Background Art
[0002] At present, different system software may be interrelated and may have pages with the same business. If the same code is written for pages with the same business, when a bug occurs on the page or an update is needed, the page code must be updated one by one, increasing the development and maintenance workload.
[0003] Usually, iframe (an HTML tag used to create an inline frame containing another document) is used to load websites with other service addresses in the current page, and the page to be called is specified when loading. A new window is loaded on the current page, and the specified page is rendered in the window, thus avoiding writing the same code for each page of the same business.
[0004] However, since the iframe loads the entire website and only one page needs to be displayed, this method will take up a lot of unnecessary resources. In addition, the iframe loads a new window on the original web page to display the page of the same business. The interactivity between the new page and the original page is very poor, and comprehensive integration cannot be achieved. Summary of the invention
[0005] The embodiments of the present invention provide a page rendering method, device, electronic device and storage medium, which can solve the problems of resource occupation and interactivity existing in the page rendering solutions in the related art.
[0006] According to one aspect of the present invention, a page rendering method is provided, comprising:
[0007] Get the service ID and routing information of the shared page to be called;
[0008] Acquire a system access address corresponding to the shared page according to the service identifier, and acquire page information of at least one candidate shared page according to the system access address;
[0009] The page routing table is updated according to the page information of the candidate shared page, and the shared page to be called is rendered according to the routing table and the routing information.
[0010] Optionally, after obtaining the service identifier and routing information of the shared page to be called, the following is further included:
[0011] A routing table for matching pages according to the routing information;
[0012] In a case where the routing table includes the routing information, rendering of the shared page to be called is performed according to the routing table and the routing information.
[0013] By matching the routing information of the shared page to be called with the routing table, it is possible to query whether the page information of the shared page to be called has been cached. If the routing information is included in the routing table, the shared page to be called is directly rendered according to the routing table and the routing information, avoiding repeated loading of pages of the same business, reducing resource waste while ensuring page performance.
[0014] Optionally, the obtaining of the service identifier and routing information of the shared page to be called includes:
[0015] The shared page to be called is determined according to the page jump event, and the service name and routing address of the shared page are obtained.
[0016] By obtaining the service name of the shared page, it is convenient to obtain the system access address based on the service name. In addition, querying the routing table based on the routing address can avoid repeated loading.
[0017] Optionally, acquiring a system access address corresponding to the shared page according to the service identifier, and acquiring page information of at least one candidate shared page according to the system access address includes:
[0018] According to the association relationship between the service identifier and the system access address, obtaining the system access address corresponding to the shared page;
[0019] Accessing a corresponding target system according to the system access address, and acquiring a page file of at least one candidate shared page corresponding to the service identifier from the target system;
[0020] Obtain page information of each candidate shared page in the page file.
[0021] The system access address corresponding to the shared page can be obtained through the service identifier, and the page file of at least one alternative shared page corresponding to the service identifier can be obtained from the system access address, which facilitates remote loading of the page file of the alternative shared page to the system that needs to call the shared page.
[0022] Optionally, a method for determining the page file of the at least one candidate shared page includes:
[0023] Generate target script file according to preset shared functions;
[0024] Generate the object content of the shared function according to the page access path and page code of each candidate shared page, and update the target script file according to the object content;
[0025] Generate at least one page file of the candidate shared page according to the updated target script file.
[0026] By generating a target script file containing a shared function, passing in the object content of the shared function, and then packaging the target script file and related pages into a script file, the page code of each candidate shared page can be shared with other systems through the script file.
[0027] Optionally, the acquiring the page information of each candidate shared page in the page file includes:
[0028] Loading the page file, triggering a shared function in a target script file in the page file;
[0029] The page code and page access path corresponding to each candidate shared page are obtained according to the shared function.
[0030] When loading a page file, the page code and page access path of each candidate shared page can be quickly obtained through the subscription function and the publishing function in the shared function, thereby improving the efficiency of obtaining page information.
[0031] Optionally, updating a routing table of a page according to the page information of the candidate shared page, and rendering the shared page to be called according to the routing table and the routing information, includes:
[0032] Adding the page access path and page code of the candidate shared page to the routing table;
[0033] The target page code is obtained by matching the routing table according to the routing information, and the shared page to be called is rendered according to the routing information and the target page code.
[0034] By adding the page access path and page code of the candidate shared page to the routing table, the candidate shared page can be remotely loaded to the system that needs to call the shared page, thereby realizing page sharing.
[0035] According to another aspect of the present invention, a page rendering device is provided, the device comprising:
[0036] An information acquisition module, used to acquire the service identifier and routing information of the shared page to be called;
[0037] An address acquisition module, configured to acquire a system access address corresponding to the shared page according to the service identifier, and acquire page information of at least one candidate shared page according to the system access address;
[0038] The page rendering module is used to update the page routing table according to the page information of the candidate shared page, and render the shared page to be called according to the routing table and the routing information.
[0039] Optionally, it also includes:
[0040] A routing matching module is used to match the routing table of the page according to the routing information after obtaining the service identifier and routing information of the shared page to be called;
[0041] The routing jump module is used to render the shared page to be called according to the routing table and the routing information when the routing information is contained in the routing table.
[0042] Optionally, the information acquisition module is specifically used for:
[0043] The shared page to be called is determined according to the page jump event, and the service name and routing address of the shared page are obtained.
[0044] Optionally, the address acquisition module is specifically used to:
[0045] According to the association relationship between the service identifier and the system access address, obtaining the system access address corresponding to the shared page;
[0046] Accessing a corresponding target system according to the system access address, and acquiring a page file of at least one candidate shared page corresponding to the service identifier from the target system;
[0047] Obtain page information of each candidate shared page in the page file.
[0048] Optionally, it also includes:
[0049] A page file determination module is used to generate a target script file based on a preset shared function; generate the object content of the shared function based on the page access path and page code of each alternative shared page, and update the target script file based on the object content; and generate a page file of at least one alternative shared page based on the updated target script file.
[0050] Optionally, the address acquisition module is further configured to:
[0051] Loading the page file, triggering a shared function in a target script file in the page file;
[0052] The page code and page access path corresponding to each candidate shared page are obtained according to the shared function.
[0053] Optionally, the page rendering module is specifically used to:
[0054] Adding the page access path and page code of the candidate shared page to the routing table;
[0055] The target page code is obtained by matching the routing table according to the routing information, and the shared page to be called is rendered according to the routing information and the target page code.
[0056] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0057] at least one processor; and
[0058] a memory communicatively connected to the at least one processor; wherein,
[0059] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the page rendering method described in any embodiment of the present invention.
[0060] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the page rendering method described in any embodiment of the present invention when executed.
[0061] The technical solution of the embodiment of the present invention obtains the system access address through the service identifier of the shared page to be called, obtains the page information of at least one alternative shared page from the target system corresponding to the address according to the system access address, updates the routing table of the page according to the page information, and renders the shared page to be called according to the routing information and routing table of the shared page to be called, solves the problems of resource occupation and interactivity of the page rendering scheme in the related technology, realizes the sharing of the same page code for pages of the same business, and does not need to create a new window to display the shared page, and can perform page interaction without obstacles.
[0062] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0064] Figure 1 A flow chart of a page rendering method provided by an embodiment of the present invention;
[0065] Figure 2A schematic diagram of the structure of a shared function provided by an embodiment of the present invention;
[0066] Figure 3 A flowchart of another page rendering method provided by an embodiment of the present invention;
[0067] Figure 4 Flow chart of another page rendering method provided by an embodiment of the present invention
[0068] Figure 5 A schematic diagram of an execution flow of a shared page provided by an embodiment of the present invention;
[0069] Figure 6 A schematic diagram of the structure of a page rendering device provided by an embodiment of the present invention;
[0070] Figure 7 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0071] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0072] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0073] Figure 1 This is a flow chart of a page rendering method provided by an embodiment of the present invention. This embodiment can be applied to sharing page codes of the same business between different systems to realize the situation where one code runs in multiple systems. The method can be executed by a page rendering device, which can be implemented in the form of hardware and / or software, and can be configured in an electronic device. Figure 1As shown, the method includes:
[0074] S110: Obtain the service identifier and routing information of the shared page to be called.
[0075] Among them, the shared page to be called is a page shared by other systems in the platform to be called by the current system, and the current system is the system for obtaining the shared page. For example, for an enterprise, the enterprise management platform includes a login system, an attendance system, a business management system, and so on. Assuming that service A in the login system may be related to service B in the attendance system, the login system can share page A1, page A2, and page A3 under service A to the attendance system. The above-mentioned pages A1, A2, and A3 are the pages shared by the login system, which can be called alternative shared pages. If the attendance system needs to call page A2, page A2 will be used as the shared page to be called.
[0076] The embodiment of the present invention can set an independent page access path for each shared page in advance. For example, by setting a page access path for each shared page through vue-router, each shared page can be independent. Among them, vue-router can be a routing plug-in based on vue. vue can be a front-end framework in the form of mvvm (Model-View-ViewModel).
[0077] Optionally, a script file may be pre-written, the script file including a shared function, the shared function may have a publish-subscribe function and a page loading function, and the script file may be deployed on a content delivery network (CDN) server so that each service may reference it.
[0078] It should be noted that the system for sharing pages provides other systems with the page access path and page content of the shared pages. Correspondingly, the system for obtaining pages is the system for obtaining shared pages from the system for sharing pages. For example, the page content may include page code, etc. The system for sharing pages splits the shareable page code and the non-shareable code, and introduces the shared pages of the same system for sharing pages into the same script file, sets an object for each shared page, and the object content includes the page access path, page name, page content, etc. The object content can be represented in the form of an array, and the array can be passed as a parameter to the publishing function of the shared function in the script file. Optionally, the system for sharing pages also packages the script file and the related shared pages through Webpack to make a page file for the shared page, so as to separate the shareable page code and the non-shareable code. Among them, Webpack is a front-end packaging tool.
[0079] Figure 2 A schematic diagram of a shared function provided by an embodiment of the present invention. Figure 2 As shown, the sharing function includes a publishing function, a subscription function and a jump function. Among them, the publishing function is used to publish the shared page and the system call of the shared page. The subscription function is used to receive the parameters in the publishing function and obtain the system call of the page. The jump function is used to obtain the system call of the page. Further, the jump function is specifically used to create a scrpit tag, and the page file generated by the page code package is obtained from the system of the shared page through the scrpit tag. The script tag can be a tag in HTML that loads js scripts through a service. For example, the script tag contains a script statement, and can also point to an external script file through the src attribute. Optionally, the jump function is also used to add page information such as page access path and page code to the routing table of the current system. Among them, the routing table can be a collection of routes, and a route can be a set of mapping relationships. In the mapping relationship, the routing address is the key value, and the front-end request or page content is the content corresponding to the key value. Optionally, the jump function is also used to render the shared page to be called according to the page code. Optionally, the jump function is also used for page information caching. For example, the current system caches the page information loaded remotely through the jump function.
[0080] The service identifier may be the identification information of the shared page. Some services may be implemented through one system, while some services may require the cooperation of multiple related systems to be implemented, that is, there is a situation where one service identifier corresponds to at least one system for sharing a page. For example, the service identifier may be a service name, which may be a Chinese name or an English name, etc.
[0081] The routing information may be the page access path of the shared page. Since an independent page access path is set in advance for each shared page, the page access path of the shared page can be known to the R&D personnel. Since the access addresses of different shared pages are different, the shared page can only be obtained by combining the system access address and the page access path. It is necessary to associate the service identification and the system access address for each shared page in advance. For example, the service identification and the system access address may be associated and stored in a database.
[0082] Exemplarily, obtaining the service identifier and routing information of the shared page to be called includes: determining the shared page to be called according to the page jump event, and obtaining the service name and routing address of the shared page. Among them, the conditions for triggering the jump event include manually operating the page to jump to the shared page or calling the shared page by other pages, etc. The page to be jumped to is used as the page to be called. If the page to be called is a shared page, the page rendering method provided by the embodiment of the present invention can be executed. If the page to be called is not a shared page, the page code of the page in the current system is executed to render the page.
[0083] Since each shared page has an independent page access path, after the shared page to be called is determined, the service name and page access path of the shared page can be obtained, wherein the page access path is the routing address.
[0084] In the embodiment of the present invention, when a page jump event is detected, a jump function is called, and the parameters of the jump function include the service name and routing address of the shared page to be called.
[0085] S120: Acquire a system access address corresponding to the shared page according to the service identifier, and acquire page information of at least one candidate shared page according to the system access address.
[0086] Among them, the system access address corresponding to the shared page can be the access address of the system that shares the shared page, and the system of the shared page can be accessed through the system access address. Since the system of the shared page pre-packages the shared pages corresponding to each service separately, all shared pages corresponding to the service identifier can be obtained from the system of the shared page and recorded as alternative shared pages. The alternative shared page includes the shared page to be called, and also includes other shared pages with the same upper-level service as the shared page to be called. For example, the shared page to be called and the alternative shared page have the same parent page, etc.
[0087] Page information is the system call information shared by the system sharing the page to other systems. Other systems can call the page of the system sharing the page through the page information. For example, the page information includes the page access path, page name, and page content. The page information can be put into an array to represent the page information in array form, and the array can be used as a parameter of the publishing function in the sharing function.
[0088] Exemplarily, obtaining the system access address corresponding to the shared page according to the service identifier, and obtaining the page information of at least one candidate shared page according to the system access address, includes: obtaining the system access address corresponding to the shared page according to the association relationship between the service identifier and the system access address. Accessing the corresponding target system according to the system access address, obtaining the page file of at least one candidate shared page corresponding to the service identifier from the target system. Obtaining the page information of each candidate shared page in the page file.
[0089] Since the system for sharing pages has already packaged the script files and related shared pages through webpack in advance, a page file for the shared page is produced. In response to the jump event of the shared page, the current system obtains the system access address corresponding to the shared page according to the service identifier and the association between the service identifier and the system access address. The current system can dynamically create a script tag according to the system access address. Through the script tag, the page files of all the alternative pages corresponding to the service identifier generated by the package are pulled from the system for sharing pages corresponding to the system access address. Optionally, the current system can also pull the page files of all the alternative pages generated by the package from the system for sharing pages corresponding to the system access address through the script tag. If the system for sharing pages shares the pages of the first service, the second service, and the third service, and the shared page to be called is the page corresponding to the first service, the page files of all the alternative pages corresponding to the first service can be obtained only from the system for sharing pages. Optionally, the page files of all the alternative pages corresponding to the first service, the second service, and the third service can also be obtained from the system for sharing pages.
[0090] S130: Update the page routing table according to the page information of the candidate shared page, and render the shared page to be called according to the routing table and the routing information.
[0091] The routing table of the page may be a collection of routing information of the page, and the routing information is used to indicate the address where the page information is rendered to the front end of the page.
[0092] Exemplarily, updating the routing table of the page according to the page information of the candidate shared page, and rendering the shared page to be called according to the routing table and the routing information, includes: adding the page access path and page code of the candidate shared page to the routing table. Matching the routing table according to the routing information to obtain the target page code, and rendering the shared page to be called according to the routing information and the target page code. Among them, the target page code can be the page code corresponding to the shared page to be called. Since the page access path is associated with the page code, the routing table can be matched based on the routing information to obtain the page code corresponding to the page access path matching the routing information as the target page code.
[0093] Specifically, after the current system obtains a page file containing at least one candidate shared page, the page file is loaded. When the page file is loaded, the shared function in the target script file in the page file is triggered to run the subscription function in the shared function and receive the page information published by the publishing function in the shared function, thereby obtaining the page code of the candidate shared page. The page information is dynamically loaded into the route of the current system through the addRouter method of vue-router to add the page access path and page code to the routing table of the current system, and to load the candidate shared page remotely into the current system.
[0094] Since the page to be called is an alternative shared page, the updated routing table can be matched according to the routing information of the page to be called to obtain the target page access path. According to the correspondence between the target page access path and the page code, the target page code of the shared page to be called is obtained, and the shared page to be called is rendered according to the target page code and the routing information.
[0095] An embodiment of the present invention provides a page rendering method, which obtains a system access address through a service identifier of a shared page to be called, obtains page information of at least one candidate shared page from a target system corresponding to the address according to the system access address, updates a routing table of the page according to the page information, and renders the shared page to be called according to the routing information and routing table of the shared page to be called, thereby solving the resource occupation and interactivity problems existing in page rendering solutions in related technologies, and realizes sharing of the same page code for pages of the same business, and there is no need to create a new window to display the shared page, so that page interaction can be performed without obstacles.
[0096] Figure 3 This is a flow chart of another page rendering method provided by an embodiment of the present invention. Based on the above embodiment, this embodiment additionally limits the determination of whether the shared page to be called is a preloaded page in the cache. If so, the page jump is performed without repeatedly loading the same page. Figure 3 As shown, the method includes:
[0097] S310: Obtain the service identifier and routing information of the shared page to be called.
[0098] Exemplarily, if the current system needs to call the page code in the system of the shared page, the parameters of the jump function are obtained, and the parameters of the jump function include the service name and routing address of the shared page to be called.
[0099] S320, matching the routing table of the page according to the routing information.
[0100] Since the page routing table caches the page access paths of the candidate shared pages loaded remotely, by matching the page access paths of the candidate shared pages with the routing information, it can be determined whether the routing table contains the routing information.
[0101] For example, the routing address of the shared page to be called is matched with the page access path in the routing table to determine whether the routing address exists in the routing table. If the routing address exists in the routing table, it means that the page information of the shared page to be called has been preloaded into the routing of the current system, otherwise, it is determined that the page information of the shared page to be called has not been preloaded.
[0102] S330, determine whether the routing table contains the routing information, if so, execute S360, otherwise execute S340.
[0103] Exemplarily, based on the matching result between the routing information and the routing table, it can be determined whether the routing table contains the routing information of the page to be called. If the routing table does not contain the routing information, it means that the page information of the page to be called has not been preloaded, and it is necessary to query the system access address according to the service identifier of the page to be called, so as to access the system of the shared page based on the system access address, and pull the alternative shared page shared by the system of the shared page. If the routing table contains the routing information, it means that the page information of the page to be called has been preloaded into the current system, and the page jump can be executed directly to prevent repeated loading of the page information of the same page.
[0104] S340: Acquire a system access address corresponding to the shared page according to the service identifier, and acquire page information of at least one candidate shared page according to the system access address.
[0105] S350: Update the page routing table according to the page information of the candidate shared page.
[0106] Exemplarily, since the system of shared pages is remotely accessed according to the system access address, and page information of at least one alternative shared page is obtained from the system of the shared page, the at least one alternative shared page includes the shared page to be called, and the page information of each alternative shared page is updated to the page routing table.
[0107] S360: Render the shared page to be called according to the routing table and routing information.
[0108] An embodiment of the present invention provides another page rendering method, which matches a routing table according to routing information of a shared page to be called before loading page information of an alternative shared page, determines whether page information of the shared page to be called has been preloaded according to a matching result, and after determining that the page to be called has been preloaded, renders the shared page to be called according to the routing table and routing information, thereby achieving page information loading for the same page only once, preventing repeated loading of page information of the same page, and reducing resource waste while ensuring page performance.
[0109] Figure 4 This is a flow chart of another page rendering method provided by an embodiment of the present invention. Based on the above embodiment, this embodiment additionally defines a method for determining a page file of a candidate shared page. Figure 4 As shown, the method includes:
[0110] S401. Generate a target script file according to a preset shared function.
[0111] Reference Figure 2 As shown, the shared function includes a publishing function, a subscribing function and a jumping function.
[0112] For example, a shared function with publish-subscribe function and capable of loading a page is written in advance, and the shared function is put into an independent js file, and the js file is used as the target script file. The js file is a file with js as the extension, and is a script file written in JavaScript scripting language.
[0113] S402: Generate the object content of the shared function according to the page access path and page code of each candidate shared page, and update the target script file according to the object content.
[0114] Among them, the candidate shared page is the page shared by the shared page system to other systems. You can use vue-router in advance to make each page independent so that each page has an independent page access path.
[0115] Since the system for sharing pages packages the sharable page code and the non-sharable code respectively, a page file containing the page code can be generated. Therefore, the system for acquiring the page can acquire the sharable page code from the system for sharing the page.
[0116] The present invention pre-introduces all candidate shared pages in the sharing page system into the same js file, sets an object for each candidate shared page, the object content includes the page access path, page name, page code, and puts the object content into an array, which is passed as a parameter into the publishing function in the sharing function.
[0117] It should be noted that the page access paths, page names, and page codes of all candidate shared pages in the same shared page system can be put into the same array, and the array can be passed as a parameter to the publishing function in the sharing function. The shared page system can also put the page access paths, page names, and page codes of the candidate shared pages corresponding to the same service into the same array according to the type of service to be shared. If the shared page system shares multiple services externally, multiple arrays will be passed to the publishing function, each array corresponding to a shared service.
[0118] S403: Generate at least one page file of a candidate shared page according to the updated target script file.
[0119] After the array is passed into the publishing function of the target script file, the sharing page system obtains the target script file from the CDN server, and uses webpack to package the target script file and related pages to obtain the page file.
[0120] Figure 5 A schematic diagram of the execution flow of a shared page provided by an embodiment of the present invention. Figure 5 As shown, the shared page system separates the shareable page code and the non-shareable code in advance to create an alternative shared page, then obtains the target script file from the CDN server, packages the target script file and the alternative shared page through webpack, and obtains the page file of the alternative shared page.
[0121] The system of the shared page is associated with the service name and stored in the database, so that when the system that obtains the page needs to call the service, it can query the access address of the system of the shared page.
[0122] S404: Obtain the service identifier and routing information of the shared page to be called.
[0123] In the system for obtaining pages, if it is necessary to call a shared page of a service, the jump function is called to obtain the service name and routing address in the jump function.
[0124] S405: Match the routing table of the page according to the routing information.
[0125] S406: Determine whether the routing table contains the routing information, if so, execute S407, otherwise execute S411.
[0126] S407: Acquire the system access address corresponding to the shared page according to the association relationship between the service identifier and the system access address.
[0127] S408: Access a corresponding target system according to the system access address, and obtain a page file of at least one candidate shared page corresponding to the service identifier from the target system.
[0128] The target system is a system of a shared page associated with the service name. The target system can be accessed according to the system access address of the target system, and the page file of the candidate shared page corresponding to the service identifier can be obtained from the target system.
[0129] Optionally, after accessing the target system, the page files of all shared pages may also be obtained from the target system, which is not specifically limited in the embodiment of the present invention.
[0130] S409: Obtain page information of each candidate shared page in the page file.
[0131] Exemplarily, the page file is loaded, and a shared function in a target script file in the page file is triggered, and the page code and page access path corresponding to each candidate shared page are obtained according to the shared function.
[0132] Specifically, when the page file is loaded, the subscription function in the target script file will be triggered to run, thereby obtaining the parameters in the publishing function in the target script, which are page information such as page access path and page code represented in array form.
[0133] S410: Add the page access path and page code of the candidate shared page to the routing table.
[0134] Reference Figure 5 As shown, the system for obtaining pages dynamically loads the page information into the routing table through the addRouter method of vue-router, so that the target page code can be obtained by matching the routing table according to the routing information, and then the page can be rendered according to the routing information and the target page code.
[0135] S411, matching the routing table according to the routing information to obtain a target page code, and rendering the shared page to be called according to the routing information and the target page code.
[0136] An embodiment of the present invention provides another page rendering method, which generates a target script file containing a shared function, passes the page access path and page code of each alternative shared page into the target script file as the object content of the shared function, and generates at least one page file of the alternative shared page according to the target script file. The page code can be shared with other systems to enable one copy of the code to run on multiple system pages.
[0137] Figure 6 The schematic diagram of the structure of a page rendering device provided by an embodiment of the present invention is shown in FIG. The device can be implemented in the form of hardware and / or software, and the page rendering device can be configured in an electronic device. Figure 6 As shown, the device includes: an information acquisition module 610, an address acquisition module 620 and a page rendering module 630.
[0138] The information acquisition module 610 is used to acquire the service identifier and routing information of the shared page to be called;
[0139] An address acquisition module 620, configured to acquire a system access address corresponding to the shared page according to the service identifier, and acquire page information of at least one candidate shared page according to the system access address;
[0140] The page rendering module 630 is used to update the page routing table according to the page information of the candidate shared page, and render the shared page to be called according to the routing table and the routing information.
[0141] Optionally, it also includes:
[0142] A routing matching module is used to match the routing table of the page according to the routing information after obtaining the service identifier and routing information of the shared page to be called;
[0143] The routing jump module is used to render the shared page to be called according to the routing table and the routing information when the routing information is contained in the routing table.
[0144] Optionally, the information acquisition module 610 is specifically used for:
[0145] The shared page to be called is determined according to the page jump event, and the service name and routing address of the shared page are obtained.
[0146] Optionally, the address acquisition module 620 is specifically used to:
[0147] According to the association relationship between the service identifier and the system access address, obtaining the system access address corresponding to the shared page;
[0148] Accessing a corresponding target system according to the system access address, and acquiring a page file of at least one candidate shared page corresponding to the service identifier from the target system;
[0149] Obtain page information of each candidate shared page in the page file.
[0150] Optionally, it also includes:
[0151] A page file determination module is used to generate a target script file based on a preset shared function; generate the object content of the shared function based on the page access path and page code of each alternative shared page, and update the target script file based on the object content; and generate a page file of at least one alternative shared page based on the updated target script file.
[0152] Optionally, the address acquisition module 620 is further configured to:
[0153] Loading the page file, triggering a shared function in a target script file in the page file;
[0154] The page code and page access path corresponding to each candidate shared page are obtained according to the shared function.
[0155] Optionally, the page rendering module 630 is specifically used for:
[0156] Adding the page access path and page code of the candidate shared page to the routing table;
[0157] The target page code is obtained by matching the routing table according to the routing information, and the shared page to be called is rendered according to the routing information and the target page code.
[0158] The page rendering device provided in the embodiment of the present invention can execute the page rendering method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0159] Figure 7 A schematic diagram of the structure of an electronic device 10 provided for an embodiment of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0160] like Figure 7 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0161] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0162] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a page rendering method.
[0163] In some embodiments, the page rendering method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the page rendering method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the page rendering method in any other appropriate manner (e.g., by means of firmware).
[0164] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0165] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0166] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, device, or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0167] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0168] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0169] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0170] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0171] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A page rendering method, characterized in that: include: The shared page to be called is a page shared by other systems in the platform to be called by the current system, and the current system is the system that obtains the shared page; The page-sharing system provides other systems with the page access path and page content of the shared page. The page-obtaining system is the system that obtains the shared page from the page-sharing system. The page-sharing system separates the page code that can be shared from the code that cannot be shared, and introduces all the shared pages of the same page-sharing system into the same script file. An object is set for each shared page, and the object content includes the page access path, page name and page content. Obtain all shared pages corresponding to the service identifier from the sharing page system, and record them as candidate shared pages, wherein the candidate shared pages include the shared page to be called and other shared pages having the same upper-level service as the shared page to be called; Obtain the service identifier and routing information of the shared page to be called, wherein the service identifier includes the system service name; According to the association relationship between the service identifier and the system access address, obtaining the system access address corresponding to the shared page; Accessing the corresponding target system according to the system access address, acquiring a page file of at least one candidate shared page corresponding to the service identifier from the target system, wherein the method for determining the page file of the at least one candidate shared page includes: Generate target script file according to preset shared functions; Generate the object content of the shared function according to the page access path and page code of each candidate shared page, and update the target script file according to the object content; Generate at least one page file of the candidate shared page according to the updated target script file, wherein the page file includes the target script file, the target script file includes the shared function, the parameters of the publishing function in the shared function include the page access path and the page code, generate the target script file including the shared function, and pass the object content of the shared function, then package the target script file and the related pages into a script file, and share the page code of each candidate shared page with other systems through the script file; Loading the page file, triggering a shared function in a target script file in the page file; Obtaining the page code and page access path corresponding to each candidate shared page according to the shared function; Adding the page access path and page code of the candidate shared page to the routing table of the page; The routing table is matched according to the routing information to obtain the target page code, and the shared page to be called is rendered according to the routing information and the target page code.
2. The method according to claim 1, characterized in that: After obtaining the service identifier and routing information of the shared page to be called, it also includes: A routing table for matching pages according to the routing information; In a case where the routing table contains the routing information, rendering of the shared page to be called is performed according to the routing table and the routing information.
3. The method according to claim 1, characterized in that The step of obtaining the service identifier and routing information of the shared page to be called includes: The shared page to be called is determined according to the page jump event, and the service name and routing address of the shared page are obtained.
4. A page rendering device, characterized in that: include: The shared page to be called is a page shared by other systems in the platform to be called by the current system, and the current system is the system that obtains the shared page; The page-sharing system provides other systems with the page access path and page content of the shared page. The page-obtaining system is the system that obtains the shared page from the page-sharing system. The page-sharing system separates the page code that can be shared from the code that cannot be shared, and introduces all the shared pages of the same page-sharing system into the same script file. An object is set for each shared page, and the object content includes the page access path, page name and page content. Obtain all shared pages corresponding to the service identifier from the sharing page system, and record them as candidate shared pages, wherein the candidate shared pages include the shared page to be called and other shared pages having the same upper-level service as the shared page to be called; An information acquisition module, used to acquire the service identifier and routing information of the shared page to be called, wherein the service identifier includes the system service name; An address acquisition module, used to acquire the system access address corresponding to the shared page according to the association relationship between the service identifier and the system access address; Accessing the corresponding target system according to the system access address, acquiring a page file of at least one candidate shared page corresponding to the service identifier from the target system, wherein the method for determining the page file of the at least one candidate shared page includes: Generate target script file according to preset shared functions; Generate the object content of the shared function according to the page access path and page code of each candidate shared page, and update the target script file according to the object content; Generate at least one page file of the candidate shared page according to the updated target script file, wherein the page file includes the target script file, the target script file includes the shared function, the parameters of the publishing function in the shared function include the page access path and the page code, generate the target script file including the shared function, and pass the object content of the shared function, then package the target script file and the related pages into a script file, and share the page code of each candidate shared page with other systems through the script file; Loading the page file, triggering a shared function in a target script file in the page file; Obtaining the page code and page access path corresponding to each candidate shared page according to the shared function; A page rendering module, used for adding the page access path and page code of the candidate shared page to the routing table of the page; The routing table is matched according to the routing information to obtain the target page code, and the shared page to be called is rendered according to the routing information and the target page code.
5. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the page rendering method according to any one of claims 1 to 3.
6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the page rendering method according to any one of claims 1 to 3 when executed.
Citation Information
Patent Citations
Page jumping method and device
CN106815276A
Data processing method and device, electronic equipment and storage medium
CN115098213A